This commit is contained in:
2026-02-05 19:54:14 +01:00
parent 05d5d85bee
commit cd0c068b3f

View File

@@ -260,14 +260,17 @@ class ValuationBase(ModelSQL):
fees = [e.fee for e in fl]
for sf in cls.group_fees_by_type_supplier(line, fees):
price = Decimal(sf.get_price_per_qt())
sign = -1 if sf.p_r == 'pay' else 1
if sf.mode == 'ppack':
price = sf.price
amount = sf.amount
else:
price = Decimal(sf.get_price_per_qt())
amount = round(price * lot.get_current_quantity_converted() * sign, 2)
if sf.currency != line.purchase.currency:
with Transaction().set_context(date=Date.today()):
price = Currency.compute(sf.currency, price, line.purchase.currency)
sign = -1 if sf.p_r == 'pay' else 1
fee_lines.append({
'lot': lot.id,
'sale': lot.sale_line.sale.id if lot.sale_line else None,
@@ -285,7 +288,7 @@ class ValuationBase(ModelSQL):
'product': sf.product.id,
'state': sf.type,
'quantity': round(lot.get_current_quantity_converted(), 5),
'amount': round(price * lot.get_current_quantity_converted() * sign, 2),
'amount': amount,
'mtm': Decimal(0),
'unit': sf.unit.id if sf.unit else line.unit.id,
'currency': sf.currency.id,