增加坯料冗余量

This commit is contained in:
胡尧
2024-11-19 08:59:52 +08:00
parent 21f961d893
commit d53f3837c3
10 changed files with 60 additions and 20 deletions

View File

@@ -22,7 +22,7 @@
<attribute name="name">confirm_to_supply_method</attribute> <attribute name="name">confirm_to_supply_method</attribute>
</xpath> </xpath>
<xpath expr="//header/button[@name='confirm_to_supply_method']" position="before"> <xpath expr="//header/button[@name='confirm_to_supply_method']" position="before">
<button name="action_confirm" string="供货方式确认" type="object" attrs="{'invisible': [('state', '!=', 'supply method')]}" confirm="您确定要确认供货方式吗?"/> <button name="action_confirm" string="供货方式确认" type="object" attrs="{'invisible': [('state', '!=', 'supply method')]}" confirm="确认供货方式"/>
</xpath> </xpath>
<xpath expr="//header/field[@name='state']" position="attributes"> <xpath expr="//header/field[@name='state']" position="attributes">
<attribute name="statusbar_visible">draft,sent,supply method,sale</attribute> <attribute name="statusbar_visible">draft,sent,supply method,sale</attribute>

View File

@@ -416,7 +416,8 @@ class EmbryoRedundancy(models.Model):
_name = "sf.embryo.redundancy" _name = "sf.embryo.redundancy"
name = fields.Char('名称', required=True) name = fields.Char('名称', required=True)
long = fields.Float('长度', required=True) long = fields.Float('长度(mm)', required=True)
width = fields.Float('宽度', required=True) width = fields.Float('宽度(mm)', required=True)
height = fields.Float('高度', required=True) height = fields.Float('高度(mm)', required=True)
code = fields.Char('编码', required=True) code = fields.Char('编码', required=True)
active = fields.Boolean('有效', default=True)

View File

@@ -633,4 +633,26 @@
<field name="res_model">sf.machining.accuracy</field> <field name="res_model">sf.machining.accuracy</field>
<field name="view_mode">tree</field> <field name="view_mode">tree</field>
</record> </record>
#------------------坯料冗余量------------------
<record model="ir.ui.view" id="tree_sf_embryo_redundancy_view">
<field name="name">tree.sf.embryo.redundancy</field>
<field name="model">sf.embryo.redundancy</field>
<field name="arch" type="xml">
<tree string="坯料冗余量" create="0" edit="0" delete="0">
<field name="name"/>
<field name="code"/>
<field name="long"/>
<field name="width"/>
<field name="height"/>
</tree>
</field>
</record>
<record id="action_sf_embryo_redundancy" model="ir.actions.act_window">
<field name="name">坯料冗余量</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.embryo.redundancy</field>
<field name="view_mode">tree</field>
</record>
</odoo> </odoo>

View File

@@ -141,18 +141,25 @@
sequence="1" sequence="1"
action="action_sf_machine_brand"/> action="action_sf_machine_brand"/>
<menuitem
id="menu_sf_embryo_redundancy"
parent="menu_sf_base"
name="坯料冗余"
sequence="2"
action="action_sf_embryo_redundancy"/>
<menuitem <menuitem
id="menu_sf_machining_accuracy" id="menu_sf_machining_accuracy"
parent="menu_sf_base" parent="menu_sf_base"
name="加工精度" name="加工精度"
sequence="1" sequence="3"
action="action_sf_machining_accuracy"/> action="action_sf_machining_accuracy"/>
<menuitem <menuitem
id="menu_sf_machine_control_system" id="menu_sf_machine_control_system"
parent="menu_sf_base" parent="menu_sf_base"
name="数控系统" name="数控系统"
sequence="2" sequence="4"
action="action_sf_machine_control_system"/> action="action_sf_machine_control_system"/>

View File

@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details. # Part of Odoo. See LICENSE file for full copyright and licensing details.
{ {
'name': '机企猫智能工厂 制造管理', 'name': '机企猫智能工厂 制造管理',
'version': '1.0', 'version': '1.1',
'summary': '智能工厂制造模块', 'summary': '智能工厂制造模块',
'sequence': 1, 'sequence': 1,
'description': """ 'description': """

View File

@@ -0,0 +1,6 @@
def migrate(cr, version):
cr.execute("""
UPDATE sf_model_type
SET embryo_tolerance = (SELECT id FROM sf_embryo_redundancy LIMIT 1)
WHERE embryo_tolerance = 0;
""")

View File

@@ -6,7 +6,7 @@ class ModelType(models.Model):
_description = '模型类型' _description = '模型类型'
name = fields.Char('名称') name = fields.Char('名称')
embryo_tolerance = fields.Integer('坯料容余') embryo_tolerance = fields.Many2one('sf.embryo.redundancy', string='坯料容余', required=True)
product_routing_tmpl_ids = fields.One2many('sf.product.model.type.routing.sort', 'product_model_type_id', product_routing_tmpl_ids = fields.One2many('sf.product.model.type.routing.sort', 'product_model_type_id',
'成品工序模板(自动化产线加工') '成品工序模板(自动化产线加工')
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id', embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',

View File

@@ -852,7 +852,7 @@ class ResProductMo(models.Model):
attachment = self.attachment_create(item['model_name'], item['model_data']) attachment = self.attachment_create(item['model_name'], item['model_data'])
# 获取坯料冗余配置 # 获取坯料冗余配置
if not item.get('embryo_redundancy'): if not item.get('embryo_redundancy'):
embryo_redundancy_id = self.env['sf.embryo.redundancy'].search([('name', '=', '粗坯料')], limit=1) embryo_redundancy_id = model_type.embryo_tolerance
else: else:
embryo_redundancy_id = item.get('embryo_redundancy') embryo_redundancy_id = item.get('embryo_redundancy')
vals = { vals = {
@@ -938,11 +938,6 @@ class ResProductMo(models.Model):
# surface_technology = self.env['stock.route'].sudo().search([('name', '=', '表面工艺外协')]) # surface_technology = self.env['stock.route'].sudo().search([('name', '=', '表面工艺外协')])
# if surface_technology: # if surface_technology:
# no_bom_copy_product_id.route_ids |= surface_technology # no_bom_copy_product_id.route_ids |= surface_technology
# 获取坯料冗余配置
if not item.get('embryo_redundancy_id'):
embryo_redundancy_id = self.env['sf.embryo.redundancy'].search([('name', '=', '粗坯料')], limit=1)
else:
embryo_redundancy_id = item.get('embryo_redundancy_id')
no_bom_copy_product_id.product_tmpl_id.active = True no_bom_copy_product_id.product_tmpl_id.active = True
logging.info('no_bom_copy_product_id[is_manual_processing]:%s' % no_bom_copy_product_id.is_manual_processing) logging.info('no_bom_copy_product_id[is_manual_processing]:%s' % no_bom_copy_product_id.is_manual_processing)
materials_id = self.env['sf.production.materials'].search( materials_id = self.env['sf.production.materials'].search(
@@ -951,6 +946,11 @@ class ResProductMo(models.Model):
[('materials_no', '=', item['texture_type_code'])]) [('materials_no', '=', item['texture_type_code'])])
model_type = self.env['sf.model.type'].search([], limit=1) model_type = self.env['sf.model.type'].search([], limit=1)
supplier = self.env['mrp.bom'].get_supplier(materials_type_id) supplier = self.env['mrp.bom'].get_supplier(materials_type_id)
# 获取坯料冗余配置
if not item.get('embryo_redundancy_id'):
embryo_redundancy_id = model_type.embryo_tolerance
else:
embryo_redundancy_id = item.get('embryo_redundancy_id')
logging.info('no_bom_copy_product_supplier-vals:%s' % supplier) logging.info('no_bom_copy_product_supplier-vals:%s' % supplier)
vals = { vals = {
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R', 'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',

View File

@@ -314,13 +314,15 @@ class StockRule(models.Model):
i = 0 i = 0
for k in (production_item.product_id.model_processing_panel.split(',')): for k in (production_item.product_id.model_processing_panel.split(',')):
if production_item.production_type == '自动化产线加工': if production_item.production_type == '自动化产线加工':
model = 'sf.product.model.type.routing.sort' product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
[('product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
order='sequence asc'
)
else: else:
model = 'sf.manual.product.model.type.routing.sort' product_routing_workcenter = self.env['sf.manual.product.model.type.routing.sort'].search(
product_routing_workcenter = self.env[model].search( [('manual_product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
[('product_model_type_id', '=', production_item.product_id.product_model_type_id.id)], order='sequence asc'
order='sequence asc' )
)
for route in product_routing_workcenter: for route in product_routing_workcenter:
i += 1 i += 1
technology_design_values.append( technology_design_values.append(

View File

@@ -3199,6 +3199,7 @@ class EmbryoRedundancySync(models.Model):
embryo_redundancy.long = item['long'] embryo_redundancy.long = item['long']
embryo_redundancy.width = item['width'] embryo_redundancy.width = item['width']
embryo_redundancy.height = item['height'] embryo_redundancy.height = item['height']
embryo_redundancy.active = item['active']
else: else:
self.env['sf.embryo.redundancy'].sudo().create({ self.env['sf.embryo.redundancy'].sudo().create({
"name": item['name'], "name": item['name'],
@@ -3206,4 +3207,5 @@ class EmbryoRedundancySync(models.Model):
"long": item['long'], "long": item['long'],
"width": item['width'], "width": item['width'],
"height": item['height'], "height": item['height'],
"active": item['active'],
}) })