Skip to Content
Menu
This question has been flagged
2 Replies
6812 Views

Hello everyone !

I would like to access the old value that is replaced in write to perform action on a side server from this value (delete it for example) to create one on this side server. I manage to create the new record on my side server but i don't know how to access my old value in write() method.


Any idea of how can i do this ?


Thank you !

Avatar
Discard

Thank you very much ! I don't know what i was thinking not using the self.name !! :)

Best Answer

In write you may access both new and old values:

  1. New values are kept in argument  'values' or 'vals': def write(self,valuse). E.g. values.get("name")

  2. Old values are kept in a database. E.g self.name:


@api.multi

def write (self, values):

for object in self:

     if values.get('name') and object.name != values.get('name'):

             print "new name doesn't equal old name"

Avatar
Discard