2
0

[14.0][FIX] account_loan, account_loan_line & account_loan_generate_entries: fix read

This commit is contained in:
Núria Sancho 2023-02-07 15:03:13 +01:00 committed by Enric Tobella
parent df43fc0a44
commit 40ef27d26e
3 changed files with 18 additions and 12 deletions

View File

@ -442,15 +442,17 @@ class AccountLoan(models.Model):
def view_account_moves(self): def view_account_moves(self):
self.ensure_one() self.ensure_one()
action = self.env.ref("account.action_move_line_form") result = self.env["ir.actions.act_window"]._for_xml_id(
result = action.read()[0] "account.action_move_line_form"
)
result["domain"] = [("loan_id", "=", self.id)] result["domain"] = [("loan_id", "=", self.id)]
return result return result
def view_account_invoices(self): def view_account_invoices(self):
self.ensure_one() self.ensure_one()
action = self.env.ref("account.action_move_out_invoice_type") result = self.env["ir.actions.act_window"]._for_xml_id(
result = action.read()[0] "account.action_move_out_invoice_type"
)
result["domain"] = [("loan_id", "=", self.id), ("move_type", "=", "in_invoice")] result["domain"] = [("loan_id", "=", self.id), ("move_type", "=", "in_invoice")]
return result return result

View File

@ -412,8 +412,9 @@ class AccountLoanLine(models.Model):
def view_account_moves(self): def view_account_moves(self):
self.ensure_one() self.ensure_one()
action = self.env.ref("account.action_move_line_form") result = self.env["ir.actions.act_window"]._for_xml_id(
result = action.read()[0] "account.action_move_line_form"
)
result["context"] = { result["context"] = {
"default_loan_line_id": self.id, "default_loan_line_id": self.id,
"default_loan_id": self.loan_id.id, "default_loan_id": self.loan_id.id,
@ -427,8 +428,9 @@ class AccountLoanLine(models.Model):
def view_account_invoices(self): def view_account_invoices(self):
self.ensure_one() self.ensure_one()
action = self.env.ref("account.action_move_out_invoice_type") result = self.env["ir.actions.act_window"]._for_xml_id(
result = action.read()[0] "account.action_move_out_invoice_type"
)
result["context"] = { result["context"] = {
"default_loan_line_id": self.id, "default_loan_line_id": self.id,
"default_loan_id": self.loan_id.id, "default_loan_id": self.loan_id.id,

View File

@ -20,8 +20,9 @@ class AccountLoanGenerateWizard(models.TransientModel):
def run_leasing(self): def run_leasing(self):
created_ids = self.env["account.loan"].generate_leasing_entries(self.date) created_ids = self.env["account.loan"].generate_leasing_entries(self.date)
action = self.env.ref("account.action_move_out_invoice_type") result = self.env["ir.actions.act_window"]._for_xml_id(
result = action.read()[0] "account.action_move_out_invoice_type"
)
if len(created_ids) == 0: if len(created_ids) == 0:
return return
result["domain"] = [("id", "in", created_ids), ("type", "=", "in_invoice")] result["domain"] = [("id", "in", created_ids), ("type", "=", "in_invoice")]
@ -29,8 +30,9 @@ class AccountLoanGenerateWizard(models.TransientModel):
def run_loan(self): def run_loan(self):
created_ids = self.env["account.loan"].generate_loan_entries(self.date) created_ids = self.env["account.loan"].generate_loan_entries(self.date)
action = self.env.ref("account.action_move_line_form") result = self.env["ir.actions.act_window"]._for_xml_id(
result = action.read()[0] "account.action_move_line_form"
)
if len(created_ids) == 0: if len(created_ids) == 0:
return return
result["domain"] = [("id", "in", created_ids)] result["domain"] = [("id", "in", created_ids)]