Good day to all. Trying to make custom ODOO 11 report to save it to pdf. Report template(w/out any values, just for test purposes)
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="contract_template">
<t t-call="web.html_container">
<div class="article">
<h2>Report title</h2>
<p>Report 01</p>
</div>
</t>
</template>
</data>
</odoo>
If I call this template from XML like this:
<report
id="custom_template_1"
model="res.partner.contract.wizard"
string="Contract"
report_type="qweb-pdf"
name="client_contracts.contract_template"
file="client_contracts.contract_template"
menu="False"
/>
And add button to view it works fine - it generate report. But when I'm trying to generate this report with python code:
def get_pdf_contract(self):
context = self._generate_context()
return self.env.ref('client_contracts.contract_template').report_action(self, data=context)
And add button to view:
<button string="Test pdf x" type="object" name="get_pdf_contract" />
When I press this button there is an error:
AttributeError: 'ir.ui.view' object has no attribute 'report_action'
Anyone can give me helping hand with that? Thanx for any help.