05.02.26
This commit is contained in:
@@ -260,14 +260,17 @@ 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
|
||||||
price = Decimal(sf.get_price_per_qt())
|
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:
|
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)
|
||||||
|
|
||||||
sign = -1 if sf.p_r == 'pay' else 1
|
|
||||||
|
|
||||||
fee_lines.append({
|
fee_lines.append({
|
||||||
'lot': lot.id,
|
'lot': lot.id,
|
||||||
'sale': lot.sale_line.sale.id if lot.sale_line else None,
|
'sale': lot.sale_line.sale.id if lot.sale_line else None,
|
||||||
@@ -285,7 +288,7 @@ class ValuationBase(ModelSQL):
|
|||||||
'product': sf.product.id,
|
'product': sf.product.id,
|
||||||
'state': sf.type,
|
'state': sf.type,
|
||||||
'quantity': round(lot.get_current_quantity_converted(), 5),
|
'quantity': round(lot.get_current_quantity_converted(), 5),
|
||||||
'amount': round(price * lot.get_current_quantity_converted() * sign, 2),
|
'amount': amount,
|
||||||
'mtm': Decimal(0),
|
'mtm': Decimal(0),
|
||||||
'unit': sf.unit.id if sf.unit else line.unit.id,
|
'unit': sf.unit.id if sf.unit else line.unit.id,
|
||||||
'currency': sf.currency.id,
|
'currency': sf.currency.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user