From 00e2c98ad520e11ce71efc7fa61bee9d907254cf 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:39:05 +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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index 7ce5eae47..eaab5ee7a 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -191,3 +191,15 @@ 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