You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SunjiERP/odoo/custom/account/account_ledger/报表打印聚合值小数位数问题说明.md

1.1 KiB

此方法问题

    def _write_group_header(self, row, column, label, group, group_depth=0):
            aggregates = group.aggregated_values

    label = '%s%s (%s)' % ('    ' * group_depth, label, group.count)
    self.write(row, column, label, self.header_bold_style)
    for field in self.fields[1:]: # No aggregates allowed in the first column because of the group title
        column += 1
        aggregated_value = aggregates.get(field['name'])
        # Non-stored float fields may not be displayed properly because of float representation
        # => we force 2 digits
        # if not field.get('store') and isinstance(aggregated_value, float):
        # 上一行为原生此处修改是因为在余额表查询时候发现下载的excel是多位小数这里需要修改如下。
        if isinstance(aggregated_value, float):
            aggregated_value = float_repr(aggregated_value, 2)
        self.write(row, column, str(aggregated_value if aggregated_value is not None else ''), self.header_bold_style)
    return row + 1, 0