Odoo Aide


1 Réponse
Adan Cortes Medina Mexique
29/11/2016 14:36

If you want to create one or more new records, issue a 0 command like this:

other_table_record1 = { 'field1': value11, 'field2': value12}
other_table_record2 = { 'field1': value21, 'field2': value22}
record_to_update = { 'some_field': 'value', ...
    'other_table_ids': [(0,0,other_table_record1),(0,0,other_table_record2)] # Must be a list, so keep the square brackets

So, in short:

  • 0 commands must be given as a list of triplets

  • In each triplet, the 1st element is 0 and 3rd element must be a dictionary

Reference: BaseModel write method in models.py (around line 3438)

Poser une question
Keep Informed
1 Abonné(e)s
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