diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/snailmail/models/ir_actions_report.py | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/snailmail/models/ir_actions_report.py')
| -rw-r--r-- | addons/snailmail/models/ir_actions_report.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/snailmail/models/ir_actions_report.py b/addons/snailmail/models/ir_actions_report.py new file mode 100644 index 00000000..91573ef4 --- /dev/null +++ b/addons/snailmail/models/ir_actions_report.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ + + +class IrActionsReport(models.Model): + _inherit = 'ir.actions.report' + + def retrieve_attachment(self, record): + # Override this method in order to force to re-render the pdf in case of + # using snailmail + if self.env.context.get('snailmail_layout'): + return False + return super(IrActionsReport, self).retrieve_attachment(record) + + @api.model + def get_paperformat(self): + # force the right format (euro/A4) when sending letters, only if we are not using the l10n_DE layout + res = super(IrActionsReport, self).get_paperformat() + if self.env.context.get('snailmail_layout') and res != self.env.ref('l10n_de.paperformat_euro_din', False): + paperformat_id = self.env.ref('base.paperformat_euro') + return paperformat_id + else: + return res |
