Odoo Help

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

Using Active Record pattern

You can now write using Active Record pattern:

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:

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

From RecordSet

From RecordSet:

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
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.

Odoo Training Center

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

Test it now