This commit is contained in:
2026-02-14 20:59:35 +01:00
parent 6f4649c778
commit e040a4fc11

View File

@@ -293,16 +293,20 @@ class ValuationBase(ModelSQL):
fees = [e.fee for e in fl] fees = [e.fee for e in fl]
for sf in cls.group_fees_by_type_supplier(line, fees): for sf in cls.group_fees_by_type_supplier(line, fees):
sign = -1 if sf.p_r == 'pay' else 1 sign = -1 if sf.p_r == 'pay' else 1
qty = round(lot.get_current_quantity_converted(), 5)
if sf.mode == 'ppack': if sf.mode == 'ppack':
price = sf.price price = sf.price
amount = sf.amount amount = sf.amount
elif sf.mode == 'lumpsum':
price = sf.price
amount = sf.price
qty = 1
else: else:
price = Decimal(sf.get_price_per_qt()) price = Decimal(sf.get_price_per_qt())
amount = round(price * lot.get_current_quantity_converted() * sign, 2) amount = round(price * lot.get_current_quantity_converted() * sign, 2)
if sf.currency != line.purchase.currency: if sf.currency != line.purchase.currency:
with Transaction().set_context(date=Date.today()): with Transaction().set_context(date=Date.today()):
price = Currency.compute(sf.currency, price, line.purchase.currency) price = Currency.compute(sf.currency, price, line.purchase.currency)
qty = round(lot.get_current_quantity_converted(), 5)
if line.mtm: if line.mtm:
for strat in line.mtm: for strat in line.mtm:
fee_lines.append({ fee_lines.append({