增加坯料冗余量
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<attribute name="name">confirm_to_supply_method</attribute>
|
||||
</xpath>
|
||||
<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 expr="//header/field[@name='state']" position="attributes">
|
||||
<attribute name="statusbar_visible">draft,sent,supply method,sale</attribute>
|
||||
|
||||
@@ -416,7 +416,8 @@ class EmbryoRedundancy(models.Model):
|
||||
_name = "sf.embryo.redundancy"
|
||||
|
||||
name = fields.Char('名称', required=True)
|
||||
long = fields.Float('长度', required=True)
|
||||
width = fields.Float('宽度', required=True)
|
||||
height = fields.Float('高度', required=True)
|
||||
long = fields.Float('长度(mm)', required=True)
|
||||
width = fields.Float('宽度(mm)', required=True)
|
||||
height = fields.Float('高度(mm)', required=True)
|
||||
code = fields.Char('编码', required=True)
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
@@ -633,4 +633,26 @@
|
||||
<field name="res_model">sf.machining.accuracy</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</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>
|
||||
@@ -141,18 +141,25 @@
|
||||
sequence="1"
|
||||
action="action_sf_machine_brand"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_embryo_redundancy"
|
||||
parent="menu_sf_base"
|
||||
name="坯料冗余"
|
||||
sequence="2"
|
||||
action="action_sf_embryo_redundancy"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_machining_accuracy"
|
||||
parent="menu_sf_base"
|
||||
name="加工精度"
|
||||
sequence="1"
|
||||
sequence="3"
|
||||
action="action_sf_machining_accuracy"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_sf_machine_control_system"
|
||||
parent="menu_sf_base"
|
||||
name="数控系统"
|
||||
sequence="2"
|
||||
sequence="4"
|
||||
action="action_sf_machine_control_system"/>
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 制造管理',
|
||||
'version': '1.0',
|
||||
'version': '1.1',
|
||||
'summary': '智能工厂制造模块',
|
||||
'sequence': 1,
|
||||
'description': """
|
||||
|
||||
6
sf_manufacturing/migrations/1.1/pre-migrate.py
Normal file
6
sf_manufacturing/migrations/1.1/pre-migrate.py
Normal 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;
|
||||
""")
|
||||
@@ -6,7 +6,7 @@ class ModelType(models.Model):
|
||||
_description = '模型类型'
|
||||
|
||||
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',
|
||||
'成品工序模板(自动化产线加工')
|
||||
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',
|
||||
|
||||
@@ -852,7 +852,7 @@ class ResProductMo(models.Model):
|
||||
attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
# 获取坯料冗余配置
|
||||
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:
|
||||
embryo_redundancy_id = item.get('embryo_redundancy')
|
||||
vals = {
|
||||
@@ -938,11 +938,6 @@ class ResProductMo(models.Model):
|
||||
# surface_technology = self.env['stock.route'].sudo().search([('name', '=', '表面工艺外协')])
|
||||
# if 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
|
||||
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(
|
||||
@@ -951,6 +946,11 @@ class ResProductMo(models.Model):
|
||||
[('materials_no', '=', item['texture_type_code'])])
|
||||
model_type = self.env['sf.model.type'].search([], limit=1)
|
||||
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)
|
||||
vals = {
|
||||
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',
|
||||
|
||||
@@ -314,13 +314,15 @@ class StockRule(models.Model):
|
||||
i = 0
|
||||
for k in (production_item.product_id.model_processing_panel.split(',')):
|
||||
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:
|
||||
model = 'sf.manual.product.model.type.routing.sort'
|
||||
product_routing_workcenter = self.env[model].search(
|
||||
[('product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
|
||||
order='sequence asc'
|
||||
)
|
||||
product_routing_workcenter = self.env['sf.manual.product.model.type.routing.sort'].search(
|
||||
[('manual_product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
|
||||
order='sequence asc'
|
||||
)
|
||||
for route in product_routing_workcenter:
|
||||
i += 1
|
||||
technology_design_values.append(
|
||||
|
||||
@@ -3199,6 +3199,7 @@ class EmbryoRedundancySync(models.Model):
|
||||
embryo_redundancy.long = item['long']
|
||||
embryo_redundancy.width = item['width']
|
||||
embryo_redundancy.height = item['height']
|
||||
embryo_redundancy.active = item['active']
|
||||
else:
|
||||
self.env['sf.embryo.redundancy'].sudo().create({
|
||||
"name": item['name'],
|
||||
@@ -3206,4 +3207,5 @@ class EmbryoRedundancySync(models.Model):
|
||||
"long": item['long'],
|
||||
"width": item['width'],
|
||||
"height": item['height'],
|
||||
"active": item['active'],
|
||||
})
|
||||
Reference in New Issue
Block a user