From 848e95a34cf5b1788a24c6e7a04eddc8dce91861 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 11 Jul 2017 15:14:21 +0200 Subject: [PATCH] [FIX] point_of_sale: Printing Sales Details without logo or layout When printing a report, if the company logo or report layout is not set, it will return an action (ir.actions.act_window) to set the layout or the logo. But this change of actions does not forward the data parameters to print the price list. So it raised an error. PS: the problem comes from function "set_report_template" which doesn't take the data parameters into account when it is called from "res.company.report.form". opw:751697 --- addons/point_of_sale/i18n/point_of_sale.pot | 12 ++++++++++++ addons/point_of_sale/wizard/pos_details.py | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index a30894348fb..5b98e317f48 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -3381,6 +3381,18 @@ msgid "You have to select a pricelist in the sale form !\n" "Please set one before choosing a product." msgstr "" +#. module: point_of_sale +#: code:addons/point_of_sale/wizard/pos_details.py:48 +#, python-format +msgid "You have to set a logo for your company." +msgstr "" + +#. module: point_of_sale +#: code:addons/point_of_sale/wizard/pos_details.py:50 +#, python-format +msgid "You have to set your reports's header and footer layout." +msgstr "" + #. module: point_of_sale #: code:addons/point_of_sale/models/pos_session.py:24 #, python-format diff --git a/addons/point_of_sale/wizard/pos_details.py b/addons/point_of_sale/wizard/pos_details.py index 0a599aefd86..e2a2500ddf5 100644 --- a/addons/point_of_sale/wizard/pos_details.py +++ b/addons/point_of_sale/wizard/pos_details.py @@ -44,6 +44,10 @@ class PosDetails(models.TransientModel): @api.multi def generate_report(self): + if (not self.env.user.company_id.logo): + raise UserError(_("You have to set a logo or a layout for your company.")) + elif (not self.env.user.company_id.external_report_layout): + raise UserError(_("You have to set your reports's header and footer layout.")) data = {'date_start': self.start_date, 'date_stop': self.end_date, 'config_ids': self.pos_config_ids.ids} return self.env['report'].get_action( [], 'point_of_sale.report_saledetails', data=data)