From d63c07e15a2441d645aa208f3cfce61790b203af Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 29 Nov 2018 22:39:42 +0100 Subject: [PATCH] Grab improvements from PR #469 (LLN Code sprint) Use OCA module web_widget_many2many_tags_multi_selection: remove inherit of create() in wizards and restore many2many_tags for account and partner filters Better layout of columns in Web/PDF report of trial balance Fix XLSX reports in foreign currency Update string "Account balance at 0 filter" -> "Account at 0 filter" Remove onchange on hide_account_at_0 in trial balance wizard --- account_financial_report_qweb/__manifest__.py | 1 + .../readme/HISTORY.rst | 3 +++ .../report/templates/trial_balance.xml | 6 ++--- .../report/trial_balance_xlsx.py | 14 +++++------ .../wizard/aged_partner_balance_wizard.py | 21 ----------------- .../aged_partner_balance_wizard_view.xml | 13 ++++++----- .../wizard/general_ledger_wizard.py | 21 ----------------- .../wizard/general_ledger_wizard_view.xml | 6 ++--- .../wizard/open_items_wizard.py | 21 ----------------- .../wizard/open_items_wizard_view.xml | 13 ++++++----- .../wizard/trial_balance_wizard.py | 23 ------------------- .../wizard/trial_balance_wizard_view.xml | 8 +++---- 12 files changed, 35 insertions(+), 115 deletions(-) diff --git a/account_financial_report_qweb/__manifest__.py b/account_financial_report_qweb/__manifest__.py index 9f37617d..5bebc5fd 100644 --- a/account_financial_report_qweb/__manifest__.py +++ b/account_financial_report_qweb/__manifest__.py @@ -20,6 +20,7 @@ 'date_range', 'report_xlsx', 'report', + 'web_widget_many2many_tags_multi_selection', ], 'data': [ 'wizard/aged_partner_balance_wizard_view.xml', diff --git a/account_financial_report_qweb/readme/HISTORY.rst b/account_financial_report_qweb/readme/HISTORY.rst index 23e24be8..c353a208 100644 --- a/account_financial_report_qweb/readme/HISTORY.rst +++ b/account_financial_report_qweb/readme/HISTORY.rst @@ -3,4 +3,7 @@ * The Trial Balance now allows to display the hierarchy of accounts * In the Trial Balance you can apply a filter by hierarchy levels +* The Trial Balance shows the unaffected earnings account computed as: + initial balance: sum of past unaffected earnings + P&L result; debit, credit + and period balance: totals only for the unaffected earnings account. * In the Journal Ledger the field 'Journal' is now optional diff --git a/account_financial_report_qweb/report/templates/trial_balance.xml b/account_financial_report_qweb/report/templates/trial_balance.xml index 4f806d92..98fe6230 100644 --- a/account_financial_report_qweb/report/templates/trial_balance.xml +++ b/account_financial_report_qweb/report/templates/trial_balance.xml @@ -108,7 +108,7 @@
Date range filter
Target moves filter
-
Account balance at 0 filter
+
Account at 0 filter
Limit hierarchy levels
@@ -143,12 +143,12 @@
Code
-
Account +
Account
-
Partner +
Partner
diff --git a/account_financial_report_qweb/report/trial_balance_xlsx.py b/account_financial_report_qweb/report/trial_balance_xlsx.py index 2f4e6aa5..83901e8b 100644 --- a/account_financial_report_qweb/report/trial_balance_xlsx.py +++ b/account_financial_report_qweb/report/trial_balance_xlsx.py @@ -46,15 +46,15 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx): } if report.foreign_currency: foreign_currency = { - 6: {'header': _('Cur.'), + 7: {'header': _('Cur.'), 'field': 'currency_id', 'field_currency_balance': 'currency_id', 'type': 'many2one', 'width': 7}, - 7: {'header': _('Initial balance'), + 8: {'header': _('Initial balance'), 'field': 'initial_balance_foreign_currency', 'type': 'amount_currency', 'width': 14}, - 8: {'header': _('Ending balance'), + 9: {'header': _('Ending balance'), 'field': 'final_balance_foreign_currency', 'type': 'amount_currency', 'width': 14}, @@ -87,15 +87,15 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx): } if report.foreign_currency: foreign_currency = { - 5: {'header': _('Cur.'), + 6: {'header': _('Cur.'), 'field': 'currency_id', 'field_currency_balance': 'currency_id', 'type': 'many2one', 'width': 7}, - 6: {'header': _('Initial balance'), + 7: {'header': _('Initial balance'), 'field': 'initial_balance_foreign_currency', 'type': 'amount_currency', 'width': 14}, - 7: {'header': _('Ending balance'), + 8: {'header': _('Ending balance'), 'field': 'final_balance_foreign_currency', 'type': 'amount_currency', 'width': 14}, @@ -110,7 +110,7 @@ class TrialBalanceXslx(abstract_report_xlsx.AbstractReportXslx): [_('Target moves filter'), _('All posted entries') if report.only_posted_moves else _('All entries')], - [_('Account balance at 0 filter'), + [_('Account at 0 filter'), _('Hide') if report.hide_account_at_0 else _('Show')], [_('Show foreign currency'), _('Yes') if report.foreign_currency else _('No')], diff --git a/account_financial_report_qweb/wizard/aged_partner_balance_wizard.py b/account_financial_report_qweb/wizard/aged_partner_balance_wizard.py index 324431d4..665eb3c4 100644 --- a/account_financial_report_qweb/wizard/aged_partner_balance_wizard.py +++ b/account_financial_report_qweb/wizard/aged_partner_balance_wizard.py @@ -53,27 +53,6 @@ class AgedPartnerBalance(models.TransientModel): else: self.account_ids = None - @api.model - def create(self, vals): - """ - This is a workaround for bug https://github.com/odoo/odoo/issues/14761 - This bug impacts M2M fields in wizards filled-up via onchange - It replaces the workaround widget="many2many_tags" on - field name="account_ids" which prevented from selecting several - accounts at the same time (quite useful when you want to select - an interval of accounts for example) - """ - if 'account_ids' in vals and isinstance(vals['account_ids'], list): - account_ids = [] - for account in vals['account_ids']: - if account[0] in (1, 4): - account_ids.append(account[1]) - elif account[0] == 6 and isinstance(account[2], list): - account_ids += account[2] - vals['account_ids'] = [(6, 0, account_ids)] - res = super(AgedPartnerBalance, self).create(vals) - return res - @api.multi def button_export_html(self): self.ensure_one() diff --git a/account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml b/account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml index b2584dcd..a767b256 100644 --- a/account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml +++ b/account_financial_report_qweb/wizard/aged_partner_balance_wizard_view.xml @@ -19,15 +19,16 @@ -
diff --git a/account_financial_report_qweb/wizard/open_items_wizard.py b/account_financial_report_qweb/wizard/open_items_wizard.py index 791bf8d7..5e43f208 100644 --- a/account_financial_report_qweb/wizard/open_items_wizard.py +++ b/account_financial_report_qweb/wizard/open_items_wizard.py @@ -66,27 +66,6 @@ class OpenItemsReportWizard(models.TransientModel): else: self.account_ids = None - @api.model - def create(self, vals): - """ - This is a workaround for bug https://github.com/odoo/odoo/issues/14761 - This bug impacts M2M fields in wizards filled-up via onchange - It replaces the workaround widget="many2many_tags" on - field name="account_ids" which prevented from selecting several - accounts at the same time (quite useful when you want to select - an interval of accounts for example) - """ - if 'account_ids' in vals and isinstance(vals['account_ids'], list): - account_ids = [] - for account in vals['account_ids']: - if account[0] in (1, 4): - account_ids.append(account[1]) - elif account[0] == 6 and isinstance(account[2], list): - account_ids += account[2] - vals['account_ids'] = [(6, 0, account_ids)] - res = super(OpenItemsReportWizard, self).create(vals) - return res - @api.multi def button_export_html(self): self.ensure_one() diff --git a/account_financial_report_qweb/wizard/open_items_wizard_view.xml b/account_financial_report_qweb/wizard/open_items_wizard_view.xml index 0b38103d..3e8c987a 100644 --- a/account_financial_report_qweb/wizard/open_items_wizard_view.xml +++ b/account_financial_report_qweb/wizard/open_items_wizard_view.xml @@ -20,15 +20,16 @@ -