fix: evaluation cashbook-currentvalue/diff return 'balance' on non-asset-cashbooks
This commit is contained in:
parent
ddb9bf732c
commit
d01bd0dc0a
2 changed files with 16 additions and 1 deletions
|
@ -119,6 +119,8 @@ class InvestmentLine(metaclass=PoolMeta):
|
||||||
return self.convert_to_evalcurrency(
|
return self.convert_to_evalcurrency(
|
||||||
self.cashbook.currency,
|
self.cashbook.currency,
|
||||||
self.cashbook.diff_amount)
|
self.cashbook.diff_amount)
|
||||||
|
else :
|
||||||
|
return Decimal('0.0')
|
||||||
|
|
||||||
def get_value_cashbooks_glvalue(self):
|
def get_value_cashbooks_glvalue(self):
|
||||||
""" current value of cashbooks
|
""" current value of cashbooks
|
||||||
|
@ -130,6 +132,10 @@ class InvestmentLine(metaclass=PoolMeta):
|
||||||
return self.convert_to_evalcurrency(
|
return self.convert_to_evalcurrency(
|
||||||
self.cashbook.currency,
|
self.cashbook.currency,
|
||||||
self.cashbook.current_value)
|
self.cashbook.current_value)
|
||||||
|
else :
|
||||||
|
return self.convert_to_evalcurrency(
|
||||||
|
self.cashbook.currency,
|
||||||
|
self.cashbook.balance_ref)
|
||||||
|
|
||||||
def get_value_cashbooks_glperc(self):
|
def get_value_cashbooks_glperc(self):
|
||||||
""" percent of profit/loss of cashbooks
|
""" percent of profit/loss of cashbooks
|
||||||
|
@ -137,5 +143,7 @@ class InvestmentLine(metaclass=PoolMeta):
|
||||||
if self.cashbook:
|
if self.cashbook:
|
||||||
if self.cashbook.feature == 'asset':
|
if self.cashbook.feature == 'asset':
|
||||||
return self.cashbook.diff_percent
|
return self.cashbook.diff_percent
|
||||||
|
else :
|
||||||
|
return Decimal('0.0')
|
||||||
|
|
||||||
# end InvestmentLine
|
# end InvestmentLine
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import ModuleTestCase, with_transaction, activate_module
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
|
@ -16,6 +16,13 @@ class ReportTestCase(CashbookTestCase):
|
||||||
'Test cashbook book report module'
|
'Test cashbook book report module'
|
||||||
module = 'cashbook_report'
|
module = 'cashbook_report'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
""" add modelues
|
||||||
|
"""
|
||||||
|
super(ReportTestCase, cls).setUpClass()
|
||||||
|
activate_module(['dashboard', 'cashbook_investment'])
|
||||||
|
|
||||||
def prep_report_3books(self):
|
def prep_report_3books(self):
|
||||||
""" create 3x cashbooks, add bookings,
|
""" create 3x cashbooks, add bookings,
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue