From 679cf0d83fa527ca28c3debc347dedac0d5a5a5b Mon Sep 17 00:00:00 2001 From: Prakash Prajapati Date: Mon, 26 Nov 2018 07:02:14 +0000 Subject: [PATCH] [FIX] purchase_requisition: Request Approval on exclusive requisition Usecase to reproduce: - Enable 'Managers must approve orders' - Set agreement type as 'exclusive' - Connect as purchase user - Create a requisition and an RFQ linked to it - Confirm the RFQ It raises a usererror that ask to close other PO linked to requisition. It happens because the purchase requisition code do not take care of double validation on PO. It will try to close the requisition once button_confirm is called. However it will only write 'to approve' on PO state and thus trigger the requistion error will be raise since all linked PO are not 'done' or 'cancel'. In order to fix it, the action_done on requisition should be call on button_approve instead of button_confirm. (button_approve is automatically called when double validation is not enable). Task: #1884410 Closes #28068 closes odoo/odoo#29049 --- addons/purchase_requisition/models/purchase_requisition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase_requisition/models/purchase_requisition.py b/addons/purchase_requisition/models/purchase_requisition.py index c752cd9189f..f2cde3cd9fe 100644 --- a/addons/purchase_requisition/models/purchase_requisition.py +++ b/addons/purchase_requisition/models/purchase_requisition.py @@ -257,8 +257,8 @@ class PurchaseOrder(models.Model): self.order_line = order_lines @api.multi - def button_confirm(self): - res = super(PurchaseOrder, self).button_confirm() + def button_approve(self, force=False): + res = super(PurchaseOrder, self).button_approve(force=force) for po in self: if not po.requisition_id: continue