Skip to content
Snippets Groups Projects
Commit e751d030 authored by Claire Bretton (clbr)'s avatar Claire Bretton (clbr)
Browse files

[FIX] account: relax repartition lines validation when tax has children

If a tax is an aggregation of its sub-taxes it makes sense to have no
repartition line. This PR relaxes the validation in that case.

Part-of: odoo/odoo#113001
parent d2572b73
No related branches found
No related tags found
No related merge requests found
......@@ -132,6 +132,12 @@ class AccountTax(models.Model):
@api.constrains('invoice_repartition_line_ids', 'refund_repartition_line_ids')
def _validate_repartition_lines(self):
for record in self:
# if the tax is an aggregation of its sub-taxes (group) it can have no repartition lines
if record.amount_type == 'group' and \
not record.invoice_repartition_line_ids and \
not record.refund_repartition_line_ids:
continue
invoice_repartition_line_ids = record.invoice_repartition_line_ids.sorted()
refund_repartition_line_ids = record.refund_repartition_line_ids.sorted()
record._check_repartition_lines(invoice_repartition_line_ids)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment