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

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

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

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

使用odoo-bin scaffold 生成的默认模块 点击升级时候报错 版本odoo12



  • 错误:
    Odoo Server Error

    Traceback (most recent call last):
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 757, in parse
    self._tags[rec.tag](rec, de, mode=mode)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 662, in _tag_record
    record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\models.py", line 3805, in _load_records
    records = self.create([data['values'] for data in to_create])
    File "<decorator-gen-35>", line 2, in create
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\api.py", line 452, in _model_create_multi
    return create(self, arg)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\base\models\ir_actions.py", line 58, in create
    res = super(IrActions, self).create(vals_list)
    File "<decorator-gen-3>", line 2, in create
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\api.py", line 452, in _model_create_multi
    return create(self, arg)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\models.py", line 3506, in create
    records = self._create(data_list)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\models.py", line 3606, in _create
    cr.execute(query, params)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\sql_db.py", line 148, in wrapper
    return f(self, *args, **kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\sql_db.py", line 225, in execute
    res = self._obj.execute(query, params)
    psycopg2.IntegrityError: 错误: 在字段 "activity_user_type" 中空值违反了非空约束
    DETAIL: 失败, 行包含(240, demoTwo server, ir.actions.server, null, null, action, 1, 2018-12-28 01:44:38.993237, 1, 2018-12-28 01:44:38.993237, ir_actions_server, code, 5, 218, null,
    action = {
    "type": "ir.actions.act_window",
    ..., null, null, null, null, null, null, null, null, null, null, null).

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 654, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 312, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\pycompat.py", line 87, in reraise
    raise value
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 696, in dispatch
    result = self._call_function(**self.params)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 344, in _call_function
    return checked_call(self.db, *args, **kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\service\model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 337, in checked_call
    result = self.endpoint(*a, **kw)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 939, in call
    return self.method(*args, **kw)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\http.py", line 517, in response_wrap
    response = f(*args, **kw)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\web\controllers\main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\web\controllers\main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\api.py", line 749, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\api.py", line 736, in _call_kw_multi
    result = method(recs, *args, **kwargs)
    File "<decorator-gen-67>", line 2, in button_immediate_upgrade
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\base\models\ir_module.py", line 71, in check_and_log
    return method(self, *args, **kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\base\models\ir_module.py", line 596, in button_immediate_upgrade
    return self._button_immediate_function(type(self).button_upgrade)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\base\models\ir_module.py", line 535, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\modules\registry.py", line 86, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\modules\loading.py", line 417, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\modules\loading.py", line 313, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\modules\loading.py", line 222, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package, report=report)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\modules\loading.py", line 68, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 801, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 864, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 754, in parse
    self.parse(rec, mode)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 763, in parse
    exc_info[2]
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 757, in parse
    self._tags[rec.tag](rec, de, mode=mode)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\tools\convert.py", line 662, in _tag_record
    record = model.with_context(rec_context)._load_records([data], self.mode == 'update')
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\models.py", line 3805, in _load_records
    records = self.create([data['values'] for data in to_create])
    File "<decorator-gen-35>", line 2, in create
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\api.py", line 452, in _model_create_multi
    return create(self, arg)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\addons\base\models\ir_actions.py", line 58, in create
    res = super(IrActions, self).create(vals_list)
    File "<decorator-gen-3>", line 2, in create
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\api.py", line 452, in _model_create_multi
    return create(self, arg)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\models.py", line 3506, in create
    records = self._create(data_list)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\models.py", line 3606, in _create
    cr.execute(query, params)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\sql_db.py", line 148, in wrapper
    return f(self, *args, **kwargs)
    File "E:\ODOO\v12\Odoo 12.0\server\odoo\sql_db.py", line 225, in execute
    res = self._obj.execute(query, params)
    odoo.tools.convert.ParseError: "错误: 在字段 "activity_user_type" 中空值违反了非空约束
    DETAIL: 失败, 行包含(240, demoTwo server, ir.actions.server, null, null, action, 1, 2018-12-28 01:44:38.993237, 1, 2018-12-28 01:44:38.993237, ir_actions_server, code, 5, 218, null,
    action = {
    "type": "ir.actions.act_window",
    ..., null, null, null, null, null, null, null, null, null, null, null).
    " while parsing file:/e:/odoo/v12/odoo%2012.0/server/addons/demo_two/views/views.xml:27, near
    <record model="ir.actions.server" id="demo_two.action_server">
    <field name="name">demoTwo server</field>
    <field name="model_id" ref="model_demo_two_demo_two"/>
    <field name="state">code</field>
    <field name="code">
    action = {
    "type": "ir.actions.act_window",
    "view_mode": "tree,form",
    "res_model": self._name,
    }
    </field>
    </record>



  • @llrrjj使用odoo-bin scaffold 生成的默认模块 点击升级时候报错 版本odoo12 中说:

    odoo.tools.convert.ParseError: "错误: 在字段 "activity_user_type" 中空值违反了非空约束

    报错信息提示了,既然有非空约束,是不是应该给个默认值。



  • 刚用这个 不怎么懂 我这代码拿错了
    <record model="ir.actions.server" id="demo_one.action_server">
    <field name="name">demoOne server</field>
    <field name="model_id" ref="model_demo_one_demo_one"/>
    <field name="state">code</field>
    <field name="code">
    action = {
    "type": "ir.actions.act_window",
    "view_mode": "tree,form",
    "res_model": self._name,
    }
    </field>
    </record>



  • @llrrjj
    你现在拿的这个是odoo关于server action的代码。你用这个想要实现什么功能?
    上述贴出来的代码跟报错没有直接关系吧,我觉得应该找那个字段在的model。



  • @hui
    model中没有报错那个字段的

    class demo_two(models.Model):
    _name = 'demo_two.demo_two'

    name = fields.Char()
    value = fields.Integer()
    value2 = fields.Float(compute="_value_pc", store=True)
    description = fields.Text()
    
    @api.depends('value')
    def _value_pc(self):
        self.value2 = float(self.value) / 100


  • @hui

    这还是用 odoo-bin scaffold 这个生成的代码 都没有改过



  • @llrrjj 看那个字段在哪个model中啊,看看那个model中的代码


登录后回复