Merge branch 'feature/同步夹具型号Bug修复' into develop

This commit is contained in:
jinling.yang
2023-08-23 10:31:01 +08:00
8 changed files with 50 additions and 35 deletions

View File

@@ -308,6 +308,13 @@ class MachineToolType(models.Model):
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)
code = fields.Char('编码') code = fields.Char('编码')
def _get_ids(self, machine_tool_type_code):
machine_tool_type_ids = []
for item in machine_tool_type_code:
machine_tool_type = self.search([('code', '=', item)])
machine_tool_type_ids.append(machine_tool_type.id)
return [(6, 0, machine_tool_type_ids)]
class MachineToolCategory(models.Model): class MachineToolCategory(models.Model):
_name = 'sf.machine_tool.category' _name = 'sf.machine_tool.category'

View File

@@ -53,5 +53,10 @@ class FixtureModel(models.Model):
screw_size = fields.Integer(string="螺牙大小[mm]", size=6) screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)
# @api.model
# def create(self, vals):
# obj = super(FixtureModel, self).create(vals)
# return obj

View File

@@ -41,16 +41,16 @@
<form string="品牌" create="0" edit="0" delete="1"> <form string="品牌" create="0" edit="0" delete="1">
<sheet> <sheet>
<!-- <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>--> <!-- <widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>-->
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="code" readonly="1"/> <field name="name" readonly="1"/>
</h1> </h1>
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
</div> </div>
<group> <group>
<group> <group>
<field name="name" string="名称"/> <field name="code"/>
<field name="tag_ids" <field name="tag_ids"
widget="many2many_tags" widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}" options="{'color_field': 'color', 'no_create_edit': True}"
@@ -108,15 +108,15 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="code"/> <field name="name" placeholder="e.g. LED Monitor"/>
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<label for="name"/> <!-- <label for="name"/>-->
<h1> <!-- <h1>-->
<field name="name" string="设备名称" placeholder="e.g. LED Monitor"/> <!-- <field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>-->
</h1> <!-- </h1>-->
<field name="code" force_save="1" readonly="1"/> <field name="code" force_save="1" readonly="1"/>
<field name="brand_id" required="1" <field name="brand_id" required="1"
domain="[('tag_ids', '=', '机床')]" domain="[('tag_ids', '=', '机床')]"
@@ -363,7 +363,7 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="MTcode"/> <field name="name" placeholder="e.g. LED Monitor"/>
</h1> </h1>
</div> </div>
<group string="基本信息"> <group string="基本信息">
@@ -374,7 +374,7 @@
<!-- options="{'no_create': True}"/>--> <!-- options="{'no_create': True}"/>-->
<!-- </group>--> <!-- </group>-->
<group> <group>
<field name="name" required="1" string="设备名称" placeholder="e.g. LED Monitor"/> <field name="MTcode" required="1"/>
<field name="type_id" required="1" options="{'no_create': True}" <field name="type_id" required="1" options="{'no_create': True}"
domain="[('brand_id', '=', brand_id)]" domain="[('brand_id', '=', brand_id)]"
attrs="{'invisible': [('brand_id','=',False)]}"/> attrs="{'invisible': [('brand_id','=',False)]}"/>

View File

@@ -49,7 +49,7 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="code"/> <field name="name" required="1"/>
</h1> </h1>
</div> </div>
<group> <group>
@@ -57,7 +57,7 @@
<field name="sequence"/> <field name="sequence"/>
</group> </group>
<group> <group>
<field name="name" required="1"/> <field name="code" force_save="1" readonly="1"/>
</group> </group>
</group> </group>
<notebook> <notebook>
@@ -119,12 +119,12 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="process_encode"/> <field name="name" required="1"/>
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<field name="name" required="1" string="名称"/> <field name="process_encode"/>
</group> </group>
<notebook> <notebook>
<page string="可选参数"> <page string="可选参数">
@@ -199,12 +199,12 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="materials_no" readonly="1" force_save="1"/> <field name="name" readonly="1"/>
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<field name="name" readonly="1"/> <field name="materials_no" readonly="1" force_save="1"/>
<field name="gain_way" required="1"/> <field name="gain_way" required="1"/>
<field name="tensile_strength" required="1"/> <field name="tensile_strength" required="1"/>
<field name="hardness" required="1"/> <field name="hardness" required="1"/>
@@ -278,12 +278,12 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="materials_no"/> <field name="name" required="1"/>
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<field name="name" required="1" string="名称"/> <field name="materials_no"/>
</group> </group>
<notebook> <notebook>
<page string="型号"> <page string="型号">

View File

@@ -163,7 +163,7 @@
<field name="name">夹具型号</field> <field name="name">夹具型号</field>
<field name="model">sf.fixture.model</field> <field name="model">sf.fixture.model</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="夹具型号"> <tree string="夹具型号" create="0" edit="0" delete="1">
<field name="code"/> <field name="code"/>
<field name="name" string="名称"/> <field name="name" string="名称"/>
<field name="brand_id"/> <field name="brand_id"/>
@@ -177,16 +177,16 @@
<field name="name">夹具型号</field> <field name="name">夹具型号</field>
<field name="model">sf.fixture.model</field> <field name="model">sf.fixture.model</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="夹具型号"> <form string="夹具型号" create="0" edit="0" delete="1" >
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="code" force_save="1" readonly="1"/> <field name="name" />
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<field name="name" string="名称"/> <field name="code" force_save="1" readonly="1"/>
<field name="fixture_material_id" options="{'no_create': True}"/> <field name="fixture_material_id" options="{'no_create': True}"/>
<field name="fixture_material_type" invisible="1"/> <field name="fixture_material_type" invisible="1"/>
<field name="multi_mounting_type_id" options="{'no_create': True}"/> <field name="multi_mounting_type_id" options="{'no_create': True}"/>

View File

@@ -103,12 +103,12 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="code"/> <field name="name"/>
</h1> </h1>
</div> </div>
<group string="基本信息"> <group string="基本信息">
<group> <group>
<field name="name" string="名称"/> <field name="code" />
<field name="type_id"/> <field name="type_id"/>
<field name="type" invisible="1"/> <field name="type" invisible="1"/>
<field name="zero_chuck_model_ids" widget="many2many_tags" options="{'no_create': True}"/> <field name="zero_chuck_model_ids" widget="many2many_tags" options="{'no_create': True}"/>

View File

@@ -214,12 +214,12 @@
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="code"/> <field name="name" placeholder="e.g. LED Monitor"/>
</h1> </h1>
</div> </div>
<group> <group>
<group> <group>
<field name="name" string="名称"/> <field name="code" />
<field name="cutting_tool_material_id" <field name="cutting_tool_material_id"
options="{'no_create': True, 'no_quick_create': True}"/> options="{'no_create': True, 'no_quick_create': True}"/>
<field name="cutting_tool_type" invisible="1"/> <field name="cutting_tool_type" invisible="1"/>

View File

@@ -1519,10 +1519,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search( "materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id, [('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'], "driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
[('code', '=', item['apply_machine_tool_type_code'])]).id, item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'], "through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'], "screw_size": item['screw_size'],
"active": item['active'],
}) })
else: else:
fixture_model.write({ fixture_model.write({
@@ -1548,10 +1549,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search( "materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id, [('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'], "driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
[('code', '=', item['apply_machine_tool_type_code'])]).id, item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'], "through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'], "screw_size": item['screw_size'],
"active": item['active'],
}) })
else: else:
raise ValidationError("认证未通过") raise ValidationError("认证未通过")
@@ -1599,10 +1601,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search( "materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id, [('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'], "driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
[('code', '=', item['apply_machine_tool_type_code'])]).id, item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'], "through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'], "screw_size": item['screw_size'],
"active": item['active'],
}) })
else: else:
fixture_model.write({ fixture_model.write({
@@ -1628,8 +1631,8 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search( "materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id, [('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'], "driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search( "apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
[('code', '=', item['apply_machine_tool_type_code'])]).id, item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'], "through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'], "screw_size": item['screw_size'],
"active": item['active'], "active": item['active'],