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

I added 'A' attribute to sale.order model. I want the server to suggest a particular value for field A (value is computed in a function) based on partner_id value But I want it to be editable and I want no change to occur to already existing records as a result I cant use compute and inverse. what should I do?

thanks in advance.

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

done it like this:

class SaleOrderInherit(models.Model):
_inherit = 'sale.order'

A = fields.Char(string="A", required=True)
@api.onchange('partner_id')
def _set_A(self):
for r in self:
if not r.partner_id:
r.A = ''
else:
            // my case

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 24
2683
0
يناير 24
169
1
أغسطس 21
2267
1
سبتمبر 24
1354
2
أبريل 24
4120