From 58acdc4913127f3bead850dbedba000e49714fec Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Thu, 2 Jan 2025 16:38:26 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=B7=A5=E8=89=BA=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E8=A1=A8=E9=9D=A2=E5=B7=A5=E8=89=BA=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E5=85=B3=E8=81=94=E9=87=87=E8=B4=AD=E5=8D=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/sale_order.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 1b282c8e..621ddfc7 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -396,23 +396,6 @@ class RePurchaseOrder(models.Model): production = self.env['mrp.production'].search([('name', '=', production_name)]) for workorder in production.workorder_ids.filtered( lambda wd: wd.routing_type == '表面工艺' and wd.state == 'waiting' and line.product_id.server_product_process_parameters_id == wd.surface_technics_parameters_id): - work_ids = workorder.production_id.workorder_ids.filtered( - lambda wk: wk.state not in ['done', 'rework', 'cancel']) - min_sequence_wk = min(work_ids, key=lambda wk: wk.sequence) - artificial_offline = ( - workorder.production_id.production_type == '人工线下加工' and workorder.production_id.schedule_state != '已排') - auto_production = ( - workorder.production_id.production_type == '自动化产线加工' and workorder.production_id.programming_state != '已编程') - if workorder.sequence == min_sequence_wk.sequence: - if artificial_offline or auto_production: - raise UserError('等待组件') - else: - sorted_work_ids = work_ids.sorted(key=lambda w: w.sequence) - previous_workorder = self.env['mrp.workorder'].search([('sequence', '<', workorder.sequence), - ('production_id', '=', workorder.production_id.id), - ('state', '=', 'done')], order='sequence desc', limit=1) - if not previous_workorder: - raise UserError('等待组件') workorder.state = 'ready' return result From 170309b3c006329e07a5bb1cf070ba05cc909034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 3 Jan 2025 10:01:52 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_purchase_tier_validation/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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': [ From 0d28df04151e9cc80d4981b7099461090e18c42e Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 3 Jan 2025 12:52:27 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E9=80=82=E9=85=8D=E5=A4=9A=E5=B1=82?= =?UTF-8?q?=E5=AE=A1=E6=89=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_purchase_tier_validation/models/models.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/jikimo_purchase_tier_validation/models/models.py b/jikimo_purchase_tier_validation/models/models.py index 5a581980..d90ed257 100644 --- a/jikimo_purchase_tier_validation/models/models.py +++ b/jikimo_purchase_tier_validation/models/models.py @@ -87,7 +87,17 @@ class jikimo_purchase_tier_validation(models.Model): def _validate_tier(self, tiers=False): res = super(jikimo_purchase_tier_validation, self)._validate_tier(tiers) - self.state = 'approved' + tier_reviews = tiers or self.review_ids + + # 检查是否所有审批都已通过 + all_approved = all( + tier_review.status == 'approved' + for tier_review in tier_reviews + ) + + if all_approved and tier_reviews: # 确保有审批记录 + self.state = 'approved' + return res def _rejected_tier(self, tiers=False): From b3f56754cdae93627b3c162c53368fe7fbebb9d7 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 3 Jan 2025 15:09:03 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan_management/i18n/zh_CN.po | 5 +++++ 1 file changed, 5 insertions(+) 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 From 5cff411aafa74adde0b2b4b3d4c7a61721d318a4 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 3 Jan 2025 15:25:47 +0800 Subject: [PATCH 5/9] =?UTF-8?q?r=E7=8E=AF=E5=A2=83=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wizards/__init__.py | 3 ++- .../wizards/comment_wizard.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 jikimo_purchase_tier_validation/wizards/comment_wizard.py 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 From aaded331cdd8ca23ec1eb329f55579b9bb7080f9 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 6 Jan 2025 10:11:44 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=A7=A3=E9=99=A4=E8=A3=85=E5=A4=B9?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=A2=9E=E5=8A=A0=E5=89=8D=E7=BD=AE=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/wizard/workpiece_delivery_wizard.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 From 403e64a9570ecb4d2b9f73b2e1336ce730e789e0 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 6 Jan 2025 11:09:22 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E5=B7=A5=E8=89=BA?= =?UTF-8?q?=E5=A4=96=E5=8D=8F=E5=85=B3=E8=81=94=E9=87=87=E8=B4=AD=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 31 +++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) 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): From 79d561ba683c6c7c2ef81ee34e6b7790fa8e0272 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 6 Jan 2025 13:01:58 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 447c6da1..6cb177dc 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1058,18 +1058,16 @@ 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': - move_out = workorder.move_subcontract_workorder_ids[1] - for mo in move_out: - if mo.state != 'done': - mo.write({'state': 'assigned', 'production_id': False}) + workorder.state = 'ready' continue - continue - else: - workorder.state = 'waiting' + else: + workorder.state = 'waiting' + continue + else: + workorder.state = 'ready' continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' @@ -1093,17 +1091,11 @@ 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: - 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}) + workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting' + else: + workorder.state = 'waiting' # 重写工单开始按钮方法 def button_start(self): From ad02cbf8cb4e536d40ef63985e22acb6e813d8df Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 7 Jan 2025 13:40:17 +0800 Subject: [PATCH 9/9] =?UTF-8?q?sf-=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95-?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=B7=BB=E5=8A=A0=E5=A4=96=E5=8D=8F=E5=B7=A5?= =?UTF-8?q?=E5=BA=8F=EF=BC=8C=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=8F=98=E6=88=90=E5=B7=B2=E5=AE=8C=E6=88=90=EF=BC=8C?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E7=9A=84=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E4=B8=AD=E6=B2=A1=E6=9C=89=E8=AF=A5=E4=BA=A7=E5=93=81=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E6=8B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 6 +++--- sf_manufacturing/models/stock.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 6cb177dc..a3e0da75 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1279,7 +1279,7 @@ class ResMrpWorkOrder(models.Model): raise UserError('请先完成该工单的工艺外协再进行操作') # 表面工艺外协,最后一张工单 workorders = self.production_id.workorder_ids - subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence') + subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state != 'cancel').sorted('sequence') if self == subcontract_workorders[-1]: # 给下一个库存移动就绪 self.move_subcontract_workorder_ids[0].move_dest_ids._action_done() @@ -1303,8 +1303,8 @@ class ResMrpWorkOrder(models.Model): is_production_id = False rework_workorder = record.production_id.workorder_ids.filtered(lambda p: p.state == 'rework') done_workorder = record.production_id.workorder_ids.filtered(lambda p1: p1.state in ['done']) - if (len(rework_workorder) + len(done_workorder) == len(record.production_id.workorder_ids)) or ( - len(done_workorder) == len(record.production_id.workorder_ids)): + if (len(rework_workorder) + len(done_workorder) == len(record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))) or ( + len(done_workorder) == len(record.production_id.workorder_ids.filtered(lambda wo: wo.state != 'cancel'))): is_production_id = True if record.routing_type in ['解除装夹'] or ( record.is_rework is True and record.routing_type in ['装夹预调']): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 745b5974..86a75759 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -637,7 +637,7 @@ class StockPicking(models.Model): if move_in: workorder = move_in.subcontract_workorder_id workorders = workorder.production_id.workorder_ids - subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence') + subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True and wo.state!='cancel').sorted('sequence') if workorder == subcontract_workorders[-1]: self.env['stock.quant']._update_reserved_quantity( move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty,