From ae229dc2176df56cfcc4dea4152f3bc75e3c9dec Mon Sep 17 00:00:00 2001 From: wan Date: Wed, 3 Jul 2019 12:40:39 +0000 Subject: [PATCH] [FIX] account: action duplicate on wrong model The method action_duplicated method was in account.move.line, but it should have been in account.move instead Also, there was a wrong rebase with f9a0e2b061a3cd90cc0d17bb92aef6ccf2ce75ea closes odoo/odoo#34554 Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/account_move.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 040f2bbeceb..3a98eaecd8c 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2085,6 +2085,18 @@ class AccountMove(models.Model): ]) records.post() + # offer the possibility to duplicate thanks to a button instead of a hidden menu, which is more visible + @api.multi + def action_duplicate(self): + self.ensure_one() + action = self.env.ref('account.action_move_journal_line').read()[0] + action['context'] = dict(self.env.context) + action['context']['form_view_initial_mode'] = 'edit' + action['context']['view_no_maturity'] = False + action['views'] = [(self.env.ref('account.view_move_form').id, 'form')] + action['res_id'] = self.copy().id + return action + class AccountMoveLine(models.Model): _name = "account.move.line" @@ -3531,19 +3543,6 @@ class AccountMoveLine(models.Model): tables, where_clause, where_clause_params = query.get_sql() return tables, where_clause, where_clause_params - # FIXME: Clarify me and change me in master - @api.multi - def action_duplicate(self): - self.ensure_one() - action = self.env.ref('account.action_move_journal_line').read()[0] - action['target'] = 'inline' - action['context'] = dict(self.env.context) - action['context']['form_view_initial_mode'] = 'edit' - action['context']['view_no_maturity'] = False - action['views'] = [(self.env.ref('account.view_move_form').id, 'form')] - action['res_id'] = self.copy().id - return action - @api.multi def open_reconcile_view(self): [action] = self.env.ref('account.action_account_moves_all').read()