diff --git a/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml b/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml
index 1cf6eb3f..8b1a85d0 100644
--- a/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml
+++ b/jikimo_sale_multiple_supply_methods/views/sale_order_views.xml
@@ -22,7 +22,7 @@
confirm_to_supply_method
-
+
draft,sent,supply method,sale
diff --git a/sf_base/models/base.py b/sf_base/models/base.py
index e8db18da..15d4f9cc 100644
--- a/sf_base/models/base.py
+++ b/sf_base/models/base.py
@@ -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)
diff --git a/sf_base/views/base_view.xml b/sf_base/views/base_view.xml
index eb2c1571..bd6f103b 100644
--- a/sf_base/views/base_view.xml
+++ b/sf_base/views/base_view.xml
@@ -633,4 +633,26 @@
sf.machining.accuracy
tree
+
+ #------------------坯料冗余量------------------
+
+ tree.sf.embryo.redundancy
+ sf.embryo.redundancy
+
+
+
+
+
+
+
+
+
+
+
+
+ 坯料冗余量
+ ir.actions.act_window
+ sf.embryo.redundancy
+ tree
+
\ No newline at end of file
diff --git a/sf_base/views/menu_view.xml b/sf_base/views/menu_view.xml
index 4c662976..cf7c7aaf 100644
--- a/sf_base/views/menu_view.xml
+++ b/sf_base/views/menu_view.xml
@@ -141,18 +141,25 @@
sequence="1"
action="action_sf_machine_brand"/>
+
+
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index 2bde02d9..35620913 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -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': """
diff --git a/sf_manufacturing/migrations/1.1/pre-migrate.py b/sf_manufacturing/migrations/1.1/pre-migrate.py
new file mode 100644
index 00000000..2fb94a6c
--- /dev/null
+++ b/sf_manufacturing/migrations/1.1/pre-migrate.py
@@ -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;
+ """)
diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py
index d08b024b..df47aecc 100644
--- a/sf_manufacturing/models/model_type.py
+++ b/sf_manufacturing/models/model_type.py
@@ -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',
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 3993a138..23439e27 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -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',
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index 7fea2fc9..7831a05f 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -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(
diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py
index 78566198..835183b3 100644
--- a/sf_mrs_connect/models/sync_common.py
+++ b/sf_mrs_connect/models/sync_common.py
@@ -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'],
})
\ No newline at end of file