From c8f029744bcb2d438ec544988c56c5151696ea93 Mon Sep 17 00:00:00 2001 From: "Nicolas (vin)" Date: Wed, 23 Sep 2020 09:11:14 +0000 Subject: [PATCH] [FIX] account: Fix automatic wizard issues When coming from the dashboard (dashboard => Bills to pay => Bill) The context contains information about the purchase journal and not the move line, causing an issue in the wizard. This change will make sure the context always contains the necessary move line information Task id #2344722 closes odoo/odoo#58835 X-original-commit: f9ef2c8cd980ecb9eee22d4cc43d5291953471ef Signed-off-by: oco-odoo --- addons/account/models/account_move.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 2905ff4764d..18bce175ac5 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -4664,7 +4664,12 @@ class AccountMoveLine(models.Model): def action_automatic_entry(self): [action] = self.env.ref('account.account_automatic_entry_wizard_action').read() - action['context'] = self.env.context + # Force the values of the move line in the context to avoid issues + ctx = dict(self.env.context) + ctx['active_id'] = self.id + ctx['active_ids'] = self.ids + ctx['active_model'] = 'account.move.line' + action['context'] = ctx return action @api.model