Skip to content
Snippets Groups Projects
Commit e03fae1f authored by Solan Delvenne (sode)'s avatar Solan Delvenne (sode)
Browse files

[IMP] snailmail: Send an error when using non-A4 paperformat.


Since the provider only accepts A4 letters, prevent the user from using
non A4 formats by giving them an error when clicking the Send button.

closes odoo/odoo#105058

Signed-off-by: default avatarFlorian Daloze (fda) <fda@odoo.com>
parent f2a4d537
No related branches found
No related tags found
No related merge requests found
......@@ -127,6 +127,9 @@ class SnailmailLetter(models.Model):
else:
report_name = 'Document'
filename = "%s.%s" % (report_name, "pdf")
paperformat = report.get_paperformat()
if (paperformat.format == 'custom' and paperformat.page_width != 210 and paperformat.page_height != 297) or paperformat.format != 'A4':
raise UserError(_("Please use an A4 Paper format."))
if not self.cover:
raise UserError(_("Snailmails without covers are no longer supported in Odoo 13.\nPlease enable the 'Add a Cover Page' option in your Invoicing settings or upgrade your Odoo."))
pdf_bin, unused_filetype = report.with_context(snailmail_layout=not self.cover, lang='en_US').render_qweb_pdf(self.res_id)
......
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