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

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

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

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

odoo工作流报错



  • 新手,照着教程做的,但是报错
    Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/http.py", line 677, in dispatch
    result = self._call_function(**self.params)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/http.py", line 333, in _call_function
    return checked_call(self.db, *args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/http.py", line 326, in checked_call
    result = self.endpoint(*a, **kw)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/http.py", line 935, in call
    return self.method(*args, **kw)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/http.py", line 506, in response_wrap
    response = f(*args, **kw)
    File "/home/odoo/odoo10/odoo/addons/web/controllers/main.py", line 889, in call_button
    action = self._call_kw(model, method, args, {})
    File "/home/odoo/odoo10/odoo/addons/web/controllers/main.py", line 877, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
    File "/home/odoo/odoo10/odoo/addons/base/module/module.py", line 410, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
    File "/home/odoo/odoo10/odoo/addons/base/module/module.py", line 484, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/modules/registry.py", line 82, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/modules/loading.py", line 339, in load_modules
    loaded_modules, update_module)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/modules/loading.py", line 156, in load_module_graph
    _load_data(cr, module_name, idref, mode, kind='data')
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/modules/loading.py", line 95, in _load_data
    tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/tools/convert.py", line 845, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/tools/convert.py", line 915, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/tools/convert.py", line 796, in parse
    self.parse(rec, mode)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/tools/convert.py", line 799, in parse
    self._tags[rec.tag](rec, de, mode=mode)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/tools/convert.py", line 707, in _tag_record
    id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
    File "/home/odoo/odoo10/odoo/addons/base/ir/ir_model.py", line 1229, in _update
    record = record.create(values)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/models.py", line 3826, in create
    record = self.browse(self._create(old_vals))
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/models.py", line 3921, in _create
    cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/sql_db.py", line 154, in wrapper
    return f(self, *args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/odoo-10.0_20170901-py2.7.egg/odoo/sql_db.py", line 231, in execute
    res = self.obj.execute(query, params)
    ParseError: "invalid input syntax for integer: "activity_draft"
    LINE 1: ...xtval('wkf_transition_id_seq'), 'button_confirm', 'activity
    ...
    ^
    " while parsing /home/odoo/odoo10/odoo/myaddons/qingjia/views/workflow.xml:33, near
    <record id="transition_draft2confirm" model="workflow.transition">
    <field name="act_from">activity_draft</field>
    <field name="act_to">activity_confirm</field>
    <field name="signal">button_confirm</field>
    </record>

    workflow的代码:
    <?xml version="1.0" encoding="UTF-8"?>
    <openerp>
    <data>
    <!-- 工作流 -->
    <record id="workflow_qingjia_qingjiadan" model="workflow">
    <field name="name">请假单工作流</field>
    <field name="osv">qingjia.qingjiadan</field>
    <field name="on_create">True</field>
    </record>

      <!-- 工作流活动 -->
      <record id="activity_draft" model="workflow.activity">
          <field name="name">草稿</field>
          <field name="wkf_id" ref="workflow_qingjia_qingjiadan"/>
          <field name="kind">function</field>
          <field name="flow_start">True</field>
      </record>
      <record id="activity_confirm" model="workflow.activity">
          <field name="name">待审核</field>
          <field name="wkf_id" ref="workflow_qingjia_qingjiadan"/>
          <field name="kind">function</field>
          <field name="action">do_confirm()</field>
      </record>
      <record id="activity_complete" model="workflow.activity">
          <field name="name">已完成</field>
          <field name="wkf_id" ref="workflow_qingjia_qingjiadan"/>
          <field name="kind">function</field>
          <field name="action">do_complete()</field>
      </record>
    
      <!-- 工作流流转 -->
    
    <record id="transition_draft2confirm" model="workflow.transition">
    <field name="act_from">activity_draft</field>
    <field name="act_to">activity_confirm</field>
    <field name="signal">button_confirm</field>
    </record>
    <record id="transition_confirm2complete" model="workflow.transition">
    <field name="act_from">activity_confirm</field>
    <field name="act_to">activity_complete</field>
    <field name="signal">button_complete</field>
    </record>
    

    </data>
    </openerp>



  • 就在工作流流转哪里出了问题,求助


  • 管理员

    @liaoodoo工作流报错 中说:

    activity_draft

    不知道你的教程来自哪里,如果照抄,感觉教程错了?

    <field name="act_from">activity_confirm</field>
    <field name="act_to">activity_confirm</field>
    

    所有的这些act_fromact_to,改为:

    <field name="act_from" ref="activity_confirm"/>
    <field name="act_to" ref="activity_confirm"/>
    

    推荐odoo官方教程:https://www.odoo.com/documentation/10.0/howtos/backend.html


登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待