Changeset - 0f7a154ff4eb
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-06-18 14:07:10
brettcsmith@brettcsmith.org
reports: Balance cells try to retain currency on zero balance.
2 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/core.py
Show inline comments
...
 
@@ -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),
tests/test_reports_ledger.py
Show inline comments
...
 
@@ -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):
0 comments (0 inline, 0 general)