[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
This commit is contained in:
Dylan Kiss (dyki)
2023-10-20 19:12:40 +00:00
committed by Brice bib Bartoletti
parent 4faa1cb9ca
commit 817a194e3e
+1 -1
View File
@@ -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')