From 0013001245e9fa58af063aba3884eab52de33ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alix?= Date: Mon, 31 Jan 2022 10:50:44 +0100 Subject: [PATCH] [FIX] a_tax_balance: use '_for_xml_id' method to get actions --- account_tax_balance/models/account_tax.py | 10 +++++----- account_tax_balance/wizard/open_tax_balances.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index 76597d03..1d2460eb 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -180,11 +180,11 @@ class AccountTax(models.Model): domain = self.get_move_lines_domain( tax_or_base=tax_or_base, financial_type=financial_type ) - action = self.env.ref("account.action_account_moves_all_tree") - vals = action.sudo().read()[0] - vals["context"] = {} - vals["domain"] = domain - return vals + xmlid = "account.action_account_moves_all_tree" + action = self.env["ir.actions.act_window"]._for_xml_id(xmlid) + action["context"] = {} + action["domain"] = domain + return action def view_tax_lines(self): self.ensure_one() diff --git a/account_tax_balance/wizard/open_tax_balances.py b/account_tax_balance/wizard/open_tax_balances.py index a878959a..dbe54d36 100644 --- a/account_tax_balance/wizard/open_tax_balances.py +++ b/account_tax_balance/wizard/open_tax_balances.py @@ -40,13 +40,13 @@ class WizardOpenTaxBalances(models.TransientModel): def open_taxes(self): self.ensure_one() - action = self.env.ref("account_tax_balance.action_tax_balances_tree") - act_vals = action.sudo().read()[0] + xmlid = "account_tax_balance.action_tax_balances_tree" + action = self.env["ir.actions.act_window"]._for_xml_id(xmlid) # override action name doesn't work in v12 or v10 # we need to build a dynamic action on main keys vals = { - x: act_vals[x] - for x in act_vals + x: action[x] + for x in action if x in ( "res_model",