From 51f0f46ea7623c84bc81ad2d50350e73b7ff6cbb Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Thu, 12 Apr 2018 09:39:45 +0200 Subject: [PATCH] Fall 5430 Bugfix mit context --- ext/custom-addons/dp_custom/models/account.py | 4 +--- .../dp_custom/wizards/wizard_confirm_print_invoice.py | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/custom-addons/dp_custom/models/account.py b/ext/custom-addons/dp_custom/models/account.py index 7348998a..e58ea93a 100644 --- a/ext/custom-addons/dp_custom/models/account.py +++ b/ext/custom-addons/dp_custom/models/account.py @@ -134,8 +134,6 @@ class AccountInvoice(models.Model): intrastrat_not_set = True if intrastrat_not_set: action = self.env.ref('dp_custom.action_wizard_confirm_print_invoice').read()[0] - action['context'] = '{"default_info": "'+info+'"}' + action['context'] = str({"default_info": info, "invoice_ids": self.env.context.get("active_ids")}) return action return self.env.ref('dp_reports_account.account_invoices_with_intrastat').report_action(self) - - diff --git a/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py b/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py index e2122016..8b510766 100644 --- a/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py +++ b/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py @@ -13,6 +13,8 @@ class ConfirmPrintInvoice(models.TransientModel): def print_invoice(self): self.ensure_one() - invoice = self.env['account.invoice'].browse(self.env.context.get('active_ids', [])) + invoice = self.env['account.invoice'].browse(self.env.context.get('invoice_ids', [])) + if not invoice: + return {'type': 'ir.actions.act_window_close'} return self.env.ref('dp_reports_account.account_invoices_with_intrastat').report_action(invoice)