跳至内容
菜单
此问题已终结
2 回复
7892 查看

Hello, 

Good day to all!

please, can someone help solve this below issue : Thanks!



i am using odoo 13 in windows 10. and i am trying to make a book price field with below code for my library app :

MY MODEL .PY FILE IS AS BELOW :


from odoo import models, fields

from odoo.addons import decimal_precision as dp


class LibraryBook(models.Model):

    cost_price = fields.Float(

        'Book Cost', digits=dp.get_precision('Book Price'))

------------------------------------------------------------------------------------

MY LIBRARY_BOOK.XML FILE IS AS BELOW :

<field name="cost_price"/>


    when i upgrade i get below error.

    形象
    丢弃
    最佳答案

    Hi,

    in odoo13 there is no module named decimlal_precision , it has got merged in base. Open the manifest file and remove the dependency, decimlal_precision  given.


    And in the model.py file, remove this import,

    from odoo.addons import decimal_precision as dp


    and you can define the field like this,

    price_unit = fields.Float('Unit Price', required=True, digits='Product Price', default=0.0)

    and if you are new to odoo development, check this: Odoo13 Development Tutorials


    Thanks

    形象
    丢弃
    编写者 最佳答案

    Thanks  a lot

    形象
    丢弃
    相关帖文 回复 查看 活动
    1
    11月 18
    6220
    1
    4月 16
    4447
    1
    6月 15
    4262
    1
    6月 15
    3178
    0
    3月 15
    3389