Since commit b6a981405e we require a
certain key in the context to apply the custom snailmail report layout.
This was badly managed and would eventually confilt inside the modal
that links snailmail and the mail composer.
This fix stabilises the biehaviour by properly propagating the context
key.
18 lines
610 B
Python
18 lines
610 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import models, fields, api, _
|
|
|
|
|
|
class IrActionsReport(models.Model):
|
|
_inherit = 'ir.actions.report'
|
|
|
|
@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
|