diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 97d24fb7048..ebb108a1f95 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3303,25 +3303,33 @@ class AccountMove(models.Model): def open_reconcile_view(self): return self.line_ids.open_reconcile_view() - def open_move(self): + def action_open_business_doc(self): + self.ensure_one() if self.payment_id: - return self.open_payment_view() + name = _("Payment") + res_model = 'account.payment' + res_id = self.payment_id.id + elif self.statement_line_id: + name = _("Bank Transaction") + res_model = 'account.bank.statement.line' + res_id = self.statement_line_id.id else: - return { - 'type': 'ir.actions.act_window', - 'res_model': 'account.move', - 'view_mode': 'form', - 'res_id': self.id, - 'views': [(False, 'form')], - } + name = _("Journal Entry") + res_model = 'account.move' + res_id = self.id - def open_payment_view(self): return { + 'name': name, 'type': 'ir.actions.act_window', - 'res_model': 'account.payment', 'view_mode': 'form', - 'res_id': self.payment_id.id, 'views': [(False, 'form')], + 'res_model': res_model, + 'res_id': res_id, + 'context': { + 'create': False, + 'delete': False, + }, + 'target': 'current', } def open_created_caba_entries(self): diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index ccb2f5bbc2c..43b64363ac3 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -2509,8 +2509,8 @@ class AccountMoveLine(models.Model): action['domain'] = [('id', 'in', ids)] return clean_action(action, self.env) - def open_move(self): - return self.move_id.open_move() + def action_open_business_doc(self): + return self.move_id.action_open_business_doc() def action_automatic_entry(self): action = self.env['ir.actions.act_window']._for_xml_id('account.account_automatic_entry_wizard_action') @@ -2523,36 +2523,6 @@ class AccountMoveLine(models.Model): action['context'] = ctx return action - def action_open_business_doc_from_aml(self): - self.ensure_one() - - if self.payment_id: - name = _("Payment") - res_model = 'account.payment' - res_id = self.payment_id.id - elif self.statement_line_id: - name = _("Bank Transaction") - res_model = 'account.bank.statement.line' - res_id = self.statement_line_id.id - else: - name = _("Journal Entry") - res_model = 'account.move' - res_id = self.move_id.id - - return { - 'name': name, - 'type': 'ir.actions.act_window', - 'view_mode': 'form', - 'view_id': self.env.ref('account.view_move_form').id, - 'res_model': res_model, - 'res_id': res_id, - 'context': { - 'create': False, - 'delete': False, - }, - 'target': 'current', - } - # ------------------------------------------------------------------------- # TOOLING # ------------------------------------------------------------------------- diff --git a/addons/account/static/src/components/account_payment_field/account_payment.xml b/addons/account/static/src/components/account_payment_field/account_payment.xml index 617825b79d2..7b77b08c92e 100644 --- a/addons/account/static/src/components/account_payment_field/account_payment.xml +++ b/addons/account/static/src/components/account_payment_field/account_payment.xml @@ -27,7 +27,7 @@
-