reports: Balance cells try to retain currency on zero balance.
This commit is contained in:
parent
daf7e12752
commit
0f7a154ff4
2 changed files with 5 additions and 3 deletions
|
@ -923,9 +923,11 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
|
|||
return row
|
||||
|
||||
def balance_cell(self, balance: Balance, **attrs: Any) -> odf.table.TableCell:
|
||||
if balance.is_zero():
|
||||
balance = balance.clean_copy() or balance
|
||||
balance_currency_count = len(balance)
|
||||
if balance_currency_count == 0:
|
||||
return self.float_cell(0, **attrs)
|
||||
elif len(balance) == 1:
|
||||
elif balance_currency_count == 1:
|
||||
amount = next(iter(balance.values()))
|
||||
attrs['stylename'] = self.merge_styles(
|
||||
attrs.get('stylename'), self.currency_style(amount.currency),
|
||||
|
|
|
@ -128,7 +128,7 @@ class ExpectedPostings(core.RelatedPostings):
|
|||
assert next(cells).value == norm_func(expected.at_cost().number)
|
||||
closing_row = testutil.ODSCell.from_row(next(rows))
|
||||
assert closing_row[0].value == end_date
|
||||
assert closing_row[4].text == closing_bal.format(None, empty='0', sep='\0')
|
||||
assert closing_row[4].text == closing_bal.format(None, empty='$0.00', sep='\0')
|
||||
|
||||
|
||||
def get_sheet_names(ods):
|
||||
|
|
Loading…
Reference in a new issue