From c2db5515a23688a3bfc17a415814deeca6cebb02 Mon Sep 17 00:00:00 2001 From: hupo-odoo Date: Thu, 23 Mar 2023 15:35:34 +0000 Subject: [PATCH] [FIX] l10n_nl: duplicate tax report Impossible to duplicate the Dutch tax report due to a unique code constraint. I also made sure that this issue does not occur in any other localization. How to reproduce: - Activate debug mode - Configuration>Accounting Reports - Open the form view of the Dutch VAT Report - action>duplicate ==> Validation Error: The operation cannot be completed: A report line with the same code already exists. closes odoo/odoo#124176 Task: 3199129 X-original-commit: affd307665f3e745e9d2a84b3c9ec213370956c3 Signed-off-by: Brice Bartoletti (bib) Signed-off-by: hupo-odoo --- addons/account/models/account_report.py | 4 +++- addons/l10n_nl/data/account_tax_report_data.xml | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_report.py b/addons/account/models/account_report.py index a1931dfd752..33bf1588e37 100644 --- a/addons/account/models/account_report.py +++ b/addons/account/models/account_report.py @@ -296,7 +296,7 @@ class AccountReportLine(models.Model): copied_line = self.copy({ 'report_id': copied_report.id, 'parent_id': parent and parent.id, - 'code': self.code and self._get_copied_code(), + 'code': self._get_copied_code(), }) # Keep track of old_code -> new_code in a mutable dict @@ -327,6 +327,8 @@ class AccountReportLine(models.Model): :return: an unique code for the copied account.report.line ''' self.ensure_one() + if not self.code: + return False code = self.code + '_COPY' while self.search_count([('code', '=', code)]) > 0: code += '_COPY' diff --git a/addons/l10n_nl/data/account_tax_report_data.xml b/addons/l10n_nl/data/account_tax_report_data.xml index d0651c5a193..bce3bdbfef6 100644 --- a/addons/l10n_nl/data/account_tax_report_data.xml +++ b/addons/l10n_nl/data/account_tax_report_data.xml @@ -287,7 +287,6 @@ 5c. Subtotal (heading 5a minus 5b) (VAT) - NLTAX_B1.balance + NLTAX_B2.balance + NLTAX_B4a.balance + NLTAX_B4b.balance - NLTAX_B5b.balance