From 22da6af92e104667cf73c265394f81c977396363 Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Fri, 2 Jul 2021 10:40:30 +0200 Subject: [PATCH] [FIX] l10n_it_withholding_tax: fix for #2345 --- l10n_it_withholding_tax/models/withholding_tax.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/l10n_it_withholding_tax/models/withholding_tax.py b/l10n_it_withholding_tax/models/withholding_tax.py index cfeaf97bf355..7ebe7f8b3ac9 100644 --- a/l10n_it_withholding_tax/models/withholding_tax.py +++ b/l10n_it_withholding_tax/models/withholding_tax.py @@ -36,7 +36,9 @@ def _compute_get_rate(self): wt.base = rate[1] def _default_wt_journal(self): - misc_journal = self.env["account.journal"].search([("code", "=", _("MISC"))]) + misc_journal = self.env["account.journal"].search( + [("code", "=", _("MISC")), ("company_id", "=", self.env.company.id)] + ) if misc_journal: return misc_journal[0].id return False @@ -105,7 +107,7 @@ def compute_tax(self, amount): if self.env.context.get("currency_id"): currency = self.env["res.currency"].browse(self.env.context["currency_id"]) else: - currency = self.env.user.company_id.currency_id + currency = self.env.company.currency_id prec = currency.decimal_places base = round(amount * self.base, prec) tax = round(base * ((self.tax or 0.0) / 100.0), prec)