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

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

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

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

修改sale order的workflow后发生错误 DataError



  • 修改sale order的workflow后发生错误
    Traceback (most recent call last):
    File "netsvc.pyo", line 244, in dispatch
    File "netsvc.pyo", line 73, in call
    File "serviceweb_services.pyo", line 577, in exec_workflow
    File "osvosv.pyo", line 59, in wrapper
    File "osvosv.pyo", line 136, in exec_workflow
    File "osvosv.pyo", line 129, in exec_workflow_cr
    File "workflowwkf_service.pyo", line 81, in trg_validate
    File "workflowinstance.pyo", line 50, in validate
    File "workflowworkitem.pyo", line 62, in process
    File "workflowworkitem.pyo", line 175, in _split_test
    File "workflowworkitem.pyo", line 183, in _join_test
    File "workflowworkitem.pyo", line 42, in create
    File "workflowworkitem.pyo", line 54, in process
    File "workflowworkitem.pyo", line 108, in _execute
    File "workflowwkf_expr.pyo", line 68, in execute
    File "workflowwkf_expr.pyo", line 58, in _eval_expr
    File "<string>", line 1, in <module>
    File "osvorm.pyo", line 168, in <lambda>
    File "C:Program FilesOpenERP AllInOneServeraddonssalesale.py", line 344, in write
    File "osvorm.pyo", line 2458, in write
    File "sql_db.pyo", line 76, in wrapper
    File "sql_db.pyo", line 120, in execute
    DataError: value too long for type character varying(16)

    所修改的文件如下:
    [attach]459[/attach]



  • 修改sale order的workflow后发生错误
    Traceback (most recent call last):
    File "netsvc.pyo", line 244, in dispatch
    File "netsvc.pyo", line 73, in call
    File "serviceweb_services.pyo", line 577, in exec_workflow
    File "osvosv.pyo", line 59, in wrapper
    File "osvosv.pyo", line 136, in exec_workflow
    File "osvosv.pyo", line 129, in exec_workflow_cr
    File "workflowwkf_service.pyo", line 81, in trg_validate
    File "workflowinstance.pyo", line 50, in validate
    File "workflowworkitem.pyo", line 62, in process
    File "workflowworkitem.pyo", line 175, in _split_test
    File "workflowworkitem.pyo", line 183, in _join_test
    File "workflowworkitem.pyo", line 42, in create
    File "workflowworkitem.pyo", line 54, in process
    File "workflowworkitem.pyo", line 108, in _execute
    File "workflowwkf_expr.pyo", line 68, in execute
    File "workflowwkf_expr.pyo", line 58, in _eval_expr
    File "<string>", line 1, in <module>
    File "osvorm.pyo", line 168, in <lambda>
    File "C:Program FilesOpenERP AllInOneServeraddonssalesale.py", line 344, in write
    File "osvorm.pyo", line 2458, in write
    File "sql_db.pyo", line 76, in wrapper
    File "sql_db.pyo", line 120, in execute
    DataError: value too long for type character varying(16)

    所修改的文件如下:
    [attach]459[/attach]



  • 我怀疑orm在根据model定义table的时候,field的长度按selection的最大长度
    shipping_except这个最长,16位
    你py文件里新加个20位的,table里field没扩大,就出错了
    你pgadmin去看看table sale.order里status的长度,是16
    结论是,加 selection 注意 key 不要比原有的key长



  • sale.py
    'state': fields.selection([
    ('draft', 'Quotation'),
    ('waiting_date', 'Waiting Schedule'),
    ('manual', 'Manual In Progress'),
    ('progress', 'In Progress'),
    ('shipping_except', 'Shipping Exception'),
    ('invoice_except', 'Invoice Exception'),
    ('done', 'Done'),
    ('cancel', 'Cancelled')
    ], 'Order State', readonly=True, select=True),
    'date_order': fields.date('Date Ordered', required=True, readonly=True, states={'draft': [('readonly', False)]}),

    改为
    'state': fields.selection([
    ('draft', 'Quotation'),
    ('customer_confirmed','Customer Confirmed'),
    ('assigned','Assigned'),
    ('bm_approve','BM Approved'),
    ('gm_refuse','GM Refused'),
    ('done', 'Done'),
    ('cancel', 'Cancelled')
    ], 'Order State', readonly=True,
    'date_order': fields.date('Date Ordered', required=True, readonly=True, states={'draft': [('readonly', False)]}),



  • [quote]原帖由 [i]wjfonhand[/i] 于 2010-3-24 11:07 发表 [url=www.shine-it.net/redirect.php?goto=findpost&pid=4508&ptid=961][img]www.shine-it.net/images/common/back.gif[/img][/url]
    我怀疑orm在根据model定义table的时候,field的长度按selection的最大长度
    shipping_except这个最长,16位
    你py文件里新加个20位的,table里field没扩大,就出错了
    你pgadmin去看看table sale.order里status的长度 ... [/quote]

    恩,的确是这个问题



  • 顺便找了找 5.0.7 orm.py 中, 关于 selection 类型字段的 字段长度处理部分的代码.
    [code] if isinstance(f.selection, list) and isinstance(f.selection[0][0], (str, unicode)): f_size = reduce(lambda x, y: max(x, len(y[0])), f.selection, f.size or 16) elif isinstance(f.selection, list) and isinstance(f.selection[0][0], int):
    f_size = -1
    else:
    f_size = (hasattr(f, 'size') and f.size) or 16

    if f_size == -1:
    f_type = ('int4', 'INTEGER')
    else:
    f_type = ('varchar', 'VARCHAR(%d)' % f_size)[/code]


登录后回复
 

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