You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The _test_invoice_line_tax method does not exclude rounding lines when checking for missing taxes on invoice lines. This results in unnecessary errors related to rounding lines.
To Reproduce
Odoo 14
Steps to reproduce the behavior:
Create an invoice with a rounding line.
Ensure the rounding line has no taxes defined.
Validate the invoice.
Expected behavior
The method _test_invoice_line_tax should exclude rounding lines (is_rounding_line is True) when checking for missing taxes on invoice lines. Only relevant invoice lines should be checked, preventing unnecessary errors related to rounding lines.
This is the suggested fix:
from odoo import api, models, _
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = "account.move"
def _test_invoice_line_tax(self):
errors = []
error_template = _("Invoice has a line with product %s with no taxes")
for invoice_line in self.mapped("invoice_line_ids").filtered(
lambda x: x.display_type is False and not x.is_rounding_line
):
if not invoice_line.tax_ids:
error_string = error_template % (invoice_line.name)
errors.append(error_string)
if errors:
raise UserError(
_("%s\n%s") % (_("No Taxes Defined!"), "\n".join(errors))
)
....
The text was updated successfully, but these errors were encountered:
Module
account_tax_invoice_required
Describe the bug
The _test_invoice_line_tax method does not exclude rounding lines when checking for missing taxes on invoice lines. This results in unnecessary errors related to rounding lines.
To Reproduce
Odoo 14
Steps to reproduce the behavior:
Create an invoice with a rounding line.
Ensure the rounding line has no taxes defined.
Validate the invoice.
Expected behavior
The method _test_invoice_line_tax should exclude rounding lines (is_rounding_line is True) when checking for missing taxes on invoice lines. Only relevant invoice lines should be checked, preventing unnecessary errors related to rounding lines.
This is the suggested fix:
The text was updated successfully, but these errors were encountered: