Hello, I have Odoo 8. I am developing a module and I want to override "write" method to check that a special field (for instance: "field_a") not changes after edition. How can I check this?
In the creation the field can assume any value.
Thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello, I have Odoo 8. I am developing a module and I want to override "write" method to check that a special field (for instance: "field_a") not changes after edition. How can I check this?
In the creation the field can assume any value.
Thanks!
José,
Here you go!
def write(cr, uid, ids, vals, context=None):
if not vals.has_key(''field_a):
print "Your Field A is not updated..."
res = super(class_name, self).write(cr, uid, ids, vals, context=context)
return res
This might helps you!
Regards,
Anil.
try this ;
def write(self,cr,uid,ids,vals,context=None): if vals.get('field_a',False): ##### if pass the condition means that 'field_a' has been updated return super(your_class_name, self).write(cr, uid, ids, vals, context=context) |
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
7
Mei 20
|
6298 | ||
|
0
Apr 16
|
2976 | ||
Hide field in a tree view
Diselesaikan
|
|
11
Sep 21
|
31980 | |
Group by on field of a related model.
Diselesaikan
|
|
2
Jan 24
|
14892 | |
|
2
Des 17
|
4086 |