Accept Merge Request #337: (feature/同步夹具型号Bug修复 -> develop)

Merge Request: 夹具型号同步修复和页面名称加大醒目

Created By: @杨金灵
Accepted By: @杨金灵
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/337?initial=true
This commit is contained in:
杨金灵
2023-08-23 10:30:43 +08:00
committed by Coding
8 changed files with 50 additions and 35 deletions

View File

@@ -308,6 +308,13 @@ class MachineToolType(models.Model):
active = fields.Boolean('有效', default=True)
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):
_name = 'sf.machine_tool.category'

View File

@@ -53,5 +53,10 @@ class FixtureModel(models.Model):
screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
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">
<sheet>
<!-- <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">
<h1>
<field name="code" readonly="1"/>
<field name="name" readonly="1"/>
</h1>
<field name="image_brand" widget='image' class="oe_avatar"
options="{'preview_image': 'image_128'}" string="log"/>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code"/>
<field name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}"
@@ -108,15 +108,15 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group>
<group>
<label for="name"/>
<h1>
<field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>
</h1>
<!-- <label for="name"/>-->
<!-- <h1>-->
<!-- <field name="name" string="设备名称" placeholder="e.g. LED Monitor"/>-->
<!-- </h1>-->
<field name="code" force_save="1" readonly="1"/>
<field name="brand_id" required="1"
domain="[('tag_ids', '=', '机床')]"
@@ -363,7 +363,7 @@
<sheet>
<div class="oe_title">
<h1>
<field name="MTcode"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group string="基本信息">
@@ -374,7 +374,7 @@
<!-- options="{'no_create': True}"/>-->
<!-- </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}"
domain="[('brand_id', '=', brand_id)]"
attrs="{'invisible': [('brand_id','=',False)]}"/>

View File

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

View File

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

View File

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

View File

@@ -214,12 +214,12 @@
<sheet>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="name" placeholder="e.g. LED Monitor"/>
</h1>
</div>
<group>
<group>
<field name="name" string="名称"/>
<field name="code" />
<field name="cutting_tool_material_id"
options="{'no_create': True, 'no_quick_create': True}"/>
<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_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
fixture_model.write({
@@ -1548,10 +1549,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
raise ValidationError("认证未通过")
@@ -1599,10 +1601,11 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],
})
else:
fixture_model.write({
@@ -1628,8 +1631,8 @@ class SyncFixtureModel(models.Model):
"materials_model_id": self.env['sf.materials.model'].search(
[('materials_no', '=', item['materials_model_code'])]).id,
"driving_way": item['driving_way'],
"apply_machine_tool_type_id": self.env['sf.machine_tool.type'].search(
[('code', '=', item['apply_machine_tool_type_code'])]).id,
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
item['apply_machine_tool_type_code']).id,
"through_hole_size": item['through_hole_size'],
"screw_size": item['screw_size'],
"active": item['active'],