Hello all of you,
I need to instAntiate a paperformat in my custom module class.
I will return this instance from a function
Thanks for your idea.
UPDATED 1 --------
May be I need a line like this one. I will try to complete it. Could you?
defaultpaper = self.pool.get('ir.model.data').....
UPDATED 2 ----------
We want to attrib this paperformat to a variable :
Our code :
if model == 'pos.order':
cie_pos_paperformat = user.company_id.x_pos_paperformat
if cie_pos_paperformat:
paperformat = cie_pos_paperformat
elif report.paperformat_id:
paperformat = report.paperformat_id
else:
paperformat = {
'us_stmt': ref('report_lapagept.paperformat_us_stmt'),
}.get(company.rml_paper_format) or ref('report.paperformat_euro')
We get an error for the moment...
UPDATE 3 ------------------------------
Our new code :
if modelll == 'pos.order':
cie_pos_paperformat = user.company_id.x_pos_paperformat
if cie_pos_paperformat:
paperformat = cie_pos_paperformat
elif report.paperformat_id:
paperformat = report.paperformat_id
else:
ref = partial(self.pool['ir.model.data'].xmlid_to_res_id, cr, SUPERUSER_ID)
paperformat = ref('report_lapagept.paperformat_us_stmt')
_logger.error('paper :' + paperformat)
We get error :
File "/home/odoo-test/addons/report/models/report.py", line 513, in _build_wkhtmltopdf_args if paperformat.format and paperformat.format != 'custom': AttributeError: 'int' object has no attribute 'format'
In the log :
- Usually, if I log a paperformat instance, I get this :
ERROR : test openerp.addons.report_lapagept.models.report_lapagept: paper : report.paperformat(28,)
- For the moment, we get this, and it is not a paperformat instance. Just an integer of th ID, I think. :
ERROR test openerp.addons.report_lapagept.models.report_lapagept: paper : 28
Idea? Thanks
See init in class res_company in report/models/report.paperformat.py, help you?
answer updated, If is only int ID then... browse, hope you helps