diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv
index b5c637f6..782d924d 100644
--- a/sf_base/security/ir.model.access.csv
+++ b/sf_base/security/ir.model.access.csv
@@ -153,6 +153,9 @@ access_purchase_order,purchase.order,purchase.model_purchase_order,sf_base.group
access_res_partner,res.partner,base.model_res_partner,sf_base.group_plan_dispatch,1,0,0,0
access_purchase_order_line,purchase.order.line,purchase.model_purchase_order_line,sf_base.group_plan_dispatch,1,0,0,0
access_account_move_line,account.move.line,account.model_account_move_line,sf_base.group_plan_dispatch,1,0,0,0
+
+access_sf_machine_tool_type_group_plan_dispatch,sf.machine_tool.type,model_sf_machine_tool_type,sf_base.group_plan_dispatch,1,0,0,0
+
access_sf_machine_tool,sf_machine_tool,model_sf_machine_tool,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_machine_tool_type,sf_machine_tool_type,model_sf_machine_tool_type,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_machine_brand,sf_machine_brand,model_sf_machine_brand,sf_base.group_sf_mrp_user,1,1,0,0
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index 9063f518..c548222a 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -210,7 +210,7 @@ class Manufacturing_Connect(http.Controller):
'state': 'finished'})
production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)])
if production_obj:
- production_obj.sudo().schedule_state = '已完成'
+ production_obj.sudo().work_order_state = '已完成'
production_obj.write({'state': 'completed'})
request.env['sale.order'].sudo().search(
[('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'})
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index d843c283..dff2763b 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -20,6 +20,8 @@ class MrpProduction(models.Model):
model_file = fields.Binary('模型文件', related='product_id.model_file')
schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
string='排程状态', default='未排')
+ work_order_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
+ string='工单状态', default='未排')
# state = fields.Selection(selection_add=[
# ('pending_scheduling', '待排程'),
@@ -53,8 +55,7 @@ class MrpProduction(models.Model):
production_line_id = fields.Many2one('sf.production.line', string='生产线')
plan_start_processing_time = fields.Datetime('计划开始加工时间')
production_line_state = fields.Selection([('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
- string='上/下产线', default='待上产线')
-
+ string='上/下产线', default='待上产线')
@api.depends(
'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state',
@@ -94,9 +95,9 @@ class MrpProduction(models.Model):
production.state = 'pending_processing'
# elif production.state == 'progress' and production.schedule_state == '已完成':
# production.state = 'completed'
- elif production.state == 'pending_processing' and production.schedule_state == '已完成':
+ elif production.state == 'pending_processing' and production.work_order_state == '已完成':
production.state = 'completed'
- elif production.state == 'progress' and production.schedule_state == '已完成':
+ elif production.state == 'progress' and production.work_order_state == '已完成':
production.state = 'completed'
def action_check(self):
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index cca86f6e..f3aded39 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -245,30 +245,31 @@
+
@@ -282,24 +283,24 @@
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 6ac179c1..ca04dd4d 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -104,21 +104,22 @@
+
+ attrs="{'invisible': ['|', '|','|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False), ('routing_type', '=', 'CNC加工')]}"/>
+ attrs="{'invisible': ['|', '|','|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False), ('routing_type', '=', 'CNC加工')]}"/>
+ attrs="{'invisible': ['|', '|','|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'),('user_permissions','=',False),('state','=','done'), ('routing_type', '=', 'CNC加工')]}"/>