From 49c7ab8277299f7576d3787d534394f78855406f Mon Sep 17 00:00:00 2001 From: Ernad Husremovic Date: Tue, 6 Jan 2026 19:37:33 +0100 Subject: [PATCH] Fix allocation quantity calculation when merging PO lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When multiple PR lines for the same product were merged into a single PO line, the allocation quantity was incorrectly calculated using min(existing_po_qty, pr_line_qty) instead of using the actual PR line quantity. This caused incorrect total quantities in the generated RFQ. Example: PR with sir01 qty=10 and sir01 qty=7 should produce PO line with qty=17, but was producing qty=14. 🤖 assisted by claude --- .../purchase_request/__manifest__.py | 2 +- .../wizard/purchase_request_line_make_purchase_order.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/__manifest__.py b/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/__manifest__.py index ba9ca0b..66143db 100644 --- a/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/__manifest__.py +++ b/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Purchase Request", "author": "ForgeFlow, Odoo Community Association (OCA)", - "version": "16.0.2.4.0", + "version": "16.0.2.4.1", "summary": "Use this module to have notification of requirements of " "materials and/or external services and keep track of such " "requirements.", diff --git a/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/wizard/purchase_request_line_make_purchase_order.py b/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/wizard/purchase_request_line_make_purchase_order.py index 8386e26..c393b9d 100644 --- a/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/wizard/purchase_request_line_make_purchase_order.py +++ b/odoo-bringout-oca-purchase-workflow-purchase_request/purchase_request/wizard/purchase_request_line_make_purchase_order.py @@ -259,13 +259,11 @@ class PurchaseRequestLineMakePurchaseOrder(models.TransientModel): po_line = available_po_lines[0] po_line.purchase_request_lines = [(4, line.id)] po_line.move_dest_ids |= line.move_dest_ids - po_line_product_uom_qty = po_line.product_uom._compute_quantity( - po_line.product_uom_qty, alloc_uom - ) wizard_product_uom_qty = wizard_uom._compute_quantity( item.product_qty, alloc_uom ) - all_qty = min(po_line_product_uom_qty, wizard_product_uom_qty) + # Allocation should be the PR line's requested qty, not min with existing PO line + all_qty = wizard_product_uom_qty self.create_allocation(po_line, line, all_qty, alloc_uom) else: po_line_data = self._prepare_purchase_order_line(purchase, item)