使用 `dp.get_precision('xxx')` 来定义浮点数字段的预设数字精度已经淘汰了
-
在V13以前,我们可以用下面的方法来为浮点数字段设置预设的数字精度:
import odoo.addons.decimal_precision as dp xxx = fields.Float(digits=dp.get_precision("Account"))这个定义对用户很友好,这表示
xxx字段可以使用一个叫Account的浮点数的小数点位数的定义。如果用户对xxx字段的精度不满意,就可以找到Account这个预设精度,改变精度值,xxx字段的精度也相应改变了。没有这个设计,改变浮点数精度必须依赖程序员修改代码。V13把目前的这个定义方式淘汰了,变得更加简单:
xxx = fields.Float(digits="Account")注意没有了
import, 和dp.get_precision
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login