From 8d305722e125402a55fb6faa5eb0481abf3c00b0 Mon Sep 17 00:00:00 2001 From: Saran440 Date: Wed, 22 Jan 2020 10:43:25 +0700 Subject: [PATCH] [12.0][ENH] report_xlsx_helper : dynamic function _write_line --- report_xlsx_helper/readme/CONTRIBUTORS.rst | 1 + report_xlsx_helper/report/report_xlsx_abstract.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/report_xlsx_helper/readme/CONTRIBUTORS.rst b/report_xlsx_helper/readme/CONTRIBUTORS.rst index 044d1a00..67f1fb2e 100644 --- a/report_xlsx_helper/readme/CONTRIBUTORS.rst +++ b/report_xlsx_helper/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Luc De Meyer +* Saran Lim. diff --git a/report_xlsx_helper/report/report_xlsx_abstract.py b/report_xlsx_helper/report/report_xlsx_abstract.py index 7dadc70f..156e5c39 100644 --- a/report_xlsx_helper/report/report_xlsx_abstract.py +++ b/report_xlsx_helper/report/report_xlsx_abstract.py @@ -464,15 +464,16 @@ class ReportXlsxAbstract(models.AbstractModel): return row_pos + 2 def _write_line(self, ws, row_pos, ws_params, col_specs_section=None, - render_space=None, default_format=None): + render_space=None, default_format=None, + col_specs='col_specs', wanted_list='wanted_list'): """ Write a line with all columns included in the 'wanted_list'. Use the entry defined by the col_specs_section. An empty cell will be written if no col_specs_section entry for a column. """ - col_specs = ws_params.get('col_specs') - wl = ws_params.get('wanted_list') or [] + col_specs = ws_params.get(col_specs) + wl = ws_params.get(wanted_list) or [] pos = 0 for col in wl: if col not in col_specs: