Compare commits
1 Commits
develop
...
feature/72
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bba9e8e8a8 |
@@ -4,4 +4,4 @@ wechatpy==1.8.18
|
||||
pycryptodome==3.22.0
|
||||
openupgradelib==3.10.0
|
||||
opcua==0.98.13
|
||||
openpyxl
|
||||
openpyxl
|
||||
@@ -67,52 +67,6 @@ class BasicParametersFixture(models.Model):
|
||||
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
|
||||
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
|
||||
|
||||
# ‘磁吸托盘’ 字段
|
||||
magnet_tray_length = fields.Float('磁吸托盘长度(mm)', digits=(16, 2))
|
||||
magnet_tray_width = fields.Float('磁吸托盘宽度(mm)', digits=(16, 2))
|
||||
magnet_tray_height = fields.Float('磁吸托盘厚度(mm)', digits=(16, 2))
|
||||
magnet_tray_diameter = fields.Float('磁吸托盘直径(mm)', digits=(16, 2))
|
||||
magnet_tray_weight = fields.Float('磁吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
magnet_max_adsorp_length = fields.Float('磁吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_width = fields.Float('磁吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_height = fields.Float('磁吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_diameter = fields.Float('磁吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_force = fields.Float('磁吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
magnet_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='磁吸托盘锁紧方式'
|
||||
)
|
||||
magnet_flatness = fields.Char('磁吸托盘平面精度(mm)', size=20)
|
||||
magnet_max_load = fields.Float('磁吸托盘最大负载(kg)', digits=(16, 2))
|
||||
|
||||
# ‘气吸托盘’ 字段
|
||||
air_tray_length = fields.Float('气吸托盘长度(mm)', digits=(16, 2))
|
||||
air_tray_width = fields.Float('气吸托盘宽度(mm)', digits=(16, 2))
|
||||
air_tray_height = fields.Float('气吸托盘高度(mm)', digits=(16, 2))
|
||||
air_tray_diameter = fields.Float('气吸托盘直径(mm)', digits=(16, 2))
|
||||
air_tray_weight = fields.Float('气吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
air_max_adsorp_length = fields.Float('气吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_width = fields.Float('气吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_height = fields.Float('气吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_diameter = fields.Float('气吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
air_max_adsorp_force = fields.Float('气吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
air_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='气吸托盘锁紧方式'
|
||||
)
|
||||
air_flatness = fields.Char('气吸托盘平面精度(mm)', size=20)
|
||||
air_max_load = fields.Float('气吸托盘最大负载(kg)', digits=(16, 2))
|
||||
air_boolean_chip_blowing_function = fields.Boolean('气吸托盘是否有吹屑功能')
|
||||
air_way_to_install = fields.Selection(
|
||||
[('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')],
|
||||
string='气吸托盘安装方式'
|
||||
)
|
||||
|
||||
|
||||
code = fields.Char('编码')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@@ -131,10 +85,6 @@ class BasicParametersFixture(models.Model):
|
||||
return self._json_adapter_board_fixture_param(fixture_materials_data)
|
||||
elif fixture_materials_name == '三爪卡盘':
|
||||
return self._json_scroll_chuck_param(fixture_materials_data)
|
||||
elif fixture_materials_name == '磁吸托盘':
|
||||
return self._json_magnet_tray_param(fixture_materials_data)
|
||||
elif fixture_materials_name == '气吸托盘':
|
||||
return self._json_air_tray_param(fixture_materials_data)
|
||||
return {}
|
||||
|
||||
def _json_zero_chuck_param(self, obj):
|
||||
@@ -334,57 +284,3 @@ class BasicParametersFixture(models.Model):
|
||||
'centering_diameter': obj['centering_diameter'],
|
||||
'type_of_drive': obj['type_of_drive'],
|
||||
'active': obj['active']}
|
||||
|
||||
def _json_magnet_tray_param(self, obj):
|
||||
"""磁吸托盘:将data数据转换成list数据"""
|
||||
return {
|
||||
'code': obj['code'],
|
||||
'fixture_model_id': self.env['sf.fixture.model'].sudo().search(
|
||||
[('code', '=', obj.get('fixture_model_code'))]).id,
|
||||
'name': obj['name'],
|
||||
'length': obj['length'],
|
||||
'width': obj['width'],
|
||||
'height': obj['height'],
|
||||
'diameter': obj['diameter'],
|
||||
'weight': obj['weight'],
|
||||
'max_adsorp_length': obj['max_adsorp_length'],
|
||||
'max_adsorp_width': obj['max_adsorp_width'],
|
||||
'max_adsorp_height': obj['max_adsorp_height'],
|
||||
'max_adsorp_diameter': obj.get('max_adsorp_diameter'),
|
||||
'max_adsorp_force': obj['max_adsorp_force'],
|
||||
'flatness': obj.get('flatness'),
|
||||
'max_load': obj.get('max_load'),
|
||||
'unlocking_method': obj.get('unlocking_method'),
|
||||
'materials_model_id': self.env['sf.materials.model'].sudo().search(
|
||||
[('materials_no', '=', obj['materials_model_id']), ('active', '=', True)]
|
||||
).id if obj.get('materials_model_id') else False,
|
||||
'active': obj.get('active', True),
|
||||
}
|
||||
|
||||
def _json_air_tray_param(self, obj):
|
||||
"""气吸托盘:将data数据转换成list数据"""
|
||||
return {
|
||||
'code': obj['code'],
|
||||
'fixture_model_id': self.env['sf.fixture.model'].sudo().search(
|
||||
[('code', '=', obj.get('fixture_model_code'))]).id,
|
||||
'name': obj['name'],
|
||||
'length': obj['length'],
|
||||
'width': obj['width'],
|
||||
'height': obj['height'],
|
||||
'diameter': obj['diameter'],
|
||||
'weight': obj['weight'],
|
||||
'max_adsorp_length': obj['max_adsorp_length'],
|
||||
'max_adsorp_width': obj['max_adsorp_width'],
|
||||
'max_adsorp_height': obj['max_adsorp_height'],
|
||||
'max_adsorp_diameter': obj.get('max_adsorp_diameter'),
|
||||
'max_adsorp_force': obj['max_adsorp_force'],
|
||||
'flatness': obj.get('flatness'),
|
||||
'max_load': obj.get('max_load'),
|
||||
'unlocking_method': obj.get('unlocking_method'),
|
||||
'boolean_chip_blowing_function': obj.get('blowing_function', False),
|
||||
'way_to_install': obj.get('way_to_install'),
|
||||
'materials_model_id': self.env['sf.materials.model'].sudo().search(
|
||||
[('materials_no', '=', obj['materials_model_id']), ('active', '=', True)]
|
||||
).id if obj.get('materials_model_id') else False,
|
||||
'active': obj.get('active', True),
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ class MrsMaterialModel(models.Model):
|
||||
materials_num = fields.Char("编码号")
|
||||
name = fields.Char('型号名')
|
||||
need_h = fields.Boolean("热处理", default="false")
|
||||
need_m = fields.Boolean("是否磁吸", default="false")
|
||||
mf_materia_post = fields.Char("热处理后密度")
|
||||
density = fields.Float("密度(kg/m³)")
|
||||
materials_id = fields.Many2one('sf.production.materials', "材料名")
|
||||
|
||||
@@ -35,7 +35,6 @@ class FixtureModel(models.Model):
|
||||
glb_url = fields.Char(string="图片")
|
||||
status = fields.Boolean('状态')
|
||||
active = fields.Boolean('有效', default=False)
|
||||
code = fields.Char(string='编码', readonly=True)
|
||||
|
||||
zero_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='零点卡盘基本参数')
|
||||
@@ -47,14 +46,11 @@ class FixtureModel(models.Model):
|
||||
string='虎钳夹具基本参数')
|
||||
magnet_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='磁吸夹具基本参数')
|
||||
magnet_tray_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='磁吸托盘基本参数')
|
||||
adapter_board_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='转接板(锁板)夹具基本参数')
|
||||
scroll_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='三爪卡盘基本参数')
|
||||
air_tray_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='气吸托盘基本参数')
|
||||
code = fields.Char(string='编码', readonly=True)
|
||||
|
||||
# def _get_code(self, fixture_model_type_code):
|
||||
# fixture_model = self.env['sf.fixture.model'].sudo().search(
|
||||
|
||||
@@ -263,7 +263,6 @@
|
||||
<field name="materials_no" readonly="1" force_save="1"/>
|
||||
<field name="gain_way" required="0"/>
|
||||
<field name="density" readonly="1" required="1" class="custom_required"/>
|
||||
<field name="need_m" default="false" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="rough_machining" required="1"/>
|
||||
@@ -307,7 +306,6 @@
|
||||
<field name="tensile_strength"/>
|
||||
<field name="hardness" optional="show"/>
|
||||
<field name="need_h"/>
|
||||
<field name="need_m"/>
|
||||
<field name="apply" widget="many2many_tags" optional="show"/>
|
||||
<field name="density" optional="show"/>
|
||||
<field name="rough_machining" optional="hide"/>
|
||||
@@ -354,7 +352,6 @@
|
||||
<field name="materials_no"/>
|
||||
<field name="name"/>
|
||||
<field name="need_h"/>
|
||||
<field name="need_m"/>
|
||||
<field name="mf_materia_post"/>
|
||||
<field name="density"/>
|
||||
<field name='materials_id' default="default" invisible="1"/>
|
||||
|
||||
@@ -328,52 +328,6 @@
|
||||
<field name="type_of_drive"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="air_tray_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '气吸托盘')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
<field name="code" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="length"/>
|
||||
<field name="width"/>
|
||||
<field name="height"/>
|
||||
<field name="diameter"/>
|
||||
<field name="weight" string="重量(kg)"/>
|
||||
<field name="max_adsorp_length"/>
|
||||
<field name="max_adsorp_width"/>
|
||||
<field name="max_adsorp_height"/>
|
||||
<field name="max_adsorp_diameter"/>
|
||||
<field name="max_adsorp_force"/>
|
||||
<field name="flatness"/>
|
||||
<field name="max_load"/>
|
||||
<field name="unlocking_method"/>
|
||||
<field name="boolean_chip_blowing_function"/>
|
||||
<field name="way_to_install"/>
|
||||
<field name="materials_model_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="magnet_tray_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '磁吸托盘')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
<field name="code" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="length"/>
|
||||
<field name="width"/>
|
||||
<field name="height"/>
|
||||
<field name="diameter"/>
|
||||
<field name="weight" string="重量(kg)"/>
|
||||
<field name="max_adsorp_length"/>
|
||||
<field name="max_adsorp_width"/>
|
||||
<field name="max_adsorp_height"/>
|
||||
<field name="max_adsorp_diameter"/>
|
||||
<field name="max_adsorp_force"/>
|
||||
<field name="flatness"/>
|
||||
<field name="max_load"/>
|
||||
<field name="unlocking_method"/>
|
||||
<field name="materials_model_id" options="{'no_create': True}" placeholder="请选择"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="scroll_chuck_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '三爪卡盘')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
|
||||
@@ -513,168 +513,112 @@
|
||||
</notebook>
|
||||
</page>
|
||||
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
|
||||
<group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
|
||||
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
|
||||
<field name="length" string="长度(mm)"/>
|
||||
<field name="width" string="宽度(mm)"/>
|
||||
<field name="height" string="高度(mm)"/>
|
||||
<field name="height_tolerance_value"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="diameter"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘', '零点托盘', '三爪卡盘', '磁吸托盘', '气吸托盘'])]}"/>
|
||||
<field name="weight"/>
|
||||
<field name="chucking_power_max"
|
||||
attrs="{'invisible': [('fixture_material_type', '=','磁吸夹具')]}"/>
|
||||
<field name="carrying_capacity_max"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="rigidity"/>
|
||||
</group>
|
||||
<group>
|
||||
<!-- 夹持工件尺寸 -->
|
||||
<label for="gripper_length_min" string="夹持工件最小尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_min" string="长"/>
|
||||
<field name="gripper_length_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_min" string="宽"/>
|
||||
<field name="gripper_width_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_height_min" string="高"/>
|
||||
<field name="gripper_height_min" class="o_address_zip"/>
|
||||
</div>
|
||||
<label for="gripper_length_max" string="夹持工件最大尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_max" string="长"/>
|
||||
<field name="gripper_length_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_max" string="宽"/>
|
||||
<field name="gripper_width_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_height_max" string="高"/>
|
||||
<field name="gripper_height_max" class="o_address_zip"/>
|
||||
</div>
|
||||
|
||||
<field name="gripper_diameter_min" string="夹持工件最小直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="gripper_diameter_max" string="夹持工件最大直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="clamping_diameter" string="装夹直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="clamping_num" placeholder="请选择" string="装夹单元数"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '零点卡盘')]}"/>
|
||||
<field name="repeated_positioning_accuracy" placeholder="请输入重复定位孔精度"
|
||||
string="重复定位精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="orientation_dish_diameter" string="定位盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="boolean_transposing_hole" string="是否有转位孔"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="connector_diameter" placeholder="请选择" string="连接头直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
|
||||
<field name="way_to_install" placeholder="请选择" string="安装方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气吸托盘'])]}"/>
|
||||
<field name="rated_air_pressure" string="额定气压(Mpa)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具'])]}"/>
|
||||
|
||||
<field name="transverse_groove" string="横向配合槽n(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
<field name="longitudinal_fitting_groove" string="纵向配合槽l(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
|
||||
<field name="rated_adsorption_force" string="额定吸附力(N/cm²)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_field_height" string="磁场高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_pole_plate_grinding_allowance" string="磁极板磨削余量(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
|
||||
<!-- 磁吸托盘字段 -->
|
||||
<field name="magnet_tray_length" string="磁吸托盘长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_tray_width" string="磁吸托盘宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_tray_height" string="磁吸托盘厚度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_tray_diameter" string="磁吸托盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_tray_weight" string="磁吸托盘重量(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
|
||||
<field name="magnet_max_adsorp_length" string="磁吸托盘最大吸附长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_max_adsorp_width" string="磁吸托盘最大吸附宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_max_adsorp_height" string="磁吸托盘最大吸附厚度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_max_adsorp_diameter" string="磁吸托盘最大吸附直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_max_adsorp_force" string="磁吸托盘最大吸附力(N)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
|
||||
<field name="magnet_unlocking_method" string="磁吸托盘锁紧方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_flatness" string="磁吸托盘平面精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
<field name="magnet_max_load" string="磁吸托盘最大负载(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸托盘'])]}"/>
|
||||
|
||||
<!-- 气吸托盘字段 -->
|
||||
<field name="air_tray_length" string="气吸托盘长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_tray_width" string="气吸托盘宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_tray_height" string="气吸托盘高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_tray_diameter" string="气吸托盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_tray_weight" string="气吸托盘重量(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
|
||||
<field name="air_max_adsorp_length" string="气吸托盘最大吸附长度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_max_adsorp_width" string="气吸托盘最大吸附宽度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_max_adsorp_height" string="气吸托盘最大吸附高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_max_adsorp_diameter" string="气吸托盘最大吸附直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_max_adsorp_force" string="气吸托盘最大吸附力(N)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
|
||||
<field name="air_unlocking_method" string="气吸托盘锁紧方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_flatness" string="气吸托盘平面精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_max_load" string="气吸托盘最大负载(kg)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_boolean_chip_blowing_function" string="气吸托盘是否有吹屑功能"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
<field name="air_way_to_install" string="气吸托盘安装方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气吸托盘'])]}"/>
|
||||
|
||||
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘','气吸托盘'])]}"/>
|
||||
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
|
||||
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','气吸托盘', '磁吸托盘'])]}"/>
|
||||
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
</group>
|
||||
<field name="brand_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="multi_mounting_type_id" placeholder="请选择" options="{'no_create': True}"
|
||||
attrs="{'required': [('categ_type', '=', '夹具')]}"/>
|
||||
<field name="length" string="长度(mm)"/>
|
||||
<field name="width" string="宽度(mm)"/>
|
||||
<field name="height" string="高度(mm)"/>
|
||||
<field name="height_tolerance_value"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="diameter"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘', '零点托盘', '三爪卡盘'])]}"/>
|
||||
<field name="weight"/>
|
||||
<field name="chucking_power_max"
|
||||
attrs="{'invisible': [('fixture_material_type', '=','磁吸夹具')]}"/>
|
||||
<field name="carrying_capacity_max"/>
|
||||
<field name="rigidity"/>
|
||||
</group>
|
||||
</page>
|
||||
<group>
|
||||
<label for="gripper_length_min" string="夹持工件最小尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_min" string="长"/>
|
||||
<field name="gripper_length_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_min" string="宽"/>
|
||||
<field name="gripper_width_min" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_height_min" string="高"/>
|
||||
<field name="gripper_height_min" class="o_address_zip"/>
|
||||
</div>
|
||||
<label for="gripper_length_max" string="夹持工件最大尺寸"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}">
|
||||
<label for="gripper_length_max" string="长"/>
|
||||
<field name="gripper_length_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_max" string="宽"/>
|
||||
<field name="gripper_width_max" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="gripper_width_max" string="高"/>
|
||||
<field name="gripper_width_max" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="gripper_diameter_min" string="夹持工件最小直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="gripper_diameter_max" string="夹持工件最大直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="clamping_diameter" string="装夹直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="clamping_num" placeholder="请选择" string="装夹单元数"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '零点卡盘')]}"/>
|
||||
<field name="repeated_positioning_accuracy" placeholder="请输入重复定位孔精度"
|
||||
string="重复定位精度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="orientation_dish_diameter" string="定位盘直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="boolean_transposing_hole" string="是否有转位孔"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="connector_diameter" placeholder="请选择" string="连接头直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
|
||||
<field name="way_to_install" placeholder="请选择" string="安装方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘'])]}"/>
|
||||
<field name="rated_air_pressure" string="额定气压(Mpa)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具'])]}"/>
|
||||
|
||||
<field name="transverse_groove" string="横向配合槽n(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
<field name="longitudinal_fitting_groove" string="纵向配合槽l(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['虎钳夹具'])]}"/>
|
||||
|
||||
<field name="rated_adsorption_force" string="额定吸附力(N/cm²)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_field_height" string="磁场高度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
<field name="magnetic_pole_plate_grinding_allowance" string="磁极板磨削余量(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['磁吸夹具'])]}"/>
|
||||
|
||||
<field name="screw_size" string="螺牙大小(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['转接板(锁板)夹具'])]}"/>
|
||||
<field name="via_hole_diameter" string="过孔直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['转接板(锁板)夹具'])]}"/>
|
||||
|
||||
<field name="mounting_hole_depth" string="安装孔深度(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['三爪卡盘'])]}"/>
|
||||
<field name="centering_diameter" string="定心直径(mm)"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['三爪卡盘'])]}"/>
|
||||
|
||||
<field name="boolean_chip_blowing_function" string="是否有吹屑功能"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘','零点托盘'])]}"/>
|
||||
<field name="materials_model_id" placeholder="请选择" options="{'no_create': True}"/>
|
||||
<field name="interface_materials_model_id" placeholder="请选择" string="接口类型"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['气动夹具','虎钳夹具','磁吸夹具'])]}"/>
|
||||
<field name="type_of_drive" placeholder="请选择" string="驱动方式"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点托盘','气动夹具','虎钳夹具','磁吸夹具','转接板(锁板)夹具','三爪卡盘'])]}"/>
|
||||
<field name="unlocking_method" string="解锁方式" placeholder="请选择"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
<field name="machine_tool_type_id" string="适用机床型号" placeholder="请选择"
|
||||
options="{'no_create': True}"
|
||||
attrs="{'invisible': [('fixture_material_type', 'not in', ['零点卡盘'])]}"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1215,51 +1215,6 @@ class ResProductFixture(models.Model):
|
||||
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
|
||||
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
|
||||
|
||||
# ‘磁吸托盘’ 字段
|
||||
magnet_tray_length = fields.Float('磁吸托盘长度(mm)', digits=(16, 2))
|
||||
magnet_tray_width = fields.Float('磁吸托盘宽度(mm)', digits=(16, 2))
|
||||
magnet_tray_height = fields.Float('磁吸托盘厚度(mm)', digits=(16, 2))
|
||||
magnet_tray_diameter = fields.Float('磁吸托盘直径(mm)', digits=(16, 2))
|
||||
magnet_tray_weight = fields.Float('磁吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
magnet_max_adsorp_length = fields.Float('磁吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_width = fields.Float('磁吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_height = fields.Float('磁吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_diameter = fields.Float('磁吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
magnet_max_adsorp_force = fields.Float('磁吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
magnet_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='磁吸托盘锁紧方式'
|
||||
)
|
||||
magnet_flatness = fields.Char('磁吸托盘平面精度(mm)', size=20)
|
||||
magnet_max_load = fields.Float('磁吸托盘最大负载(kg)', digits=(16, 2))
|
||||
|
||||
# ‘气吸托盘’ 字段
|
||||
air_tray_length = fields.Float('气吸托盘长度(mm)', digits=(16, 2))
|
||||
air_tray_width = fields.Float('气吸托盘宽度(mm)', digits=(16, 2))
|
||||
air_tray_height = fields.Float('气吸托盘高度(mm)', digits=(16, 2))
|
||||
air_tray_diameter = fields.Float('气吸托盘直径(mm)', digits=(16, 2))
|
||||
air_tray_weight = fields.Float('气吸托盘重量(kg)', digits=(16, 2))
|
||||
|
||||
air_max_adsorp_length = fields.Float('气吸托盘最大吸附长度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_width = fields.Float('气吸托盘最大吸附宽度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_height = fields.Float('气吸托盘最大吸附厚度(mm)', digits=(16, 2))
|
||||
air_max_adsorp_diameter = fields.Float('气吸托盘最大吸附直径(mm)', digits=(16, 2))
|
||||
air_max_adsorp_force = fields.Float('气吸托盘最大吸附力(N)', digits=(16, 2))
|
||||
|
||||
air_unlocking_method = fields.Selection(
|
||||
[('手动', '手动'), ('气动', '气动'), ('液压', '液压'), ('电动', '电动'), ('其他', '其他')],
|
||||
string='气吸托盘锁紧方式'
|
||||
)
|
||||
air_flatness = fields.Char('气吸托盘平面精度(mm)', size=20)
|
||||
air_max_load = fields.Float('气吸托盘最大负载(kg)', digits=(16, 2))
|
||||
air_boolean_chip_blowing_function = fields.Boolean('气吸托盘是否有吹屑功能')
|
||||
air_way_to_install = fields.Selection(
|
||||
[('接口式', '接口式'), ('螺栓固定', '螺栓固定'), ('磁吸式', '磁吸式'), ('其他', '其他')],
|
||||
string='气吸托盘安装方式'
|
||||
)
|
||||
|
||||
@api.onchange('specification_fixture_id')
|
||||
def _onchange_specification_fixture_id(self):
|
||||
if self.specification_fixture_id:
|
||||
|
||||
@@ -9,7 +9,6 @@ from odoo import models
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -179,7 +178,6 @@ class sfMaterialModel(models.Model):
|
||||
materials_model.mf_materia_post = item['mf_materia_post']
|
||||
materials_model.materials_id = materials.id
|
||||
materials_model.need_h = item['need_h']
|
||||
materials_model.need_m = item['need_m']
|
||||
materials_model.density = item['density']
|
||||
materials_model.active = item['active']
|
||||
else:
|
||||
@@ -194,7 +192,6 @@ class sfMaterialModel(models.Model):
|
||||
"active": item['active'],
|
||||
"materials_id": materials.id,
|
||||
"need_h": item['need_h'],
|
||||
"need_m": item['need_m'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
})
|
||||
@@ -231,7 +228,6 @@ class sfMaterialModel(models.Model):
|
||||
"standards_id": self.env['sf.international.standards'].search(
|
||||
[("name", '=', item['standards_id'])]).id,
|
||||
"need_h": item['need_h'],
|
||||
"need_m": item['need_m'],
|
||||
"alloy_code": item['alloy_code'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
@@ -252,7 +248,6 @@ class sfMaterialModel(models.Model):
|
||||
materials_model.mf_materia_post = item['mf_materia_post']
|
||||
materials_model.materials_id = materials.id
|
||||
materials_model.need_h = item['need_h']
|
||||
materials_model.need_m = item['need_m']
|
||||
materials_model.density = item['density']
|
||||
materials_model.active = item['active']
|
||||
materials_model.materials_code= item['materials_code']
|
||||
@@ -1615,10 +1610,6 @@ class SyncfixtureMaterialsBasicParameters(models.Model):
|
||||
self._write_or_create(all_list.get('adapter_board_yesterday_list'), '转接板(锁板)夹具')
|
||||
if all_list.get('scroll_chuck_all_list'):
|
||||
self._write_or_create(all_list.get('scroll_chuck_yesterday_list'), '三爪卡盘')
|
||||
if all_list.get('air_blow_tray_all_list'):
|
||||
self._write_or_create(all_list.get('air_tray_yesterday_list'), '气吸托盘')
|
||||
if all_list.get('magnet_tray_all_list'):
|
||||
self._write_or_create(all_list.get('magnet_tray_yesterday_list'), '磁吸托盘')
|
||||
else:
|
||||
raise ValidationError("夹具型号基本参数认证未通过")
|
||||
|
||||
@@ -1647,10 +1638,6 @@ class SyncfixtureMaterialsBasicParameters(models.Model):
|
||||
self._write_or_create(all_list.get('adapter_board_all_list'), '转接板(锁板)夹具')
|
||||
if all_list.get('scroll_chuck_all_list'):
|
||||
self._write_or_create(all_list.get('scroll_chuck_all_list'), '三爪卡盘')
|
||||
if all_list.get('air_blow_tray_all_list'):
|
||||
self._write_or_create(all_list.get('air_tray_all_list'), '气吸托盘')
|
||||
if all_list.get('magnet_tray_all_list'):
|
||||
self._write_or_create(all_list.get('magnet_tray_all_list'), '磁吸托盘')
|
||||
else:
|
||||
raise ValidationError("夹具型号基本参数认证未通过")
|
||||
|
||||
@@ -3243,4 +3230,4 @@ class EmbryoRedundancySync(models.Model):
|
||||
"height": item['height'],
|
||||
"active": item['active'],
|
||||
"remark": item['remark'],
|
||||
})
|
||||
})
|
||||
@@ -45759,11 +45759,6 @@ msgstr ""
|
||||
msgid "热处理"
|
||||
msgstr ""
|
||||
|
||||
#. module: sf_base
|
||||
#: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__need_m
|
||||
msgid "是否磁吸"
|
||||
msgstr ""
|
||||
|
||||
#. module: sf_base
|
||||
#: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__mf_materia_post
|
||||
msgid "热处理后密度"
|
||||
|
||||
2
sf_purchase_arrival_inform/__init__.py
Normal file
2
sf_purchase_arrival_inform/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import models
|
||||
from . import wizard
|
||||
33
sf_purchase_arrival_inform/__manifest__.py
Normal file
33
sf_purchase_arrival_inform/__manifest__.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 采购到货通知',
|
||||
'version': '1.1',
|
||||
'summary': '智能工厂计划管理',
|
||||
'sequence': 1,
|
||||
'description': """
|
||||
在本模块,支持采购到货通知
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['jikimo_purchase_request', 'quality_control', 'sf_manufacturing'],
|
||||
'data': [
|
||||
'views/product_category.xml',
|
||||
'views/purchase_view.xml',
|
||||
'wizard/purchase_confirm_wizard_view.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
'assets': {
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
'web.assets_backend': [
|
||||
|
||||
]
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
5
sf_purchase_arrival_inform/models/__init__.py
Normal file
5
sf_purchase_arrival_inform/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from . import product_category
|
||||
from . import purchase_order
|
||||
from . import storage_list
|
||||
from . import quality_check
|
||||
|
||||
7
sf_purchase_arrival_inform/models/product_category.py
Normal file
7
sf_purchase_arrival_inform/models/product_category.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class SfProductCategory(models.Model):
|
||||
_inherit = 'product.category'
|
||||
arrival_inform = fields.Boolean('到货通知', default=False)
|
||||
|
||||
108
sf_purchase_arrival_inform/models/purchase_order.py
Normal file
108
sf_purchase_arrival_inform/models/purchase_order.py
Normal file
@@ -0,0 +1,108 @@
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class SfPurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
# 收料入库明细
|
||||
storage_list_ids = fields.One2many('storage.list', 'purchase_order_id', string='收料入库明细')
|
||||
|
||||
# 计算字段:总收料数量
|
||||
total_received_quantity = fields.Float(string='到货数量',compute='_compute_total_received_quantity',store=True)
|
||||
|
||||
purchase_order_line_id = fields.Many2one('purchase.order.line', string='采购订单行')
|
||||
|
||||
@api.depends('order_line.arrival_quantity','order_line.product_qty')
|
||||
def _compute_total_received_quantity(self):
|
||||
for order in self:
|
||||
total_arrival_quantity = sum(line.arrival_quantity for line in order.order_line)
|
||||
total_product_qty=sum(line.product_qty for line in order.order_line)
|
||||
order.total_received_quantity = f'{total_arrival_quantity}/{total_product_qty}'
|
||||
|
||||
def open_arrival_inform(self):
|
||||
self.ensure_one()
|
||||
# 方式一:把数据写入普通模型(如果要持久化关联关系等场景)
|
||||
# 先清空旧数据(如果需要),避免重复
|
||||
self.env["storage.list"].search([
|
||||
("purchase_order_id", "=", self.id)
|
||||
]).unlink()
|
||||
pickings = self.env['stock.picking'].search([
|
||||
('origin', '=', self.name),
|
||||
# ('picking_type_code', '=', 'incoming'),
|
||||
('state', '!=', 'cancel')
|
||||
])
|
||||
relate_vals_list = []
|
||||
for picking in pickings:
|
||||
for move_line in picking.move_ids_without_package:
|
||||
relate_vals = {
|
||||
"purchase_order_id": self.id,
|
||||
"product_id": move_line.product_id.id,
|
||||
"picking_id": picking.id,
|
||||
"ordered_quantity": move_line.product_uom_qty,
|
||||
# "current_arrival_quantity": move_line.product_uom_qty, # 默认到货数量等于需求数量
|
||||
"product_code": move_line.product_id.default_code,
|
||||
"product_remark": move_line.name,
|
||||
"part_number": move_line.part_number,
|
||||
"state": picking.state,
|
||||
}
|
||||
relate_vals_list.append(relate_vals)
|
||||
if relate_vals_list:
|
||||
self.env["storage.list"].create(relate_vals_list)
|
||||
action = {
|
||||
'name': _("选择到货通知"),
|
||||
'type':'ir.actions.act_window',
|
||||
'view_mode':'form',
|
||||
'views': [(self.env.ref('sf_purchase_arrival_inform.storage_list_wrapper_form').id, 'form')],
|
||||
'res_model':'purchase.order',
|
||||
'target':'new',
|
||||
'res_id': self.id,
|
||||
'context': {
|
||||
'dialog_size': 'large',
|
||||
},
|
||||
}
|
||||
return action
|
||||
|
||||
def confirm_arrival_inform(self):
|
||||
"""确认到货通知"""
|
||||
# 直接调用storage_list的批量确认方法
|
||||
if self.storage_list_ids:
|
||||
self.storage_list_ids.button_confirm()
|
||||
|
||||
# 关闭弹窗
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
#询价单确认时加二次确认逻辑
|
||||
def button_confirm(self):
|
||||
"""采购订单确认,弹出确认向导"""
|
||||
# 无订单行时直接确认
|
||||
if not self.order_line:
|
||||
return super().button_confirm()
|
||||
|
||||
# 直接创建向导记录并打开
|
||||
wizard = self.env['purchase.confirm.wizard'].create({
|
||||
'purchase_order_id': self.id
|
||||
})
|
||||
|
||||
return {
|
||||
'name': _('询价单订单确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'purchase.confirm.wizard',
|
||||
'res_id': wizard.id,
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
def _execute_original_confirm(self):
|
||||
"""执行原始的确认逻辑"""
|
||||
res = super().button_confirm()
|
||||
return res
|
||||
|
||||
class SfPurchaseOrderLine(models.Model):
|
||||
_inherit = 'purchase.order.line'
|
||||
|
||||
# 到货数量(实际存储字段)
|
||||
arrival_quantity = fields.Float(string='到货数量', default=0.0, help='累计到货数量')
|
||||
|
||||
|
||||
|
||||
61
sf_purchase_arrival_inform/models/quality_check.py
Normal file
61
sf_purchase_arrival_inform/models/quality_check.py
Normal file
@@ -0,0 +1,61 @@
|
||||
from odoo import models, fields, api
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class QualityPoint(models.Model):
|
||||
_inherit = 'quality.point'
|
||||
|
||||
quality_status = fields.Selection([
|
||||
('waiting', '等待'),
|
||||
('none', '待处理')
|
||||
], string='默认质检状态',
|
||||
help='收料入库时质量检查单的默认状态。如果设置了此值,系统会在创建质检单时自动使用该状态。')
|
||||
|
||||
class QualityCheck(models.Model):
|
||||
_inherit = 'quality.check'
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
"""
|
||||
重写create方法,根据quality.point配置动态设置quality_state
|
||||
当picking_type为收料入库时,从质量控制点配置中获取默认状态
|
||||
"""
|
||||
# 先调用父类方法创建记录
|
||||
records = super().create(vals_list)
|
||||
|
||||
# 对创建的记录进行状态调整
|
||||
for record in records:
|
||||
try:
|
||||
# 只处理收料入库的质检单且未手动设置状态的记录
|
||||
if (record.picking_id and
|
||||
record.picking_id.picking_type_id.code == 'incoming' and
|
||||
record.quality_state in ['none', 'waiting']): # 只调整默认状态
|
||||
|
||||
# 查找匹配的质量控制点配置
|
||||
quality_point = record.point_id
|
||||
if not quality_point and record.product_id:
|
||||
# 如果没有直接关联的质量点,则根据产品和作业类型查找
|
||||
domain = self.env['quality.point']._get_domain(
|
||||
record.product_id,
|
||||
record.picking_id.picking_type_id,
|
||||
measure_on='product'
|
||||
)
|
||||
quality_point = self.env['quality.point'].search(domain, limit=1)
|
||||
|
||||
# 如果找到配置且有默认状态值,则更新记录状态
|
||||
if quality_point and quality_point.quality_status:
|
||||
original_state = record.quality_state
|
||||
record.quality_state = quality_point.quality_status
|
||||
|
||||
_logger.info(
|
||||
f"质量检查单状态已更新: {record.name}, "
|
||||
f"产品: {record.product_id.name}, "
|
||||
f"收料单: {record.picking_id.name}, "
|
||||
f"状态: {original_state} -> {quality_point.quality_status}"
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
_logger.warning(f"更新质量检查单状态时发生错误: {record.name}, 错误: {str(e)}")
|
||||
|
||||
return records
|
||||
140
sf_purchase_arrival_inform/models/storage_list.py
Normal file
140
sf_purchase_arrival_inform/models/storage_list.py
Normal file
@@ -0,0 +1,140 @@
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class StorageList(models.Model):
|
||||
_name = 'storage.list'
|
||||
_description = '收料入库明细'
|
||||
_order = 'create_date desc'
|
||||
|
||||
# 基础关联字段
|
||||
purchase_order_id = fields.Many2one('purchase.order', string='采购订单', required=True)
|
||||
picking_id = fields.Many2one('stock.picking', string='收料入库单', readonly=True)
|
||||
product_id = fields.Many2one('product.product', string='产品', required=True)
|
||||
|
||||
# 产品信息(基于product_id的related字段)
|
||||
product_code = fields.Char(related='product_id.default_code', string='产品料号', store=True)
|
||||
product_remark = fields.Text(string='产品说明')
|
||||
part_number = fields.Char(string='零件图号')
|
||||
|
||||
# 数量字段
|
||||
ordered_quantity = fields.Float(string='需求数量', required=True)
|
||||
# 到货数量,默认=需求数量
|
||||
current_arrival_quantity = fields.Float(string='到货数量', required=True)
|
||||
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
# 如果没有设置current_arrival_quantity,则默认等于ordered_quantity
|
||||
if 'current_arrival_quantity' not in vals and 'ordered_quantity' in vals:
|
||||
vals['current_arrival_quantity'] = vals['ordered_quantity']
|
||||
return super().create(vals)
|
||||
|
||||
@api.constrains('current_arrival_quantity')
|
||||
def _check_current_arrival_quantity(self):
|
||||
for line in self:
|
||||
if line.current_arrival_quantity <= 0:
|
||||
raise ValidationError('到货数量必须大于0')
|
||||
if line.current_arrival_quantity > line.ordered_quantity:
|
||||
raise ValidationError('当前到货数量不能超过需求数量')
|
||||
|
||||
def button_confirm(self):
|
||||
"""更新采购订单行的收料数量"""
|
||||
for record in self:
|
||||
# 查找对应的采购订单行
|
||||
order_line = self.env['purchase.order.line'].search([
|
||||
('order_id', '=', record.purchase_order_id.id),
|
||||
('product_id', '=', record.product_id.id)
|
||||
], limit=1)
|
||||
|
||||
if order_line:
|
||||
# 累加当前记录的到货数量到采购订单行
|
||||
order_line.arrival_quantity += record.current_arrival_quantity
|
||||
|
||||
# 更新质量检查单状态为待处理
|
||||
if self:
|
||||
self._update_quality_check_status(self[0].purchase_order_id)
|
||||
|
||||
|
||||
def _update_quality_check_status(self, purchase_order):
|
||||
"""更新质量检查单状态为待处理
|
||||
Args:
|
||||
purchase_order: 采购订单记录
|
||||
Returns:
|
||||
int: 更新的质量检查单数量
|
||||
"""
|
||||
try:
|
||||
# 获取当前到货通知涉及的收料入库单
|
||||
storage_records = self.env['storage.list'].search([
|
||||
('purchase_order_id', '=', purchase_order.id)
|
||||
])
|
||||
if not storage_records:
|
||||
return 0
|
||||
|
||||
# 收集所有相关的picking_id和product_id(过滤空值)
|
||||
picking_ids = [pid for pid in storage_records.mapped('picking_id.id') if pid]
|
||||
product_ids = [pid for pid in storage_records.mapped('product_id.id') if pid]
|
||||
|
||||
if not picking_ids or not product_ids:
|
||||
return 0
|
||||
|
||||
# 构建质量检查单搜索域,包含等待和待处理状态
|
||||
base_domain = [
|
||||
('quality_state', 'in', ['waiting', 'none']),
|
||||
('product_id', 'in', product_ids),
|
||||
]
|
||||
|
||||
# 方法1:通过picking_id精确匹配质量检查单
|
||||
quality_checks_by_picking = self.env['quality.check'].search(
|
||||
base_domain + [('picking_id', 'in', picking_ids)]
|
||||
)
|
||||
|
||||
# 方法2:通过move_id匹配(更精确,因为一个picking可能有多个move)
|
||||
stock_moves = self.env['stock.move'].search([
|
||||
('picking_id', 'in', picking_ids),
|
||||
('product_id', 'in', product_ids),
|
||||
])
|
||||
|
||||
quality_checks_by_move = self.env['quality.check']
|
||||
if stock_moves:
|
||||
quality_checks_by_move = self.env['quality.check'].search(
|
||||
base_domain + [('move_id', 'in', stock_moves.ids)]
|
||||
)
|
||||
|
||||
# 方法3:通过move_line_id匹配(最精确)
|
||||
move_lines = self.env['stock.move.line'].search([
|
||||
('picking_id', 'in', picking_ids),
|
||||
('product_id', 'in', product_ids),
|
||||
])
|
||||
|
||||
quality_checks_by_move_line = self.env['quality.check']
|
||||
if move_lines:
|
||||
quality_checks_by_move_line = self.env['quality.check'].search(
|
||||
base_domain + [('move_line_id', 'in', move_lines.ids)]
|
||||
)
|
||||
|
||||
# 合并所有匹配的质量检查单(去重)
|
||||
all_quality_checks = quality_checks_by_picking | quality_checks_by_move | quality_checks_by_move_line
|
||||
|
||||
if not all_quality_checks:
|
||||
return 0
|
||||
|
||||
# 批量更新状态为待处理
|
||||
all_quality_checks.write({'quality_state': 'none'})
|
||||
|
||||
# 记录日志
|
||||
product_names = storage_records.mapped('product_id.name')
|
||||
purchase_order.message_post(
|
||||
body=f"到货通知确认:已更新 {len(all_quality_checks)} 个质量检查单状态为待处理<br/>"
|
||||
f"涉及产品:{', '.join(product_names)}<br/>"
|
||||
f"涉及收料入库单:{', '.join([p.name or '' for p in storage_records.mapped('picking_id')])}"
|
||||
)
|
||||
|
||||
return len(all_quality_checks)
|
||||
|
||||
except Exception as e:
|
||||
# 记录错误日志,但不阻断流程
|
||||
purchase_order.message_post(
|
||||
body=f"更新质量检查单状态时发生错误:{str(e)}"
|
||||
)
|
||||
return 0
|
||||
4
sf_purchase_arrival_inform/security/ir.model.access.csv
Normal file
4
sf_purchase_arrival_inform/security/ir.model.access.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_storage_list,storage.list,model_storage_list,purchase.group_purchase_user,1,1,1,1
|
||||
access_purchase_confirm_wizard,purchase.confirm.wizard,model_purchase_confirm_wizard,purchase.group_purchase_user,1,1,1,1
|
||||
access_purchase_confirm_wizard_line,purchase.confirm.wizard.line,model_purchase_confirm_wizard_line,purchase.group_purchase_user,1,1,1,1
|
||||
|
27
sf_purchase_arrival_inform/views/product_category.xml
Normal file
27
sf_purchase_arrival_inform/views/product_category.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- 继承产品分类视图 -->
|
||||
<record id="product_category_form_view_inherit" model="ir.ui.view">
|
||||
<field name="name">product.category.form.inherit</field>
|
||||
<field name="model">product.category</field>
|
||||
<field name="inherit_id" ref="stock.product_category_form_view_inherit" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='removal_strategy_id']" position="after">
|
||||
<field name="arrival_inform"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="quality_view_form" model="ir.ui.view">
|
||||
<field name="name">arrival.inform.quality.point.view.form</field>
|
||||
<field name="model">quality.point</field>
|
||||
<field name="inherit_id" ref="mrp_workorder.quality_point_view_form_inherit_mrp"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="picking_type_ids" position="after">
|
||||
<field name="quality_status"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
58
sf_purchase_arrival_inform/views/purchase_view.xml
Normal file
58
sf_purchase_arrival_inform/views/purchase_view.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- 继承采购订单视图 -->
|
||||
<record id="purchase_order_view_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">purchase.order.tree.inherit</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='date_planned']" position="after">
|
||||
<field name="total_received_quantity"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree" position="inside">
|
||||
<button name="open_arrival_inform" string="到货通知" type="object" class="btn-primary"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="purchase_order_form" model="ir.ui.view">
|
||||
<field name="name">purchase.order.form</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='order_line']/tree" position="inside">
|
||||
<field name="arrival_quantity"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- 到货通知form视图 -->
|
||||
<record id="storage_list_wrapper_form" model="ir.ui.view">
|
||||
<field name="name">storage.list.wrapper.form</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="选择到货通知" create="false" duplicate="false">
|
||||
<group>
|
||||
<field name="name" readonly="1"/>
|
||||
</group>
|
||||
|
||||
<field name="storage_list_ids">
|
||||
<tree string="收料入库明细" editable="bottom" create="false" delete="true" export="false">
|
||||
<field name="product_code"/>
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_remark" widget="section_and_note_text" readonly="1"/>
|
||||
<field name="part_number" readonly="1"/>
|
||||
<field name="ordered_quantity" readonly="1"/>
|
||||
<field name="current_arrival_quantity" attrs="{'invisible': [('ordered_quantity', '=', '0')]}"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
<footer>
|
||||
<button name="confirm_arrival_inform" string="确认" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
<button string="取消" class="btn-secondary" special="cancel" data-hotkey="z"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
2
sf_purchase_arrival_inform/wizard/__init__.py
Normal file
2
sf_purchase_arrival_inform/wizard/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import purchase_confirm_wizard
|
||||
|
||||
64
sf_purchase_arrival_inform/wizard/purchase_confirm_wizard.py
Normal file
64
sf_purchase_arrival_inform/wizard/purchase_confirm_wizard.py
Normal file
@@ -0,0 +1,64 @@
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class PurchaseConfirmWizard(models.TransientModel):
|
||||
_name = 'purchase.confirm.wizard'
|
||||
_description = '采购订单确认向导'
|
||||
|
||||
purchase_order_id = fields.Many2one('purchase.order', string='采购订单', required=True)
|
||||
line_ids = fields.One2many('purchase.confirm.wizard.line', 'wizard_id', string='产品明细')
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
"""创建向导时自动生成产品明细"""
|
||||
records = super().create(vals_list)
|
||||
|
||||
for record in records:
|
||||
if record.purchase_order_id:
|
||||
# 自动创建产品明细行
|
||||
line_data = []
|
||||
for line in record.purchase_order_id.order_line:
|
||||
line_data.append({
|
||||
'wizard_id': record.id,
|
||||
'product_id': line.product_id.id,
|
||||
'product_name': line.product_id.name,
|
||||
'product_qty': line.product_qty,
|
||||
'product_uom': line.product_uom.name,
|
||||
'uom_rounding': line.product_uom.rounding,
|
||||
})
|
||||
|
||||
if line_data:
|
||||
self.env['purchase.confirm.wizard.line'].create(line_data)
|
||||
|
||||
return records
|
||||
|
||||
def action_confirm(self):
|
||||
"""确认采购订单"""
|
||||
if self.purchase_order_id:
|
||||
# 调用原始的确认方法
|
||||
self.purchase_order_id._execute_original_confirm()
|
||||
|
||||
# 返回关闭向导并刷新采购订单页面
|
||||
return {
|
||||
'type': 'ir.actions.act_window_close',
|
||||
'infos': {
|
||||
'title': _('成功'),
|
||||
'message': _('采购订单已确认成功!'),
|
||||
}
|
||||
}
|
||||
|
||||
def action_cancel(self):
|
||||
"""取消操作"""
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
class PurchaseConfirmWizardLine(models.TransientModel):
|
||||
_name = 'purchase.confirm.wizard.line'
|
||||
_description = '采购订单确认向导明细'
|
||||
|
||||
wizard_id = fields.Many2one('purchase.confirm.wizard', string='向导', ondelete='cascade')
|
||||
product_id = fields.Many2one('product.product', string='产品')
|
||||
product_name = fields.Char(string='产品名称')
|
||||
product_qty = fields.Float(string='数量')
|
||||
product_uom = fields.Char(string='单位')
|
||||
uom_rounding = fields.Float(string='舍入精度')
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- 采购订单确认向导视图 -->
|
||||
<record id="purchase_confirm_wizard_form" model="ir.ui.view">
|
||||
<field name="name">purchase.confirm.wizard.form</field>
|
||||
<field name="model">purchase.confirm.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="采购订单确认">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<strong>确认提示:</strong>以下产品数量将按单位舍入精度向上取整处理,请核实后确认是否继续。
|
||||
</div>
|
||||
|
||||
<group>
|
||||
<field name="purchase_order_id" readonly="1"/>
|
||||
</group>
|
||||
|
||||
<separator string="产品明细信息"/>
|
||||
|
||||
<field name="line_ids" readonly="1" nolabel="1" widget="one2many_list">
|
||||
<tree decoration-info="True" create="false" edit="false">
|
||||
<field name="product_name" string="产品名称" width="40%"/>
|
||||
<field name="product_qty" string="订购数量" width="20%"/>
|
||||
<field name="product_uom" string="计量单位" width="20%"/>
|
||||
<field name="uom_rounding" string="舍入精度" widget="float" digits="[16,6]" width="20%"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
<footer>
|
||||
<button name="action_confirm" string="确认订单" type="object" class="btn-primary"/>
|
||||
<button name="action_cancel" string="取消" type="object" class="btn-secondary"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user