[FIX] a_tax_balance: use '_for_xml_id' method to get actions

pull/855/head
Sébastien Alix 2022-01-31 10:50:44 +01:00
parent ad1f6c969c
commit 0013001245
2 changed files with 9 additions and 9 deletions

View File

@ -180,11 +180,11 @@ class AccountTax(models.Model):
domain = self.get_move_lines_domain( domain = self.get_move_lines_domain(
tax_or_base=tax_or_base, financial_type=financial_type tax_or_base=tax_or_base, financial_type=financial_type
) )
action = self.env.ref("account.action_account_moves_all_tree") xmlid = "account.action_account_moves_all_tree"
vals = action.sudo().read()[0] action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
vals["context"] = {} action["context"] = {}
vals["domain"] = domain action["domain"] = domain
return vals return action
def view_tax_lines(self): def view_tax_lines(self):
self.ensure_one() self.ensure_one()

View File

@ -40,13 +40,13 @@ class WizardOpenTaxBalances(models.TransientModel):
def open_taxes(self): def open_taxes(self):
self.ensure_one() self.ensure_one()
action = self.env.ref("account_tax_balance.action_tax_balances_tree") xmlid = "account_tax_balance.action_tax_balances_tree"
act_vals = action.sudo().read()[0] action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
# override action name doesn't work in v12 or v10 # override action name doesn't work in v12 or v10
# we need to build a dynamic action on main keys # we need to build a dynamic action on main keys
vals = { vals = {
x: act_vals[x] x: action[x]
for x in act_vals for x in action
if x if x
in ( in (
"res_model", "res_model",