diff --git a/jikimo_purchase_tier_validation/__manifest__.py b/jikimo_purchase_tier_validation/__manifest__.py index 91dcbb49..a7bdbddf 100644 --- a/jikimo_purchase_tier_validation/__manifest__.py +++ b/jikimo_purchase_tier_validation/__manifest__.py @@ -20,7 +20,7 @@ 'version': '0.1', # any module necessary for this one to work correctly - 'depends': ['purchase', 'base_tier_validation', 'documents', 'purchase_request', 'account', 'purchase_order_approved'], + 'depends': ['purchase', 'purchase_tier_validation', 'documents', 'purchase_request', 'account', 'purchase_order_approved'], # always loaded 'data': [ diff --git a/jikimo_purchase_tier_validation/wizards/__init__.py b/jikimo_purchase_tier_validation/wizards/__init__.py index e134fb87..43edb50d 100644 --- a/jikimo_purchase_tier_validation/wizards/__init__.py +++ b/jikimo_purchase_tier_validation/wizards/__init__.py @@ -1 +1,2 @@ -from . import upload_file_wizard \ No newline at end of file +from . import upload_file_wizard +from . import comment_wizard \ No newline at end of file diff --git a/jikimo_purchase_tier_validation/wizards/comment_wizard.py b/jikimo_purchase_tier_validation/wizards/comment_wizard.py new file mode 100644 index 00000000..f45ecde6 --- /dev/null +++ b/jikimo_purchase_tier_validation/wizards/comment_wizard.py @@ -0,0 +1,15 @@ +from odoo import models, fields + + +class CommentWizard(models.TransientModel): + _inherit = "comment.wizard" + + def add_comment(self): + + rec = self.env[self.res_model].browse(self.res_id) + + self.review_ids = rec.review_ids + + result = super(CommentWizard, self).add_comment() + + return result diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 8b34feb8..447c6da1 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -330,7 +330,7 @@ class ResMrpWorkOrder(models.Model): return result def _get_surface_technics_purchase_ids(self): - domain = [('origin', '=', self.production_id.name), ('purchase_type', '=', 'consignment')] + domain = [('origin', 'like', '%' + self.production_id.name + '%'), ('purchase_type', '=', 'consignment')] purchase_orders = self.env['purchase.order'].search(domain) purchase_orders_id = self.env['purchase.order'] for po in purchase_orders: @@ -1058,16 +1058,18 @@ class ResMrpWorkOrder(models.Model): and workorder.production_id.schedule_state == '已排' and len(workorder.production_id.picking_ids.filtered( lambda w: w.state not in ['done', 'cancel'])) == 0): + workorder.state = 'ready' if workorder.is_subcontract is True: purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id.state == 'purchase': - workorder.state = 'ready' + move_out = workorder.move_subcontract_workorder_ids[1] + for mo in move_out: + if mo.state != 'done': + mo.write({'state': 'assigned', 'production_id': False}) continue - else: - workorder.state = 'waiting' - continue - else: - workorder.state = 'ready' + continue + else: + workorder.state = 'waiting' continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' @@ -1076,7 +1078,7 @@ class ResMrpWorkOrder(models.Model): if workorder.state != 'waiting': workorder.state = 'waiting' continue - if workorder.production_id.programming_state == '已编程' and workorder.technology_design_id.routing_tag != 'special': + if workorder.production_id.programming_state == '已编程': workorder.state = 'ready' elif workorder.state != 'waiting': workorder.state = 'waiting' @@ -1091,12 +1093,17 @@ class ResMrpWorkOrder(models.Model): if workorder.is_subcontract is False: workorder.state = 'ready' else: + if len(workorder.production_id.picking_ids.filtered( + lambda w: w.state not in ['done', + 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程': + workorder.state = 'ready' purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: - workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting' - else: - workorder.state = 'waiting' - + if purchase_orders_id.state == 'purchase': + move_out = workorder.move_subcontract_workorder_ids[1] + for mo in move_out: + if mo.state != 'done': + mo.write({'state': 'assigned', 'production_id': False}) # 重写工单开始按钮方法 def button_start(self): diff --git a/sf_manufacturing/wizard/workpiece_delivery_wizard.py b/sf_manufacturing/wizard/workpiece_delivery_wizard.py index 10171806..6a13fc08 100644 --- a/sf_manufacturing/wizard/workpiece_delivery_wizard.py +++ b/sf_manufacturing/wizard/workpiece_delivery_wizard.py @@ -207,8 +207,9 @@ class WorkpieceDeliveryWizard(models.TransientModel): workorder.production_line_id.id != self.production_ids[0].production_line_id.id): raise UserError(f'该rfid对应的制造订单号为{workorder.production_id.name}的目的生产线不一致') - # 调用打印成品条码方法 - workorder.print_method() + if workorder.routing_type == '解除装夹': + # 调用打印成品条码方法 + workorder.print_method() # 将对象添加到对应的同模型且是多对多类型里 self.production_ids |= workorder.production_id diff --git a/sf_plan_management/i18n/zh_CN.po b/sf_plan_management/i18n/zh_CN.po index b811963b..dde8ccfd 100644 --- a/sf_plan_management/i18n/zh_CN.po +++ b/sf_plan_management/i18n/zh_CN.po @@ -2023,6 +2023,11 @@ msgstr "损失" msgid "Maintenance" msgstr "" +#. module: sf_manufacturing +#: model:ir.model.fields.selection,name:sf_manufacturing.selection__mrp_production__state__confirmed +msgid "待排程" +msgstr "待排程" + #. module: mrp #: model_terms:ir.ui.view,arch_db:mrp.product_product_form_view_bom_button #: model_terms:ir.ui.view,arch_db:mrp.product_template_form_view_bom_button