[FIX] account: tax repart lines should have at least one tax line
Add a check to ensure that the repartition lines have at least one tax line. Reason: the compute_all fonction skips the taxes with no tax lines because it only loops over the tax repartition lines to fill taxes_vals closes odoo/odoo#85943 X-original-commit: 783d604fd66f813b66b0bac769f22c1dc0ed761f Signed-off-by: Laurent Smet <las@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: Julien Van Roy <juvr@odoo.com>
This commit is contained in:
@@ -7032,6 +7032,14 @@ msgid ""
|
||||
"for the base."
|
||||
msgstr ""
|
||||
|
||||
#. module: account
|
||||
#: code:addons/account/models/account_tax.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Invoice and credit note repartition should have at least one tax repartition"
|
||||
" line."
|
||||
msgstr ""
|
||||
|
||||
#. module: account
|
||||
#: code:addons/account/models/account_tax.py:0
|
||||
#, python-format
|
||||
|
||||
@@ -189,6 +189,10 @@ class AccountTax(models.Model):
|
||||
if len(invoice_repartition_line_ids) != len(refund_repartition_line_ids):
|
||||
raise ValidationError(_("Invoice and credit note distribution should have the same number of lines."))
|
||||
|
||||
if not invoice_repartition_line_ids.filtered(lambda x: x.repartition_type == 'tax') or \
|
||||
not refund_repartition_line_ids.filtered(lambda x: x.repartition_type == 'tax'):
|
||||
raise ValidationError(_("Invoice and credit note repartition should have at least one tax repartition line."))
|
||||
|
||||
index = 0
|
||||
while index < len(invoice_repartition_line_ids):
|
||||
inv_rep_ln = invoice_repartition_line_ids[index]
|
||||
|
||||
Reference in New Issue
Block a user