bug PL qt double * fee rate
This commit is contained in:
@@ -638,6 +638,11 @@ class ValuationBase(ModelSQL):
|
||||
budgeted_fees = [f for f in fee_list if f.type == 'budgeted']
|
||||
result.extend(budgeted_fees)
|
||||
return result
|
||||
|
||||
@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)
|
||||
|
||||
@classmethod
|
||||
def create_pnl_fee_from_line(cls, line):
|
||||
@@ -664,7 +669,7 @@ class ValuationBase(ModelSQL):
|
||||
qty = round(lot.get_current_quantity_converted(), 5)
|
||||
if sf.mode == 'ppack' or sf.mode == 'rate':
|
||||
price = sf.price
|
||||
amount = sf.amount * sign
|
||||
amount = cls._fee_amount_or_zero(sf) * sign
|
||||
elif sf.mode == 'lumpsum':
|
||||
price = sf.price
|
||||
amount = sf.price * sign
|
||||
@@ -723,7 +728,7 @@ class ValuationBase(ModelSQL):
|
||||
qty = round(lot.get_current_quantity_converted(), 5)
|
||||
if sf.mode == 'ppack' or sf.mode == 'rate':
|
||||
price = sf.price
|
||||
amount = sf.amount * sign
|
||||
amount = cls._fee_amount_or_zero(sf) * sign
|
||||
elif sf.mode == 'lumpsum':
|
||||
price = sf.price
|
||||
amount = sf.price * sign
|
||||
|
||||
Reference in New Issue
Block a user