main #7

Merged
admin merged 620 commits from main into dev 2026-03-29 13:03:25 +00:00
Showing only changes of commit 842a2b1da6 - Show all commits

View File

@@ -100,7 +100,7 @@ class ValuationBase(ModelSQL):
values['state'] = f"part. fixed {round(pc.fixed_qt / Decimal(base) * 100, 0)}%" values['state'] = f"part. fixed {round(pc.fixed_qt / Decimal(base) * 100, 0)}%"
if pc.price and pc.ratio: if pc.price and pc.ratio:
amount = round(pc.price * qty * Decimal(sign) * pc.ratio / 100, 4) amount = round(pc.price * qty * Decimal(sign) * pc.ratio / 100, 2)
base_amount = amount base_amount = amount
currency = sale_line.sale.currency.id if sale_line else line.purchase.currency.id currency = sale_line.sale.currency.id if sale_line else line.purchase.currency.id
rate = Decimal(1) rate = Decimal(1)
@@ -109,14 +109,14 @@ class ValuationBase(ModelSQL):
base_amount = Currency.compute(currency,amount, line.purchase.company.currency) base_amount = Currency.compute(currency,amount, line.purchase.company.currency)
rate = round(amount / base_amount,6) rate = round(amount / base_amount,6)
last_price = pc.get_last_price() last_price = pc.get_last_price()
mtm = round(Decimal(last_price) * qty * Decimal(sign), 4) if last_price else Decimal(0) mtm = round(Decimal(last_price) * qty * Decimal(sign), 2) if last_price else Decimal(0)
values.update({ values.update({
'quantity': round(qty, 5), 'quantity': round(qty, 5),
'amount': amount, 'amount': amount,
'base_amount': base_amount, 'base_amount': base_amount,
'rate': rate, 'rate': rate,
'mtm': round(amount - (mtm * pc.ratio / 100), 4), 'mtm': round(amount - (mtm * pc.ratio / 100), 2),
'unit': sale_line.unit.id if sale_line else line.unit.id, 'unit': sale_line.unit.id if sale_line else line.unit.id,
'currency': currency, 'currency': currency,
}) })
@@ -135,7 +135,7 @@ class ValuationBase(ModelSQL):
) )
qty = lot.get_current_quantity_converted() qty = lot.get_current_quantity_converted()
amount = round(price * qty * Decimal(sign), 4) amount = round(price * qty * Decimal(sign), 2)
base_amount = amount base_amount = amount
currency = sale_line.sale.currency.id if sale_line else line.purchase.currency.id currency = sale_line.sale.currency.id if sale_line else line.purchase.currency.id
company_currency = sale_line.sale.company.currency if sale_line else line.purchase.company.currency company_currency = sale_line.sale.company.currency if sale_line else line.purchase.company.currency
@@ -318,8 +318,8 @@ class ValuationBase(ModelSQL):
'product': d.product.id, 'product': d.product.id,
'state': 'fixed', 'state': 'fixed',
'quantity': round(d.quantity, 5), 'quantity': round(d.quantity, 5),
'amount': round(price * d.quantity * Decimal(-1), 4), 'amount': round(price * d.quantity * Decimal(-1), 2),
'mtm': round((price * d.quantity * Decimal(-1)) - (mtm * d.quantity * Decimal(-1)), 4), 'mtm': round((price * d.quantity * Decimal(-1)) - (mtm * d.quantity * Decimal(-1)), 2),
'unit': line.unit.id, 'unit': line.unit.id,
'currency': line.purchase.currency.id, 'currency': line.purchase.currency.id,
}) })