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

由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

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

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

[已解决]oe6.1.1 打开会计凭证行报错,bug?



  • Client Traceback (most recent call last):
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\common\http.py", line 180, in dispatch
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\controllers\main.py", line 1204, in load
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\controllers\main.py", line 1086, in fields_view_get
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\common\openerplib\main.py", line 250, in proxy
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\common\openerplib\main.py", line 117, in proxy
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\common\http.py", line 611, in send


    Server Traceback (most recent call last):
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\web\common\http.py", line 592, in send
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\netsvc.py", line 360, in dispatch_rpc
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\service\web_services.py", line 586, in dispatch
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\osv.py", line 167, in execute_kw
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\osv.py", line 121, in wrapper
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\osv.py", line 176, in execute
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\osv.py", line 164, in execute_cr
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\account\account_move_line.py", line 972, in fields_view_get
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\orm.py", line 2153, in fields_view_get
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\orm.py", line 1793, in __view_look_dom_arch
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\osv\orm.py", line 1695, in __view_look_dom
      File "d:\OpenERP 6.1-20120615-233338\Server\server\openerp\addons\account\account_move_line.py", line 935, in view_header_get
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\sql_db.py", line 152, in wrapper
      File "d:\OpenERP 6.1-20120615-233338\Server\server.\openerp\sql_db.py", line 212, in execute
    DataError: invalid input syntax for integer: "07/2012"
    系统为xp,可能为日期格式问题,但在6.1.1 版本找不到。



  • 这个必须是BUG... 好象已经修复了.



  • 现在在官网上的是修复版?



  • 经过多日对代码分析,把
            #cr.execute('SELECT code FROM account_period WHERE id = %s', (context['period_id'], ))
    改为:
            cr.execute('SELECT code FROM account_period WHERE name = %s', (context['period_id'], ))
    即可解决。



  • 感谢大柘的分享,问题解决!



  • 在"大柘"和"mrshelly"的帮助和鼓励下,对上面问题进行了简单的分析。
    ---------------------------------------------------------------

    环境:
    oe版本:OpenERP 6.1-20120718-233405
    操作系统:windows xp sp3
    ---------------------------------------------------------------

    第一步:引发错误
    引发错误出现的操作:会计->客户->会计凭证行
    ---------------------------------------------------------------

    第二步:分析比较错误提示
    错误提示见下图"oe6.1.1 打开会计凭证行报错.png"

    通过我的得到的错误提示信息与"大柘"楼上提供的信息进行比较,发现在最后一行存在不同之处
    "大柘":DataError: invalid input syntax for integer: "07/2012"
    我的:DataError: invalid input syntax for integer: "X 08/2012"

    注意到两个"会计期间"的格式不同,一个是"07/2012",一个是"X 08/2012"
    -----------------------------------------------------------------------------

    第三步:查看"会计凭证行"结果显示页面,找出"会计期间"文本框id和name
    结果如下图"会计凭证行页面.fw.png"

    从页面HTML源码中得"会计期间"文本框的id="search_input_many2one_period_id_471"和name="period_id"
    (说明:该页面中的"会计期间"文本框所取的是会计期间的名称,而不是会计期间的编码)
    -----------------------------------------------------------------------------

    第四步:分析数据库中account_period表结构
    结果如下图"数据库中account_period表结构.fw.png"

    通过比较数据库中"表account_period的结构及内容"和oe中"会计->设置->财务会计->会计期间->会计期间"的内容得知两者字段的对应关系如下:
    name->会计期间名称
    code->编码

    (其中account_period表中的"id"字段是serial类型,表示的是表中记录行的序列号)
    --------------------------------------------------------------------------------------------

    第五步:account_move_line.py原码修改
    将语句cr.execute('SELECT code FROM account_period WHERE id = %s', (context['period_id'], ))中的"id"改成"name"



  • 1、通过银行和现金,凭证行,传入period_id的是会计期间,如:08/2012
    2、通过会计凭证,会计凭证,会计凭证行,右边的连接,会计凭证行,传入传入period_id的是account_period表的id
    而比较两者的context,2的情况下context的name值存在,而1的情况则不存在,我的修改方法为:
    一治标、

    <br />&nbsp; &nbsp; &nbsp; &nbsp; j = cr.fetchone()[0] or &#039;&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; if(context.get(&#039;name&#039;, False)):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cr.execute(&#039;SELECT code FROM account_period WHERE id = %s&#039;, (context&#91;&#039;period_id&#039;], ))<br />&nbsp; &nbsp; &nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cr.execute(&#039;SELECT code FROM account_period WHERE name = %s&#039;, (context&#91;&#039;period_id&#039;], ))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; p = cr.fetchone()[0] or &#039;&#039;<br />
    


    二治本(参考论坛的帖子 [检测到链接无效,已移除] br />

    <br />&nbsp; &nbsp; &nbsp; &nbsp; if context.get(&#039;period_id&#039;, False):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; period_id = context.get(&#039;period_id&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if type(period_id) == str or type(period_id) == unicode:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ids = period_obj.search(cr, uid, [(&#039;name&#039;, &#039;ilike&#039;, period_id)])<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.update({<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;period_id&#039;: ids[0]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />&nbsp; &nbsp; &nbsp; &nbsp; return context<br />
    


  • Good ... 好贴....


Log in to reply