Update for OpenERP 7.0

Bug #1129867 reported by Ahmad Khayyat
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Account - Financial Report
Invalid
Undecided
Unassigned

Bug Description

The account_financial_report_webkit module does not work well with OpenERP 7.0.

When trying to generate a General Ledger report, I get the following error:

---------------------------------------
2013-02-19 06:25:01,448 17843 ERROR ? openerp.service.web_services: Exception: coercing to Unicode: need string or buffer, bool found
Traceback (most recent call last):
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 700, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/opt/openerp/7.0/addons/report_webkit/webkit_report.py", line 333, in create
    result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
  File "/opt/openerp/7.0/server/openerp/report/report_sxw.py", line 513, in create_source_pdf
    return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
  File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 171, in create_single_pdf
    if os.path.exists(path) :
  File "/usr/lib/python2.6/genericpath.py", line 18, in exists
    st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, bool found
2013-02-19 06:25:01,669 17843 ERROR None openerp.netsvc: coercing to Unicode: need string or buffer, bool found
(<type 'exceptions.TypeError'>, TypeError('coercing to Unicode: need string or buffer, bool found',), <traceback object at 0x4a2b3b0>)
Traceback (most recent call last):
  File "/opt/openerp/7.0/server/openerp/netsvc.py", line 295, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 642, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 748, in exp_report_get
    return self._check_report(report_id)
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 726, in _check_report
    netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)
  File "/opt/openerp/7.0/server/openerp/netsvc.py", line 72, in abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: (u'coercing to Unicode: need string or buffer, bool found', (<type 'exceptions.TypeError'>, TypeError('coercing to Unicode: need string or buffer, bool found',), <traceback object at 0x4a2b3b0>))
---------------------------------------

After looking closely, I found out that line 170 in account_financial_report_webkit/report/webkit_parser_header_fix.py is:

path =openerp.addons.get_module_resource(report_xml.report_file)

After looking around a bit, I found this page (http://bazaar.launchpad.net/~openerp-dev/openobject-addons/trunk-6.1-fwdport-odo/revision/8178) which suggests replacing this line with:

path =openerp.addons.get_module_resource(*report_xml.report_file.split(os.path.sep))

This change fixed the error show above, but then another error was raised:

---------------------------------------
2013-02-19 06:51:05,770 23559 WARNING ? openerp.osv.orm.browse_record.res.users: Field 'context_lang' does not exist in object 'browse_record(res.users, 1)'
2013-02-19 06:51:05,842 23559 ERROR ? financial.reports.webkit:

Traceback (most recent call last):
  File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 211, in create_single_pdf
    **self.parser_instance.localcontext)
  File "/usr/lib/pymodules/python2.6/mako/template.py", line 189, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 403, in _render
    _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 434, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 457, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x6093c50", line 19, in render_body
    <%setLang(user.context_lang)%>
  File "/opt/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'context_lang' does not exist in object 'browse_record(res.users, 1)'"

2013-02-19 06:51:05,843 23559 ERROR ? openerp.service.web_services: Exception: (u'Webkit render', '\n\nTraceback (most recent call last):\n File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 211, in create_single_pdf\n **self.parser_instance.localcontext)\n File "/usr/lib/pymodules/python2.6/mako/template.py", line 189, in render\n return runtime._render(self, self.callable_, args, data)\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 403, in _render\n _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 434, in _render_context\n _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 457, in _exec_template\n callable_(context, *args, **kwargs)\n File "memory:0x6093c50", line 19, in render_body\n <%setLang(user.context_lang)%>\n File "/opt/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__\n raise AttributeError(e)\nAttributeError: "Field \'context_lang\' does not exist in object \'browse_record(res.users, 1)\'"\n')
Traceback (most recent call last):
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 700, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/opt/openerp/7.0/addons/report_webkit/webkit_report.py", line 333, in create
    result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
  File "/opt/openerp/7.0/server/openerp/report/report_sxw.py", line 513, in create_source_pdf
    return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
  File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 216, in create_single_pdf
    raise except_osv(_('Webkit render'), msg)
except_osv: (u'Webkit render', '\n\nTraceback (most recent call last):\n File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 211, in create_single_pdf\n **self.parser_instance.localcontext)\n File "/usr/lib/pymodules/python2.6/mako/template.py", line 189, in render\n return runtime._render(self, self.callable_, args, data)\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 403, in _render\n _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 434, in _render_context\n _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 457, in _exec_template\n callable_(context, *args, **kwargs)\n File "memory:0x6093c50", line 19, in render_body\n <%setLang(user.context_lang)%>\n File "/opt/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__\n raise AttributeError(e)\nAttributeError: "Field \'context_lang\' does not exist in object \'browse_record(res.users, 1)\'"\n')
2013-02-19 06:51:06,067 23559 ERROR None openerp.netsvc: Webkit render

Traceback (most recent call last):
  File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 211, in create_single_pdf
    **self.parser_instance.localcontext)
  File "/usr/lib/pymodules/python2.6/mako/template.py", line 189, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 403, in _render
    _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 434, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 457, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x6093c50", line 19, in render_body
    <%setLang(user.context_lang)%>
  File "/opt/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'context_lang' does not exist in object 'browse_record(res.users, 1)'"
Traceback (most recent call last):
  File "/opt/openerp/7.0/server/openerp/netsvc.py", line 295, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 642, in dispatch
    res = fn(db, uid, *params)
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 748, in exp_report_get
    return self._check_report(report_id)
  File "/opt/openerp/7.0/server/openerp/service/web_services.py", line 726, in _check_report
    netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)
  File "/opt/openerp/7.0/server/openerp/netsvc.py", line 72, in abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: (u'Webkit render', u'\n\nTraceback (most recent call last):\n File "/opt/openerp/7.0/community/account-financial-report/account_financial_report_webkit/report/webkit_parser_header_fix.py", line 211, in create_single_pdf\n **self.parser_instance.localcontext)\n File "/usr/lib/pymodules/python2.6/mako/template.py", line 189, in render\n return runtime._render(self, self.callable_, args, data)\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 403, in _render\n _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 434, in _render_context\n _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)\n File "/usr/lib/pymodules/python2.6/mako/runtime.py", line 457, in _exec_template\n callable_(context, *args, **kwargs)\n File "memory:0x6093c50", line 19, in render_body\n <%setLang(user.context_lang)%>\n File "/opt/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__\n raise AttributeError(e)\nAttributeError: "Field \'context_lang\' does not exist in object \'browse_record(res.users, 1)\'"\n')
---------------------------------------

Is account_financial_report_webkit known not to work with 7.0?
Is this the current project, or is there a more recent version somewhere else?

Revision history for this message
Ahmad Khayyat (akhayyat) wrote :

In the mako template files:

- <%setLang(user.context_lang)%>
+ <%setLang(user.context.lang)%>

seems to fix the last error in the original report.

On to the next error:

---------------------------------------
Uncaught exception
Traceback (most recent call last):
  File "/opt/openerp/7.0/server/openerp/osv/osv.py", line 123, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/openerp/7.0/server/openerp/osv/osv.py", line 179, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/openerp/7.0/server/openerp/osv/osv.py", line 166, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/openerp/7.0/addons/account/wizard/account_report_common.py", line 172, in check_report
    data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id', 'target_move'], context=context)[0]
IndexError: list index out of range
---------------------------------------

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

It seems you are using the wrong branch.

Are you sure you took the 7.0 branch? Didn't you took the trunk branche?

In template of 7.0, the lang context is set with:
 <%setLang(user.lang)%>

So try the branch
lp:account-financial-report/7.0

Instead of

lp:account-financial-report (this points to lp:account-financial-report/trunk)

Changed in account-financial-report:
status: New → Incomplete
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

I haven't tested so I put this bug as incomplete

Revision history for this message
Ahmad Khayyat (akhayyat) wrote :

You are right. The 7.0 branch works fine.
Thanks!

Changed in account-financial-report:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.