From 3973f766cce47488c7972e145e2ea565b3dc1ca4 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Wed, 21 Apr 2021 13:00:01 +0000 Subject: [PATCH] [IMP] account_reports: carryover improvements Implements various small improvements in order to make the carryover functionality a bit less hidden, with a cleaner UX. Task id #2500684 closes odoo/odoo#69762 Related: odoo/enterprise#17908 Signed-off-by: oco-odoo --- addons/account/models/account_tax_report.py | 21 +++++++++- .../views/account_tax_report_views.xml | 38 +++++++++++++++---- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/addons/account/models/account_tax_report.py b/addons/account/models/account_tax_report.py index e7b34becc05..15b78f8c299 100644 --- a/addons/account/models/account_tax_report.py +++ b/addons/account/models/account_tax_report.py @@ -120,11 +120,11 @@ class AccountTaxReportLine(models.Model): # The selection should be filled in localizations using the system carry_over_condition_method = fields.Selection( selection=[('no_negative_amount_carry_over_condition', 'No negative amount')], - string="Carry over method", + string="Carryover method", help="The method used to determine if this line should be carried over." ) carry_over_destination_line_id = fields.Many2one( - string="Carry over to", + string="Carryover to", comodel_name="account.tax.report.line", domain=[('tag_name', '!=', False)], help="The line to which the value of this line will be carried over to if needed." @@ -287,6 +287,23 @@ class AccountTaxReportLine(models.Model): if neg_tags.name != '-'+record.tag_name or pos_tags.name != '+'+record.tag_name: raise ValidationError(_("The tags linked to a tax report line should always match its tag name.")) + def action_view_carryover_lines(self): + ''' Action when clicking on the "View carryover lines" in the carryover info popup. + + :return: An action showing the account.tax.carryover.lines for the current tax report line. + ''' + self.ensure_one() + return { + 'type': 'ir.actions.act_window', + 'name': _('Carryover Lines For %s', self.name), + 'res_model': 'account.tax.carryover.line', + 'view_type': 'list', + 'view_mode': 'list', + 'views': [[self.env.ref('account.account_tax_carryover_line_tree').id, 'list'], + [False, 'form']], + 'domain': [('id', 'in', self.carryover_line_ids.ids)], + } + def _get_carryover_bounds(self, options, line_amount, carried_over_amount): """ Check if the line will be carried over, by checking the condition method set on the line. diff --git a/addons/account/views/account_tax_report_views.xml b/addons/account/views/account_tax_report_views.xml index 9e31fb76e81..066cccacda1 100644 --- a/addons/account/views/account_tax_report_views.xml +++ b/addons/account/views/account_tax_report_views.xml @@ -64,30 +64,54 @@ + + account.tax.carryover.line.form + account.tax.carryover.line + +
+ + + + + + + + + + + + + + + +
+
+
+ account.tax.report.line.form account.tax.report.line
+ + + - + - + - - - - + @@ -97,7 +121,7 @@ - +