From 817a194e3e4eb978a8121fbddf79609bab9876eb Mon Sep 17 00:00:00 2001 From: "Dylan Kiss (dyki)" Date: Fri, 2 Jun 2023 14:10:30 +0200 Subject: [PATCH] [IMP] account: allow identical lines in multiple reports Currently we require the account lines `code` field to be unique across all reports in a database. Since Reportalypse, this is not required anymore, since we search by default only in the current report unless we specify a `cross_report` subformula. Then it will take the first one it finds. In this commit, we relax the condition to have unique `code` fields per report, instead of globally. Furthermore, we add a test utility to check lines with the same code to have the same properties. This is useful for localizations that have multiple versions of the same reports, containing identical lines in multiple report. This way we can ensure they are always calculated the same way across reports. task-3086473 Part-of: odoo/odoo#117480 --- addons/account/models/account_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_report.py b/addons/account/models/account_report.py index 382261f45e5..fa80755a5f3 100644 --- a/addons/account/models/account_report.py +++ b/addons/account/models/account_report.py @@ -312,7 +312,7 @@ class AccountReportLine(models.Model): aggregation_formula = fields.Char(string="Aggregation Formula Shortcut", help="Internal field to shorten expression_ids creation for the aggregation engine", inverse='_inverse_aggregation_formula', store=False) _sql_constraints = [ - ('code_uniq', 'unique (code)', "A report line with the same code already exists."), + ('code_uniq', 'unique (report_id, code)', "A report line with the same code already exists."), ] @api.depends('parent_id.hierarchy_level')