Community mailing list archives

One2many fields are broken... and now you could fix them, so please do

- 09/21/2016 05:01:43
After some big recent work with one2many fields and lots of headaches, I came up realizing it was not my mind but Odoo that was broken.
  1. Sometimes odoo tries to add to a one2many field a record that it previously deleted (yes, not you, it).
  2. When you add newid records to a one2many, and odoo writes them to database, it does not update cache, so you still have the newid records in the field, while they should have ids and be persistent.
  3. When your one2many field has a lambda domain, Odoo evaluates it with a different `self` for reading and for writing.

Problems 1 and 2 are fixed in (v9, but they should backport the fix).

Problem 3 is fixed in

This is a call to Odoo people to please pay some attention to those PRs, at least thinking on the mental health of all the community developers 😁

We all know v10 is coming, so merging those before would ensure v10 gets sensible o2m fields again (if they ever were).

Apart from this, there are other problems, like and, but given those could be somehow intentional, by design, or at least they don't have a pull request opened including tests and green bots like the others do, I understand they stay open.

Thank you!

Jairo Llopis