mirror of
https://github.com/bringout/oca-purchase.git
synced 2026-04-18 04:42:04 +02:00
Fix allocation quantity calculation when merging PO lines
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
This commit is contained in:
parent
450e9d9ad4
commit
49c7ab8277
2 changed files with 3 additions and 5 deletions
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue