コンテンツへスキップ
メニュー
この質問にフラグが付けられました
6 返信
4182 ビュー

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

著作者

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.

著作者

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

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

著作者 最善の回答

Problem resolved:

https://github.com/odoo/odoo/issues/12461

アバター
破棄
関連投稿 返信 ビュー 活動
1
7月 17
4260
1
10月 16
11397
1
1月 16
14169
1
1月 25
1602
0
9月 23
1851