[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
This commit is contained in:
Goffin Simon
2017-07-12 09:39:28 +02:00
parent 2fd28b2298
commit 848e95a34c
2 changed files with 16 additions and 0 deletions
@@ -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
@@ -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)