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

I have a computed field (store=True) in sale.order which simply shows percentage of the Total amount

the exact percentage I have defined in sale.config.settings

default_percentage = fields.Float(default_model='sale.order')

then in sale.order I use it like this:

percentage = fields.Monetary(compute='_compute_percentage', store=True)       
def _compute_percentage(self):
percentage = self.env['ir.values'].get_default('sale.order', 'percentage') ...

How can I update (recalculate) the field when I change the value in sale.config.settings

Right now the only way to do it is to change a line in the order and save again. I use Store=True because I use the field for sale reports

 


الصورة الرمزية
إهمال
أفضل إجابة

in sales, when you define such things and applied to sale, meant to be kept as is. unless you are willing to update all of those things, write a routine which is triggered after the field value change.

الصورة الرمزية
إهمال
الكاتب

Is it gonna change something if I have the field not stored in the DB?

your original scenario says stored. that's not my problem. totally yours and you don't seem to know what you are doing.

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أغسطس 23
2455
1
يوليو 23
2381
1
يونيو 21
3263
0
مارس 15
3795
3
سبتمبر 23
2601