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