[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 <oco-odoo@users.noreply.github.com>
This commit is contained in:
Nicolas (vin)
2020-09-29 14:53:57 +00:00
parent 481d1393e7
commit c8f029744b
+6 -1
View File
@@ -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