c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #12411
[Bug 702339] [NEW] [6.0RC2][report]Unable to print a PDF report with custom parser
Public bug reported:
Hi all, using latest revisions from trunk in server, client and addons
(updated yesterday), I found following problem when trying to print a
report withn a custom parser from a 'osv_memory' wizard:
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[07]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 427, in create
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[08]: fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[09]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 490, in create_source_pdf
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[10]: return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[11]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 504, in create_single_pdf
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[12]: rml_parser.set_context(objs, data, ids, report_xml.report_type)
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[13]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 372, in set_context
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[14]: objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id:
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[15]: File "/opt/openerp/6.0/trunk/server/bin/osv/orm.py", line 181, in <lambda>
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[16]: return lambda *args, **argv: attr(self._cr, self._uid, [self._id], *args, **argv)
[2011-01-13 14:09:56,992][pruebas_alberto] ERROR:web-services:[17]: File "/opt/openerp/6.0/trunk/server/bin/osv/orm.py", line 2095, in exists
[2011-01-13 14:09:56,992][pruebas_alberto] ERROR:web-services:[18]: return id in self.datas
[2011-01-13 14:09:56,992][pruebas_alberto] ERROR:web-services:[19]: TypeError: unhashable type: 'list'
It seems that 'exists()' method in 'orm_memory' class (in '/bin/osv/orm.py' file, lines 2092-2096) receives a list of ids, instead a single one. Debugging this from 'report_sxw.py' in 'set_context()' method (lines 371 and so on) there's a call to this 'exists()' method upon a browse record (in my scenario a osv_memory wizard). When trying to resolve this call, I realized that in '__getitem__()' method in 'browse_record' class (orm.py file, lines 180-183) following sentence:
if isinstance(attr, (types.MethodType, types.LambdaType, types.FunctionType)):
return lambda *args, **argv: attr(self._cr, self._uid, [self._id], *args, **argv)
else:
return attr
always transforms an id in a list of ids, making 'exists()' method fail for 'orm_memory' objects...
A possible solution to this is making a type-checking in this 'exists()' method, like:
def exists(self, cr, uid, id, context=None):
if type(id) not in (int, long):
id = id[0]
return id in self.datas
Anyone got same problem?
Best regards,
** Affects: openobject-addons
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/702339
Title:
[6.0RC2][report]Unable to print a PDF report with custom parser
Status in OpenObject Addons Modules:
New
Bug description:
Hi all, using latest revisions from trunk in server, client and addons
(updated yesterday), I found following problem when trying to print a
report withn a custom parser from a 'osv_memory' wizard:
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[07]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 427, in create
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[08]: fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[09]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 490, in create_source_pdf
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[10]: return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
[2011-01-13 14:09:56,990][pruebas_alberto] ERROR:web-services:[11]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 504, in create_single_pdf
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[12]: rml_parser.set_context(objs, data, ids, report_xml.report_type)
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[13]: File "/opt/openerp/6.0/trunk/server/bin/report/report_sxw.py", line 372, in set_context
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[14]: objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id:
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[15]: File "/opt/openerp/6.0/trunk/server/bin/osv/orm.py", line 181, in <lambda>
[2011-01-13 14:09:56,991][pruebas_alberto] ERROR:web-services:[16]: return lambda *args, **argv: attr(self._cr, self._uid, [self._id], *args, **argv)
[2011-01-13 14:09:56,992][pruebas_alberto] ERROR:web-services:[17]: File "/opt/openerp/6.0/trunk/server/bin/osv/orm.py", line 2095, in exists
[2011-01-13 14:09:56,992][pruebas_alberto] ERROR:web-services:[18]: return id in self.datas
[2011-01-13 14:09:56,992][pruebas_alberto] ERROR:web-services:[19]: TypeError: unhashable type: 'list'
It seems that 'exists()' method in 'orm_memory' class (in '/bin/osv/orm.py' file, lines 2092-2096) receives a list of ids, instead a single one. Debugging this from 'report_sxw.py' in 'set_context()' method (lines 371 and so on) there's a call to this 'exists()' method upon a browse record (in my scenario a osv_memory wizard). When trying to resolve this call, I realized that in '__getitem__()' method in 'browse_record' class (orm.py file, lines 180-183) following sentence:
if isinstance(attr, (types.MethodType, types.LambdaType, types.FunctionType)):
return lambda *args, **argv: attr(self._cr, self._uid, [self._id], *args, **argv)
else:
return attr
always transforms an id in a list of ids, making 'exists()' method fail for 'orm_memory' objects...
A possible solution to this is making a type-checking in this 'exists()' method, like:
def exists(self, cr, uid, id, context=None):
if type(id) not in (int, long):
id = id[0]
return id in self.datas
Anyone got same problem?
Best regards,
Follow ups
References