Error printing Request for Quotation (Trunk V8)

Bug #1306047 reported by Christian Parent
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Purchase - Reports
Fix Released
Undecided
codefans

Bug Description

When trying to print a request for quotation a pop-up message show up :

Uncaught SyntaxError: Unexpected end of input
http://xxx.xxx.xxx.xxx:xxxx/web?#id=7&view_type=form&model=purchase.order&action=406:0

Here is the trace from server:

2014-04-10 16:02:43,097 27898 ERROR EKYRAIL werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/share/pyshared/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/share/pyshared/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/opt/openerp/server/openerp/service/server.py", line 261, in app
    return self.app(e, s)
  File "/opt/openerp/server/openerp/service/wsgi_server.py", line 215, in application
    return application_unproxied(environ, start_response)
  File "/opt/openerp/server/openerp/service/wsgi_server.py", line 201, in application_unproxied
    result = handler(environ, start_response)
  File "/opt/openerp/server/openerp/http.py", line 1094, in __call__
    return self.dispatch(environ, start_response)
  File "/opt/openerp/server/openerp/http.py", line 1071, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/share/pyshared/werkzeug/wsgi.py", line 579, in __call__
    return self.app(environ, start_response)
  File "/opt/openerp/server/openerp/http.py", line 1231, in dispatch
    result = ir_http._dispatch()
  File "/opt/openerp/server/openerp/addons/base/ir/ir_http.py", line 120, in _dispatch
    return self._handle_exception(e)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_http.py", line 116, in _dispatch
    result = request.dispatch()
  File "/opt/openerp/server/openerp/http.py", line 534, in dispatch
    r = self._call_function(**self.params)
  File "/opt/openerp/server/openerp/http.py", line 295, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/openerp/server/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/openerp/server/openerp/http.py", line 292, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/openerp/server/openerp/http.py", line 635, in __call__
    return self.method(*args, **kw)
  File "/opt/openerp/server/openerp/http.py", line 338, in response_wrap
    response = f(*args, **kw)
  File "/opt/openerp/server/openerp/addons/report/controllers/main.py", line 111, in report_download
    response = self.report_pdf(reportname, docids)
  File "/opt/openerp/server/openerp/http.py", line 338, in response_wrap
    response = f(*args, **kw)
  File "/opt/openerp/server/openerp/addons/report/controllers/main.py", line 45, in report_pdf
    pdf = request.registry['report'].get_pdf(cr, uid, docids, reportname, context=context)
  File "/opt/openerp/server/openerp/addons/report/models/report.py", line 255, in get_pdf
    html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
  File "/opt/openerp/server/openerp/addons/report/models/report.py", line 246, in get_html
    return self.render(cr, uid, [], report.report_name, docargs, context=context)
  File "/opt/openerp/server/openerp/addons/report/models/report.py", line 222, in render
    return view_obj.render(cr, uid, template, values, context=context)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_ui_view.py", line 860, in render
    return self.pool[engine].render(cr, uid, tname, qcontext, loader=loader, context=context)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 229, in render
    return self.render_node(self.get_template(id_or_xml_id, qwebcontext), qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 273, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 290, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 271, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 382, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 290, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 271, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 368, in render_tag_foreach
    ru.append(self.render_element(element, template_attributes, generated_attributes, copy_qwebcontext))
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 290, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 271, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 382, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 290, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 273, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 295, in render_element
    raise_qweb_exception(message="Could not render element %r" % element.nodeName, node=element, template=template)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 290, in render_element
    g_inner.append(self.render_node(current_node, qwebcontext))
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 271, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/openerp/server/openerp/addons/base/ir/ir_qweb.py", line 409, in render_tag_field
    column = record._model._all_columns[field_name].column
QWebException: 'NoneType' object has no attribute '_model'

Revision history for this message
Atul (jain-atul43) wrote :

NoneType usually means you are trying to use a variable that has not been defined. Without code and the error message it is impossible to tell anything at all.

Revision history for this message
Christian Parent (mobidoy) wrote :

In the purchase order form, under the print drop down, you have the option to either print the quotation or the purchase order. It is the quotation order that does not work. If you use the Print purchase order and your order is still in draft state, it will print it as a quotation, else, as a purchase order. I will have a look at the code behind the quotation order and see what is wrong.

Revision history for this message
codefans (codefans3) wrote :

I get the same error and i find out why.

------------
How i fixed it.

open file report.py (..addons/report/models)

change method render_doc
 values.update({
            'time': time,
            'formatLang': partial(self.formatLang, cr=cr, uid=uid),
            'get_digits': self._get_digits,
            'render_doc': render_doc,
            'editable': True, # Will active inherit_branding
            'res_company': self.pool['res.users'].browse(cr, uid, uid).company_id,
            'website': False, # Will be overidden by ir.ui.view if the request has website enabled
            'user': self.pool['res.users'].browse(cr, uid, uid) # add this line
        })
--------------------------

error will be disappeared.

maybe you need update 'wkhtmltopdf' in server

"""Check the presence of wkhtmltopdf and return its version."""
wkhtmltopdf_state = 'install'
try:
    process = subprocess.Popen(
        ['wkhtmltopdf', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE
    )
except OSError:
    _logger.error('You need wkhtmltopdf to print a pdf version of the reports.')
else:
    out, err = process.communicate()
    version = out.split(' ')[1]
    if LooseVersion(version) < LooseVersion('0.12.0'):
        _logger.warning('Upgrade wkhtmltopdf to (at least) 0.12.0')
        wkhtmltopdf_state = 'upgrade'
    wkhtmltopdf_state = 'ok'

@Christian Parent

Revision history for this message
Alejandro (phoenixguitar0) wrote :

Yes, worked for me.

Thanks a lot for the fix.
Can you change the status for this bug?

codefans (codefans3)
Changed in purchase-report:
assignee: nobody → codefans (codefans3)
assignee: codefans (codefans3) → nobody
Revision history for this message
codefans (codefans3) wrote :

Sorry i don't know how to commit the code to trunk.

could you help me to update the code and change the statue?

Changed in purchase-report:
status: New → Fix Released
assignee: nobody → codefans (codefans3)
Revision history for this message
Alejandro (phoenixguitar0) wrote :

Yes of course , I changed the status to Fix released

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.