Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

'NoneType' object has no attribute '_fields'

By
Hamza Tahboub
on 7/13/16, 6:31 AM 474 views

Hello, when I reach a certain page in my website it gives me an error.


Model:

from openerp import models, fields, api
  class test_sale_order(models.Model):
      _name = "_order"
      order_date = fields.Text(required=True)


The Important Part of the View:

<div class="row form-group">
    <div class="input-group">
        <div t-field="odss_order.order_date"/>
        </div>
    </div>
</div>


Error:

'NoneType' object has no attribute '_fields'


Traceback:

Traceback (most recent call last):
  File "/opt/odoo/addons/website/models/ir_http.py", line 243, in _handle_exception
    response = super(ir_http, self)._handle_exception(exception)
  File "/opt/odoo/openerp/addons/base/ir/ir_http.py", line 157, in _handle_exception
    return request._handle_exception(exception)
  File "/opt/odoo/openerp/http.py", line 784, in _handle_exception
    return super(HttpRequest, self)._handle_exception(exception)
  File "/opt/odoo/openerp/addons/base/ir/ir_http.py", line 182, in _dispatch
    result = request.dispatch()
  File "/opt/odoo/openerp/http.py", line 843, in dispatch
    r = self._call_function(**self.params)
  File "/opt/odoo/openerp/http.py", line 319, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/openerp/http.py", line 315, in checked_call
    result.flatten()
  File "/opt/odoo/openerp/http.py", line 1444, in flatten
    self.response.append(self.render())
  File "/opt/odoo/openerp/http.py", line 1437, in render
    context=request.context)
  File "/opt/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/addons/website/models/ir_ui_view.py", line 166, in render
    return super(view, self).render(cr, uid, id_or_xml_id, values=values, engine=engine, context=context)
  File "/opt/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/addons/web_editor/models/ir_ui_view.py", line 29, in render
    return super(view, self).render(cr, uid, id_or_xml_id, values=values, engine=engine, context=context)
  File "/opt/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/ir/ir_ui_view.py", line 1074, in render
    return self.pool[engine].render(cr, uid, id_or_xml_id, qcontext, loader=loader, context=context)
  File "/opt/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 254, in render
    return self.render_node(element, qwebcontext, generated_attributes=qwebcontext.pop('generated_attributes', ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 295, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 448, in render_tag_call
    d[0] = self.render_element(element, template_attributes, generated_attributes, d)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 297, in render_node
    result = self.render_element(element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 325, in render_element
    raise_qweb_exception(message="Could not render element %r" % element.tag, node=element, template=template)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 320, in render_element
    generated_attributes= name == "t" and generated_attributes or ''))
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 295, in render_node
    result = self._render_tag[t_render](self, element, template_attributes, generated_attributes, qwebcontext)
  File "/opt/odoo/openerp/addons/base/ir/ir_qweb.py", line 503, in render_tag_field
    field = record._fields[field_name]
QWebException: 'NoneType' object has no attribute '_fields'


QWeb:

Could not render element 'div'

The error occured while rendering the template 900

<div class="input-group">
                                              <div t-field="odss_order.order_date"/>
                                              </div>
                                            

The class in the model is called odss_sale_order not test_sale_order

Hamza Tahboub
on 7/13/16, 6:39 AM

and its name is sale_order not _order

Hamza Tahboub
on 7/13/16, 6:41 AM
0
kirubanidhi
On 7/13/16, 6:54 AM

You specified extra </div> in your code so remove one <div> tag.
change this code,
<div class="row form-group">   
        <div class="input-group">       
                <div t-field="odss_order.order_date"/>       
        </div>   
</div>
 

No I didn't, they are all required.

Hamza Tahboub
on 7/13/16, 7:36 AM

see in your previous code. <div t-field="odss_order.order_date"/> this div tag is closing end ot t-field so remove one div tag

kirubanidhi
on 7/13/16, 8:03 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/13/16, 6:31 AM
Seen: 474 times
Last updated: 7/13/16, 7:36 AM