Skip to content
Snippets Groups Projects
Commit c1b10731 authored by Florian Damhaut's avatar Florian Damhaut
Browse files

[FIX] hr_fleet : UserError on empty pdf


Step to reproduce:
- Print a 'claim car report' on a car with no attachment

Current Behaviour:
- Print a empty PDF

Behaviour after PR:
- The landing page explain to the user there is no pdf to print

opw-2714493

closes odoo/odoo#81687

Signed-off-by: default avatarDamhaut Florian (flda) <flda@odoo.com>
parent e2a1c683
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,9 @@ class HrFleet(Controller):
page.mergePage(header_pdf.getPage(0))
writer.addPage(page)
if not writer.getNumPages():
request.not_found(_('There is no pdf attached to generate a claim report.'))
_buffer = io.BytesIO()
writer.write(_buffer)
merged_pdf = _buffer.getvalue()
......
......@@ -118,6 +118,11 @@ msgid ""
"go on vehicle page. Do you want to proceed?"
msgstr ""
#. module: hr_fleet
#: code:addons/hr_fleet/controllers/main.py:0
msgid "There is no pdf attached to generate a claim report."
msgstr ""
#. module: hr_fleet
#: model:ir.model,name:hr_fleet.model_res_users
msgid "Users"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment