From 00f174fb26338ccee8897fe850f9709d0dd29d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nshimiyimana=20S=C3=A9na?= Date: Wed, 9 Aug 2023 08:21:10 +0000 Subject: [PATCH] [FIX] l10n_de: allow tax other than account's default on line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce ------------------ * install l10n_de * switch to a german company * create an invoice * add a line such that the account's default tax is different from the tax set on the line (ex, account: `8400 Erlöse 19% USt` and tax: `7% Umsatzsteuer`) Attempt to confirm the invoice, you should see that you can't. The system requires the account's default tax to be the same as the tax set on the line. This should not be the case. It's a practice in Germany to link a tax to an account like this, but it's not a legal requirement. opw-3324323 closes odoo/odoo#131779 X-original-commit: 4de4a099296be150a8e75ffdbf1321cdee75137c Signed-off-by: Séna Serge Nshimiyimana (sesn) Signed-off-by: Habib Ayob (ayh) --- addons/l10n_de/models/datev.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) 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"