-
-
Notifications
You must be signed in to change notification settings - Fork 771
Closed as not planned
Labels
bugstalePR/Issue without recent activity, it'll be soon closed automatically.PR/Issue without recent activity, it'll be soon closed automatically.
Description
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:
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))
)
....
Metadata
Metadata
Assignees
Labels
bugstalePR/Issue without recent activity, it'll be soon closed automatically.PR/Issue without recent activity, it'll be soon closed automatically.