Odoo Help


Odoo 9C: "Add an item" of One2Many behaviour is crazy. [BUG]

on 5/13/16, 5:52 AM 1,148 views

In Odoo 9 Community version:

One2Many record gets created only when a value to any of M2O field is set. Until unless it is not set then odoo doesn't allow you to create that record.

For Instance: Consider the below example:

Line Object has only 3 fields (plus link to its parent object)

1. name (text - non mandatory)

2. qty (float - non mandatory)

3. comment (text - non mandatory)

Odoo did not allow me create this record.

Hence, now I brought another field to this view,

4. uom_id (M2O - non mandatory)

Now after I brought this new field into the view, the minute I supplied a value to this uom_id which happened to a M2O, a record got created.

So by looking at these scenarios,  unless until you set any value to  any M2O field present in the O2M, odoo does not create that record.

So what if my lines doesn't have any M2O type field? then I can never create a record, which is utterly nuisance.

I don't understand why this kind of behaviour is implied, Anybody faced same kind of situation, How do we handle this.

No. There is no any condition like first fill 1st field, probably its due to your code. You can check the Customer invoices in which product_id is the first field and its not required you can add new one2many record without adding product.

Pinakin Nayi (pna)
on 5/13/16, 6:17 AM

@pinakin, Yes even I agree with you, initially I too wondered how could tat be, But later on I realized, some validation is added to check whether any value present in any of M2O field.

on 5/13/16, 6:23 AM

Further, in Invoice Line, account_id is mandatory, hence record gets created, I suggest you to check, by adding non mandatory fields, and try creating a record, without filling data to any of M2O field present in it.

on 5/13/16, 6:25 AM

I guess my question is misleading, will edit it in a better manner.

on 5/13/16, 6:26 AM

yes, its little confusing, I think you have to add details about parent object too and brief explanation about the scenario about object will be helpful. [And please include the code too]. Hope this helps

Baiju KS
on 5/14/16, 7:00 AM

Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 6/21/16, 9:29 AM

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

Question tools

1 follower(s)


Asked: 5/13/16, 5:52 AM
Seen: 1148 times
Last updated: 6/21/16, 9:29 AM