Skip to content
Snippets Groups Projects

Topic/11.0/statement 3570

Merged Houzefa Abbasbhay requested to merge topic/11.0/statement-3570 into branch/11.0
@@ -51,6 +51,8 @@
@@ -51,6 +51,8 @@
self._write_data_header()
self._write_data_header()
self._write_data()
self._write_data()
 
self._write_totals(self._get_totals())
 
def _declare_formats(self):
def _declare_formats(self):
"""Declare cell formats usable by this report."""
"""Declare cell formats usable by this report."""
@@ -131,6 +133,13 @@
@@ -131,6 +133,13 @@
),
),
)
)
 
def _get_totals(self):
 
"""Define totals shown below the table, as a list of
 
(label, value, style) tuples.
 
"""
 
 
return ((_("Total"), self.batch.amount, self.format_amount),)
 
def _read_data(self, record, path, cell_type):
def _read_data(self, record, path, cell_type):
"""Read data from an Odoo record."""
"""Read data from an Odoo record."""
@@ -198,12 +207,6 @@
@@ -198,12 +207,6 @@
width=14,
width=14,
type="amount",
type="amount",
)
)
addCol(
header=_("Total"),
field="reporting_balance",
width=14,
type="amount",
)
def _write_data_header(self):
def _write_data_header(self):
"""Write 1 row with titles of columns set in self._set_columns."""
"""Write 1 row with titles of columns set in self._set_columns."""
@@ -303,3 +306,20 @@
@@ -303,3 +306,20 @@
)
)
self.row_pos += 1
self.row_pos += 1
self.row_pos += 2
self.row_pos += 2
 
 
def _write_totals(self, totals):
 
"""Write 1 row per total, starting with the current row."""
 
 
col_name = 0
 
col_value = col_name + len(self.colspecs) - 1
 
for label, value, style in totals:
 
self.sheet.merge_range(
 
self.row_pos,
 
col_name,
 
self.row_pos,
 
col_name + len(self.colspecs) - 2,
 
label,
 
self.format_header_left,
 
)
 
self.sheet.write(self.row_pos, col_value, value, style)
 
self.row_pos += 1
Loading