Odoo Help

0
2 Answers
0
Haresh Kansara
3/14/19, 1:55 PM

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

Ask a Question
Writer
Tag
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now