diff --git a/sf_dlm/models/product_supplierinfo.py b/sf_dlm/models/product_supplierinfo.py
index 2784cba0..05191b44 100644
--- a/sf_dlm/models/product_supplierinfo.py
+++ b/sf_dlm/models/product_supplierinfo.py
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
-from odoo import models, fields
+import logging
+
+import re
+from odoo import models, fields, api
class ResProductCategory(models.Model):
@@ -28,6 +31,20 @@ class ResMrpBomMo(models.Model):
_inherit = 'mrp.bom'
subcontractor_id = fields.Many2one('res.partner', string='外包商')
+ subcontractor_name = fields.Char('', compute='_compute_subcontractor_ids', store=True)
+
+ @api.depends('subcontractor_id')
+ def _compute_subcontractor_ids(self):
+ for item in self:
+ if item.subcontractor_id:
+ logging.info("subcontractor_ids: %s" % item.subcontractor_ids.ids)
+ subcontractor_id = int(re.sub(r"\D", "", str(item.subcontractor_id.id)))
+ item.subcontractor_ids = [subcontractor_id]
+ item.subcontractor_name = item.subcontractor_id.name
+ logging.info("subcontractor_ids: %s" % item.subcontractor_ids.ids)
+ else:
+ item.subcontractor_ids = []
+ item.subcontractor_name = ''
def bom_create_line_has(self, embryo):
vals = {
diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml
index 7803b263..c62ae8cd 100644
--- a/sf_dlm/views/product_template_view.xml
+++ b/sf_dlm/views/product_template_view.xml
@@ -110,6 +110,9 @@
+
+
+
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index 2a5305f5..86d18009 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -214,8 +214,8 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'}
return json.JSONEncoder().encode(res)
workorder.button_finish()
- workorder.process_state = '待解除装夹'
- workorder.sudo().production_id.process_state = '待解除装夹'
+ # workorder.process_state = '待解除装夹'
+ # workorder.sudo().production_id.process_state = '待解除装夹'
# 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态
if workorder.date_finished:
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 5e575ef7..405fd1d5 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -67,7 +67,7 @@ class MrpProduction(models.Model):
('待加工', '待加工'),
('待解除装夹', '待解除装夹'),
('已完工', '已完工'),
- ], string='工序状态', related='workorder_ids.process_state', store=True)
+ ], string='工序状态')
# 零件图号
part_number = fields.Char('零件图号')
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index cdc190c2..90c24fe9 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -412,8 +412,8 @@ class ResMrpWorkOrder(models.Model):
work = workorder.production_id.workorder_ids
work.compensation_value_x = eval(self.material_center_point)[0]
work.compensation_value_y = eval(self.material_center_point)[1]
- work.process_state = '待加工'
- self.sudo().production_id.state = 'pending_processing'
+ # work.process_state = '待加工'
+ # self.sudo().production_id.process_state = '待加工'
self.date_finished = datetime.now()
workorder.button_finish()
@@ -867,6 +867,7 @@ class ResMrpWorkOrder(models.Model):
for move_raw_id in record.production_id.move_raw_ids:
move_raw_id.quantity_done = move_raw_id.product_uom_qty
record.process_state = '已完工'
+ record.production_id.process_state = '已完工'
record.production_id.button_mark_done1()
# self.production_id.state = 'done'
diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv
index 79800637..58879f72 100644
--- a/sf_tool_management/security/ir.model.access.csv
+++ b/sf_tool_management/security/ir.model.access.csv
@@ -1,6 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_functional_cutting_tool_entity,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,sf_base.group_sf_tool_user,1,1,1,0
access_sf_functional_cutting_tool_entity_group_plan_dispatch,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,sf_base.group_plan_dispatch,1,0,0,0
+access_sf_functional_cutting_tool_entity_group_sf_order_user,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,sf_base.group_sf_order_user,1,0,0,0
access_sf_functional_tool_warning,sf.functional.tool.warning,model_sf_functional_tool_warning,sf_base.group_sf_tool_user,1,1,1,0
access_sf_functional_tool_warning_group_plan_dispatch,sf.functional.tool.warning,model_sf_functional_tool_warning,sf_base.group_plan_dispatch,1,0,0,0