diff options
| author | wan <wan@odoo.com> | 2019-07-03 12:40:39 +0000 |
|---|---|---|
| committer | wan <wan@odoo.com> | 2019-07-04 11:37:28 +0000 |
| commit | ae229dc2176df56cfcc4dea4152f3bc75e3c9dec (patch) | |
| tree | ea6c207940b8fb98c5918c6a1411d3e9e0be125e | |
| parent | e54cccb8dd521be310999d3e3a612bc9cc935a0f (diff) | |
[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) <qdp@openerp.com>
| -rw-r--r-- | addons/account/models/account_move.py | 25 |
1 files 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() |
