diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index ddbf4048..61bc83ea 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -8,7 +8,7 @@ from odoo.http import request class Manufacturing_Connect(http.Controller): - @http.route('/AutoDeviceApi/GetWoInfo', type='json', auth='none', methods=['GET', 'POST'], csrf=False, + @http.route('/AutoDeviceApi/GetWoInfo', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False, cors="*") def get_Work_Info(self, **kw): """ @@ -216,7 +216,8 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'} return json.JSONEncoder().encode(res) # workorder.write({'date_finished': datetime.now()}) - workorder.button_finish() + if ret['IsComplete'] is True: + workorder.button_finish() # workorder.process_state = '待解除装夹' # workorder.sudo().production_id.process_state = '待解除装夹' diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 1d65c0ae..002c83aa 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -684,7 +684,7 @@ class ResMrpWorkOrder(models.Model): values) # self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) - productions._create_workorder(is_fetchcnc=self.is_fetchcnc, scrap_production=self.production_id) + productions._create_workorder() productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \ ( p.move_dest_ids.procure_method != 'make_to_order' and diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 03ec8d0e..95d877b3 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -208,7 +208,7 @@ class StockRule(models.Model): ''' 创建工单 ''' - productions._create_workorder(is_fetchcnc=False, scrap_production=False) + productions._create_workorder() productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \ (