Delta neg
This commit is contained in:
@@ -811,15 +811,15 @@ class ValuationBase(ModelSQL):
|
||||
@classmethod
|
||||
def _fee_amount_or_zero(cls, fee):
|
||||
amount = fee.get_amount() if hasattr(fee, 'get_amount') else fee.amount
|
||||
return Decimal(amount or 0)
|
||||
return abs(Decimal(amount or 0))
|
||||
|
||||
@classmethod
|
||||
def _fee_amount_for_lot_or_zero(cls, fee, lot):
|
||||
if fee.mode == 'ppack' and getattr(lot, 'lot_qt', None):
|
||||
return round(
|
||||
return abs(round(
|
||||
Decimal(fee.price or 0)
|
||||
* Decimal(str(lot.lot_qt or 0)),
|
||||
2)
|
||||
2))
|
||||
if fee.mode == 'rate':
|
||||
line = fee.line or getattr(fee, 'sale_line', None)
|
||||
if line and line.estimated_date:
|
||||
@@ -833,9 +833,9 @@ class ValuationBase(ModelSQL):
|
||||
* Decimal(est_line.fin_int_delta) / Decimal(360))
|
||||
quantity = Decimal(
|
||||
lot.get_current_quantity_converted(0, fee.unit) or 0)
|
||||
return round(
|
||||
return abs(round(
|
||||
factor * Decimal(line.unit_price or 0) * quantity,
|
||||
2)
|
||||
2))
|
||||
return Decimal(0)
|
||||
return cls._fee_amount_or_zero(fee)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user