Skip to Content
Menu
This question has been flagged
1 Reply
6525 Views

Get the values during saving data in order to update some records from another model, just to test I've tried this:

@api.multi

def write(self, vals):

_logger.debug('* ONE = %s', vals.get('field_one'))

_logger.debug('* TWO = %s', vals.get('field_two'))

return super(MyModule, self).write(vals)

only field_two is computed on change depending on field_one, the onchange works ok but when click save, I can only get field_one with the new data, but field_two is NONE on the log, I've tested other ways with diferent models and realized that only writes fields that has been changed on the fly, is it posible to get ALL data fields? Am i right by using WRITE() or should I use POST()? how would it be?

Avatar
Discard
Best Answer

Hi,

You can super a write function like this, you have already shown it in question.



Now in your case, if your not getting the value of the field_two in the vals,  try to access it using self.field_two


Also just print the vals , you can see the available data in it.

Thanks

Avatar
Discard
Author

That is right, but if I call self.field_two, it gives the last value saved before write, it still is in doubt how to catch up all values (including computed) by get() on write().

Related Posts Replies Views Activity
2
Oct 21
13992
0
Apr 20
1749
0
Feb 20
5364
3
Jan 18
4542
2
Jul 17
8716