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

When I try to update a field before raising a UserError, the value doesn't get saved to the database. How can I ensure the field is saved even before the UserError is raised?

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

We can use 

self.env.cr.commit()

just before the UserError() to save the values.

Eg:

self.env.cr.commit()
raise UserError('Some issue has been occured')
الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 18
5185
0
يونيو 21
6371
1
نوفمبر 22
5657
1
أكتوبر 21
3309
2
نوفمبر 18
10215