Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7945 Lượt xem

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.

    Ảnh đại diện
    Huỷ bỏ
    Câu trả lời hay nhất

    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

    Ảnh đại diện
    Huỷ bỏ
    Tác giả Câu trả lời hay nhất

    Thanks  a lot

    Ảnh đại diện
    Huỷ bỏ
    Bài viết liên quan Trả lời Lượt xem Hoạt động
    1
    thg 11 18
    6256
    1
    thg 4 16
    4458
    1
    thg 6 15
    4293
    1
    thg 6 15
    3189
    0
    thg 3 15
    3405