From 6b841db4ce022c45ea544dc77c2373bf316bd7ae Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Mon, 23 Mar 2026 17:09:11 +0100 Subject: [PATCH] 23.03.26 --- modules/purchase_trade/valuation.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/purchase_trade/valuation.py b/modules/purchase_trade/valuation.py index 4a9ffc3..02d6f26 100644 --- a/modules/purchase_trade/valuation.py +++ b/modules/purchase_trade/valuation.py @@ -84,9 +84,15 @@ class ValuationBase(ModelSQL): qty = lot.get_current_quantity_converted() + price = pc.price + if line.terms: + c = [t for t in line.terms if t.component == pc.id] + if c: + price = c[0].manual_price + values.update({ 'reference': f"{pc.get_name()} / {pc.ratio}%", - 'price': round(pc.price, 4), + 'price': round(price, 4), 'counterparty': sale_line.sale.party.id if sale_line else line.purchase.party.id, 'product': sale_line.product.id if sale_line else line.product.id, }) @@ -101,7 +107,7 @@ class ValuationBase(ModelSQL): values['state'] = f"part. fixed {round(pc.fixed_qt / Decimal(base) * 100, 0)}%" if pc.price and pc.ratio: - amount = round(pc.price * qty * Decimal(sign) * pc.ratio / 100, 2) + amount = round(price * qty * Decimal(sign) * pc.ratio / 100, 2) base_amount = amount currency = sale_line.sale.currency.id if sale_line else line.purchase.currency.id rate = Decimal(1)