Hi,
I have created a new field in the model hr.contract.type, this new field called format is HTML type, the field format is filled with the contract format that must be printed in the hr.contract model form view. The idea is that the field format have inside keywords or variables that must be replaced in the report generation, like the Email templates, that the variables are replaced when the email is sent.
The QWeb view is this:
<?xml version="1.0"?> <t t-name="hr.contrato_laboral"> <t t-call="report.html_container"> <t t-foreach="docs" t-as="o"> <t t-call="report.external_layout"> <div class="page"> <span t-raw="o.type_id.format"/> </div> </t> </t> </t> </t>
I have read that i can create a custom report like this:
from openerp import api, models
class ParticularReport(models.AbstractModel):
_name = 'report.<<module.reportname>>'
@api.multi
def render_html(self, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name('<<module.reportname>>')
docargs = { 'doc_ids': self._ids, 'doc_model': report.model, 'docs': self, }
return report_obj.render('<<module.reportname>>', docargs)
But where and how can i make the replacement of the keywords or variables?
Best regards,
Juan David López
Their is not right solution, its very panic to do so. for this odoo is not right ERP.
Hi Juan,
Did you solve it?