diff --git a/addons/l10n_de/models/datev.py b/addons/l10n_de/models/datev.py index 0554ed8df06..3c5757c6ab0 100644 --- a/addons/l10n_de/models/datev.py +++ b/addons/l10n_de/models/datev.py @@ -1,6 +1,4 @@ -from odoo import api, fields, models -from odoo.exceptions import UserError -from odoo.tools.translate import _ +from odoo import fields, models class AccountTax(models.Model): @@ -9,23 +7,6 @@ class AccountTax(models.Model): l10n_de_datev_code = fields.Char(size=4, help="4 digits code use by Datev") -class AccountMove(models.Model): - _inherit = 'account.move' - - def _post(self, soft=True): - # OVERRIDE to check the invoice lines taxes. - for invoice in self.filtered(lambda move: move.is_invoice()): - for line in invoice.invoice_line_ids: - account_tax = line.account_id.tax_ids.ids - if account_tax and invoice.company_id.account_fiscal_country_id.code == 'DE': - account_name = line.account_id.name - for tax in line.tax_ids: - if tax.id not in account_tax: - raise UserError(_('Account %s does not authorize to have tax %s specified on the line. \ - Change the tax used in this invoice or remove all taxes from the account') % (account_name, tax.name)) - return super()._post(soft) - - class ProductTemplate(models.Model): _inherit = "product.template"