Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

Error context: View `n/a` [view_id: n/a, xml_id: n/a, model: n/a, parent_id: n/a]



  • sps_product模块中继承product.template,自定义了form,tree视图,在sps_eco模块引用自定义的form视图,如下代码,报错如下,找不到对应的xml id,而且报错字段不存在,这些不存在的字段,都是官方中已经定义了的。

    我的现在是odoo11环境,是哪里我忽略了导致错误的吗?

    <field name="product_template_id"
                                         context="{'form_view_ref': 'sps_product.product_template_form_view', 'tree_view_ref': 'sps_product.product_template_tree_view'}"/>
                                  
    
    2018-06-19 02:43:04,866 6252 INFO 0607_v11 odoo.addons.base.ir.ir_ui_view: Field `state` does not exist
    
    Error context:
    View `n/a`
    [view_id: n/a, xml_id: n/a, model: n/a, parent_id: n/a]
    2018-06-19 02:43:04,866 6252 ERROR 0607_v11 odoo.http: Exception during JSON request handling.
    Traceback (most recent call last):
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 650, in _handle_exception
        return super(JsonRequest, self)._handle_exception(exception)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 310, in _handle_exception
        raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/tools/pycompat.py", line 87, in reraise
        raise value
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 692, in dispatch
        result = self._call_function(**self.params)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 342, in _call_function
        return checked_call(self.db, *args, **kwargs)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/service/model.py", line 97, in wrapper
        return f(dbname, *args, **kwargs)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 335, in checked_call
        result = self.endpoint(*a, **kw)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 936, in __call__
        return self.method(*args, **kw)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 515, in response_wrap
        response = f(*args, **kw)
      File "/home/hui/odoo-dev/odoo11/odoo11/addons/web/controllers/main.py", line 931, in call_kw
        return self._call_kw(model, method, args, kwargs)
      File "/home/hui/odoo-dev/odoo11/odoo11/addons/web/controllers/main.py", line 923, in _call_kw
        return call_kw(request.env[model], method, args, kwargs)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/api.py", line 687, in call_kw
        return call_kw_model(method, model, args, kwargs)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/api.py", line 672, in call_kw_model
        result = method(recs, *args, **kwargs)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/models.py", line 1295, in load_views
        for [v_id, v_type] in views
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/models.py", line 1295, in <dictcomp>
        for [v_id, v_type] in views
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/models.py", line 1381, in fields_view_get
        xarch, xfields = View.postprocess_and_fields(self._name, etree.fromstring(result['arch']), view_id)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/addons/base/ir/ir_ui_view.py", line 1042, in postprocess_and_fields
        self.raise_view_error(message, view_id)
      File "/home/hui/odoo-dev/odoo11/odoo11/odoo/addons/base/ir/ir_ui_view.py", line 503, in raise_view_error
        raise ValueError(message)
    ValueError: Field `state` does not exist
    
    Error context:
    View `n/a`
    [view_id: n/a, xml_id: n/a, model: n/a, parent_id: n/a]
    
    


  • 字段没定义,在template 表定义的可以在product表里面用,在product 表里面定义的 不可以在template表里面用。这个是继承的细节,自己多看看文档吧。