[ADD] mis_builder: Add possibility to define orientation on pdf report
parent
6a28cf2341
commit
ab1318d6cc
|
@ -679,6 +679,7 @@ class mis_report_instance(orm.Model):
|
||||||
'root_account': fields.function(_get_root_account,
|
'root_account': fields.function(_get_root_account,
|
||||||
type='many2one', obj='account.account',
|
type='many2one', obj='account.account',
|
||||||
string="Account chart"),
|
string="Account chart"),
|
||||||
|
'landscape_pdf': fields.boolean(string='Landscape PDF'),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
|
|
@ -48,3 +48,20 @@ class ReportMisReportInstance(models.AbstractModel):
|
||||||
}
|
}
|
||||||
return self.env['report'].\
|
return self.env['report'].\
|
||||||
render('mis_builder.report_mis_report_instance', docargs)
|
render('mis_builder.report_mis_report_instance', docargs)
|
||||||
|
|
||||||
|
|
||||||
|
class Report(models.Model):
|
||||||
|
_inherit = "report"
|
||||||
|
|
||||||
|
@api.v7
|
||||||
|
def get_pdf(self, cr, uid, ids, report_name, html=None, data=None,
|
||||||
|
context=None):
|
||||||
|
report = self._get_report_from_name(cr, uid, report_name)
|
||||||
|
obj = self.pool[report.model].browse(cr, uid, ids,
|
||||||
|
context=context)[0]
|
||||||
|
context = context.copy()
|
||||||
|
if hasattr(obj, 'landscape_pdf') and obj.landscape_pdf:
|
||||||
|
context.update({'landscape': True})
|
||||||
|
return super(Report, self).get_pdf(cr, uid, ids, report_name,
|
||||||
|
html=html, data=data,
|
||||||
|
context=context)
|
||||||
|
|
|
@ -168,6 +168,7 @@
|
||||||
</div>
|
</div>
|
||||||
<group col="2">
|
<group col="2">
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
|
<field name="landscape_pdf" />
|
||||||
<field name="report_id"/>
|
<field name="report_id"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<field name="root_account"/>
|
<field name="root_account"/>
|
||||||
|
|
Loading…
Reference in New Issue