From c18e0db6db8d85ccb6d6e6fcfa7ef244e071317a Mon Sep 17 00:00:00 2001 From: Alex Cuellar Date: Sun, 11 Oct 2020 11:55:20 -0500 Subject: [PATCH] [IMP] account_financial_report: black, isort, prettier --- .../report/abstract_report_xlsx.py | 65 ++++---- .../report/aged_partner_balance_xlsx.py | 6 +- .../report/general_ledger.py | 8 +- .../report/general_ledger_xlsx.py | 18 ++- .../report/templates/aged_partner_balance.xml | 140 ++++++++++-------- .../report/templates/general_ledger.xml | 74 ++++----- .../report/templates/journal_ledger.xml | 62 ++++---- .../report/templates/open_items.xml | 65 ++++---- .../report/templates/trial_balance.xml | 65 ++++---- .../report/templates/vat_report.xml | 16 +- account_financial_report/report/vat_report.py | 6 +- .../js/account_financial_report_backend.js | 30 ++-- .../js/account_financial_report_widgets.js | 18 +-- .../view/report_template.xml | 14 +- .../aged_partner_balance_wizard_view.xml | 4 +- .../wizard/general_ledger_wizard.py | 14 +- .../wizard/general_ledger_wizard_view.xml | 15 +- .../wizard/open_items_wizard.py | 5 +- .../wizard/open_items_wizard_view.xml | 4 +- .../wizard/trial_balance_wizard_view.xml | 6 +- .../odoo/addons/account_financial_report | 1 + setup/account_financial_report/setup.py | 6 + 22 files changed, 352 insertions(+), 290 deletions(-) create mode 120000 setup/account_financial_report/odoo/addons/account_financial_report create mode 100644 setup/account_financial_report/setup.py diff --git a/account_financial_report/report/abstract_report_xlsx.py b/account_financial_report/report/abstract_report_xlsx.py index 984b659ccb89..842f9a497fa5 100644 --- a/account_financial_report/report/abstract_report_xlsx.py +++ b/account_financial_report/report/abstract_report_xlsx.py @@ -59,7 +59,7 @@ def generate_xlsx_report(self, workbook, data, objects): self._write_report_footer(report_footer) def _define_formats(self, workbook): - """ Add cell formats to current workbook. + """Add cell formats to current workbook. Those formats can be used on all cell. Available formats are : * format_bold @@ -237,8 +237,7 @@ def write_line(self, line_object): self.row_pos += 1 def write_line_from_dict(self, line_dict): - """Write a line on current line - """ + """Write a line on current line""" for col_pos, column in self.columns.items(): value = line_dict.get(column["field"], False) cell_type = column.get("type", "string") @@ -528,7 +527,7 @@ def _get_currency_amt_header_format_dict(self, line_object): def _generate_report_content(self, workbook, report, data): """ - Allow to fetch report content to be displayed. + Allow to fetch report content to be displayed. """ raise NotImplementedError() @@ -542,74 +541,74 @@ def _get_report_complete_name(self, report, prefix, data=None): def _get_report_name(self, report, data=False): """ - Allow to define the report name. - Report name will be used as sheet name and as report title. - :return: the report name + Allow to define the report name. + Report name will be used as sheet name and as report title. + :return: the report name """ raise NotImplementedError() def _get_report_footer(self): """ - Allow to define the report footer. - :return: the report footer + Allow to define the report footer. + :return: the report footer """ return False def _get_report_columns(self, report): """ - Allow to define the report columns - which will be used to generate report. - :return: the report columns as dict - :Example: - { - 0: {'header': 'Simple column', - 'field': 'field_name_on_my_object', - 'width': 11}, - 1: {'header': 'Amount column', - 'field': 'field_name_on_my_object', - 'type': 'amount', - 'width': 14}, - } + Allow to define the report columns + which will be used to generate report. + :return: the report columns as dict + :Example: + { + 0: {'header': 'Simple column', + 'field': 'field_name_on_my_object', + 'width': 11}, + 1: {'header': 'Amount column', + 'field': 'field_name_on_my_object', + 'type': 'amount', + 'width': 14}, + } """ raise NotImplementedError() def _get_report_filters(self, report): """ - :return: the report filters as list - :Example: - [ - ['first_filter_name', 'first_filter_value'], - ['second_filter_name', 'second_filter_value'] - ] + :return: the report filters as list + :Example: + [ + ['first_filter_name', 'first_filter_value'], + ['second_filter_name', 'second_filter_value'] + ] """ raise NotImplementedError() def _get_col_count_filter_name(self): """ - :return: the columns number used for filter names. + :return: the columns number used for filter names. """ raise NotImplementedError() def _get_col_count_filter_value(self): """ - :return: the columns number used for filter values. + :return: the columns number used for filter values. """ raise NotImplementedError() def _get_col_pos_initial_balance_label(self): """ - :return: the columns position used for initial balance label. + :return: the columns position used for initial balance label. """ raise NotImplementedError() def _get_col_count_final_balance_name(self): """ - :return: the columns number used for final balance name. + :return: the columns number used for final balance name. """ raise NotImplementedError() def _get_col_pos_final_balance_label(self): """ - :return: the columns position used for final balance label. + :return: the columns position used for final balance label. """ raise NotImplementedError() diff --git a/account_financial_report/report/aged_partner_balance_xlsx.py b/account_financial_report/report/aged_partner_balance_xlsx.py index aea918a9ca82..fc25b61dced9 100644 --- a/account_financial_report/report/aged_partner_balance_xlsx.py +++ b/account_financial_report/report/aged_partner_balance_xlsx.py @@ -268,8 +268,8 @@ def _generate_report_content(self, workbook, report, data): def write_ending_balance_from_dict(self, my_object): """ - Specific function to write ending partner balance - for Aged Partner Balance + Specific function to write ending partner balance + for Aged Partner Balance """ name = None label = _("Partner cumul aged balance") @@ -288,7 +288,7 @@ def write_account_footer_from_dict( amount_is_percent, ): """ - Specific function to write account footer for Aged Partner Balance + Specific function to write account footer for Aged Partner Balance """ col_pos_footer_label = self._get_col_pos_footer_label(report) for col_pos, column in self.columns.items(): diff --git a/account_financial_report/report/general_ledger.py b/account_financial_report/report/general_ledger.py index e8951ae7dcd3..91fd379f0f9e 100644 --- a/account_financial_report/report/general_ledger.py +++ b/account_financial_report/report/general_ledger.py @@ -748,12 +748,16 @@ def _get_centralized_ml(self, account, date_to): for partner in account["list_partner"]: for move_line in partner["move_lines"]: centralized_ml = self._calculate_centralization( - centralized_ml, move_line, date_to, + centralized_ml, + move_line, + date_to, ) else: for move_line in account["move_lines"]: centralized_ml = self._calculate_centralization( - centralized_ml, move_line, date_to, + centralized_ml, + move_line, + date_to, ) list_centralized_ml = [] for jnl_id in centralized_ml.keys(): diff --git a/account_financial_report/report/general_ledger_xlsx.py b/account_financial_report/report/general_ledger_xlsx.py index 4c32d3b12d78..c57c24d386bf 100644 --- a/account_financial_report/report/general_ledger_xlsx.py +++ b/account_financial_report/report/general_ledger_xlsx.py @@ -195,7 +195,10 @@ def _generate_report_content(self, workbook, report, data): for tag_id in line["tag_ids"]: tags += tags_data[tag_id]["name"] + " " line.update( - {"taxes_description": taxes_description, "tags": tags,} + { + "taxes_description": taxes_description, + "tags": tags, + } ) self.write_line_from_dict(line) # Display ending balance line for account @@ -208,7 +211,9 @@ def _generate_report_content(self, workbook, report, data): ) if foreign_currency: account.update( - {"final_bal_curr": account["fin_bal"]["bal_curr"],} + { + "final_bal_curr": account["fin_bal"]["bal_curr"], + } ) self.write_ending_balance_from_dict(account) @@ -234,7 +239,9 @@ def _generate_report_content(self, workbook, report, data): ) if foreign_currency: partner.update( - {"initial_bal_curr": partner["init_bal"]["bal_curr"],} + { + "initial_bal_curr": partner["init_bal"]["bal_curr"], + } ) self.write_initial_balance_from_dict(partner) @@ -263,7 +270,10 @@ def _generate_report_content(self, workbook, report, data): for tag_id in line["tag_ids"]: tags += tags_data[tag_id]["name"] + " " line.update( - {"taxes_description": taxes_description, "tags": tags,} + { + "taxes_description": taxes_description, + "tags": tags, + } ) self.write_line_from_dict(line) diff --git a/account_financial_report/report/templates/aged_partner_balance.xml b/account_financial_report/report/templates/aged_partner_balance.xml index e5f4a8d1a0f8..9b8e0b7bc05b 100644 --- a/account_financial_report/report/templates/aged_partner_balance.xml +++ b/account_financial_report/report/templates/aged_partner_balance.xml @@ -15,9 +15,12 @@ - Aged Partner Balance - - + + Aged Partner Balance - + + - + +

91 - 120 d.
-
> 120 d.
+
> 120 d.

@@ -191,7 +194,8 @@
- Date
+ Date +
Entry
@@ -199,31 +203,41 @@
Account
-
Partner -
+
Partner
-
Ref - - Label
+
+ Ref - + Label +
-
Due - date
- -
Residual +
+ Due + date
+ +
Residual
Current
-
Age ≤ 30 - d.
+
+ Age ≤ 30 + d. +
-
Age ≤ 60 - d.
+
+ Age ≤ 60 + d. +
-
Age ≤ 90 - d.
+
+ Age ≤ 90 + d. +
-
Age ≤ 120 - d.
+
+ Age ≤ 120 + d. +
Older
@@ -448,8 +462,10 @@
-
Partner - cumul aged balance
+
+ Partner + cumul aged balance +
@@ -620,78 +636,76 @@
-
- Percents
+
Percents
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
- Percents
+
Percents
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
-
% +
+ + %
diff --git a/account_financial_report/report/templates/general_ledger.xml b/account_financial_report/report/templates/general_ledger.xml index 5498839ef56a..5405383d6e24 100644 --- a/account_financial_report/report/templates/general_ledger.xml +++ b/account_financial_report/report/templates/general_ledger.xml @@ -14,9 +14,12 @@ - General Ledger - - + + General Ledger - + + - + +
- From: To: + From: + + To: +
All posted entries @@ -143,7 +150,8 @@
- Date
+ Date +
Entry
@@ -153,17 +161,17 @@
Taxes
-
Partner -
+
Partner
-
Ref - - Label
+
+ Ref - + Label +
-
Analytic Account
+
+ Analytic Account +
@@ -176,18 +184,16 @@
Credit
-
Cumul. Bal.
+
+ Cumul. Bal. +
Cur.
-
Amount cur.
+
+ Amount cur. +
@@ -724,22 +730,24 @@
-
+ - + - +
-
Ending balance
+ /> +
+
+ Ending balance +
-
Partner ending balance
+
+ Partner ending balance +
diff --git a/account_financial_report/report/templates/journal_ledger.xml b/account_financial_report/report/templates/journal_ledger.xml index 7fa13ec42016..0c0e66773547 100644 --- a/account_financial_report/report/templates/journal_ledger.xml +++ b/account_financial_report/report/templates/journal_ledger.xml @@ -14,9 +14,12 @@