Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

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

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

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

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

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

    Openerp中的小数精度问题

    Odoo 新手求助
    5
    7
    6446
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 1
      1348647581qq.com last edited by

          我需要变单价的精度。我到product.product表中偷看标价的定义:

      'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), help="Base price to compute the customer price. Sometimes called the catalog price."),
      


      对get_Precision的参数:Product Price莫名其妙。于是在开发群中得到joshua,shelly,ccdos,冰之星辰,东莞周等前辈的建议,发现oe单独开了一个模块来控制小数的精度:decimal_precision模块。在该模块中的py文件中,我找到了函数get_precision的定义:

      <br />&nbsp; &nbsp; def precision_get(self, cr, uid, application):<br />&nbsp; &nbsp; &nbsp; &nbsp; cr.execute(&#039;select digits from decimal_precision where name=%s&#039;, (application,))<br />&nbsp; &nbsp; &nbsp; &nbsp; res = cr.fetchone()<br />&nbsp; &nbsp; &nbsp; &nbsp; return res[0] if res else 2<br /><br />def get_precision(application):<br />&nbsp; &nbsp; def change_digit(cr):<br />&nbsp; &nbsp; &nbsp; &nbsp; res = pooler.get_pool(cr.dbname).get(&#039;decimal.precision&#039;).precision_get(cr, SUPERUSER_ID, application)<br />&nbsp; &nbsp; &nbsp; &nbsp; return (16, res)<br />&nbsp; &nbsp; return change_digit
      


      也明白了为什么默认精度是2位:(有源码就是幸福)

      _defaults = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;digits&#039;: 2,<br />&nbsp; &nbsp; }
      



      另外:用户界面的操作是:设置-数据库-小数精度

      ps.每一个在群里得到自己问题答案的人,都有义务发相关帖,以帮助更多人。

      1 Reply Last reply Reply Quote 0
      • wjfonhand
        wjfonhand last edited by

        这里的name叫application,真是贪大啊

        谢谢分享

        1 Reply Last reply Reply Quote 0
        • K
          klm2242 last edited by

          谢谢分享

          1 Reply Last reply Reply Quote 0
          • X
            xuzan last edited by

            为什么我的用户界面设置进去没有数据库选项的

            1 Reply Last reply Reply Quote 0
            • Z
              zzsu last edited by

              设置-会计-凭证簿分录小数精度
              倒是可以调整,但似乎不影响单价。单价还是两位。

              求前辈解惑!谢谢。

              1 Reply Last reply Reply Quote 0
              • Z
                zzsu last edited by

                [quote author=xuzan link=topic=11922.msg29115#msg29115 date=1412897574]
                为什么我的用户界面设置进去没有数据库选项的
                [/quote]

                需要打开用户的“技术特性”设置。
                https://www.odoo.com/forum/help-1/question/how-to-change-products-cost-decimal-precision-1299

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post