تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7409 أدوات العرض

Hello,

I want to override the price field from decimal.precision, but It didn't work with that:

Why is that so? Can someone help me?

Edit: Is the _name variable required when I only want to override a field on a model? 


from odoo import api, fields, models, tools, _
import odoo.addons.decimal_precision as dp


class SupplierInfo(models.Model):
_inherit = 'product.supplierinfo'

price = fields.Float('Price', default=0.0, digits=dp.get_precision('Product Buy Price'), required=True, help="The price to purchase a PRODUCT")
الصورة الرمزية
إهمال
أفضل إجابة
I have tried your code in my local and its working fine as I have changed label by "price" to "price123" and it is working fine you just need to restart the server and upgrade module.

Hope this will help you.
Thanks.
الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 17
3475
7
أكتوبر 18
10432
2
سبتمبر 18
5952
1
أبريل 18
9523
1
أبريل 18
3393