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

Hi how to use write method in odoo 9 updates a field one form to another form updating from existing fields please explain with example

Avatar
Discard

Please provide the example of what you intend to do. That would be helpful for the one to give the proper answer.

Best Answer

Using Active Record pattern

You can now write using Active Record pattern:

@api.one
def any_write(self):
  self.x = 1
  self.name = 'a'

More info about the subtility of the Active Record write pattern here https://goo.gl/2HdgUr

The classical way of writing is still available


From Record

From Record:

@api.one
...
self.write({'key': value })
# or
record.write({'key': value})

From RecordSet

From RecordSet:

@api.multi
...
self.write({'key': value })
# It will write on all record.
self.line_ids.write({'key': value })

It will write on all Records of the relation line_ids

For more detail: https://goo.gl/qGruPb

Accept and upvote answer if helpful

Thanks and Regards

Haresh Kansara

Avatar
Discard
Related Posts Replies Views Activity
3
Aug 24
5504
4
Jul 24
38818
5
Apr 23
93749
3
Nov 22
2957
3
Aug 22
3040