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 +