From 533ace858fe3359d812acfcff42c7af9d948c93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Fri, 6 Mar 2026 19:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_purchase/models/inherit_purchase_order.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index 7ce5eae47..ec8014882 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -191,3 +191,16 @@ class InheritPurchaseOrderLine(models.Model): ]) record.category_ids = [(6, 0, matching_categories.ids)] if matching_categories else [(5,)] + def button_confirm(self): + for order in self: + # 去掉状态限制,所有状态都可以确认 + order.order_line._validate_analytic_distribution() + order._add_supplier_to_product() + if order._approval_allowed(): + order.button_approve() + else: + order.write({'state': 'to approve'}) + if order.partner_id not in order.message_partner_ids: + order.message_subscribe([order.partner_id.id]) + return True +