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

I want to create a new manufacturing order, and fill its fields from the external API.

The problem is that the onchange method does not trigger when filling the product_id field. I wanted it to automatically fill its BoM list.


Does anyone have a hint on this?


Thanks

アバター
破棄
最善の回答

You need to declare the BoM before you create the Manufacturing Order. Have you tried this?

Edit:

The products must be declared before as well.

What we do is: 

a) Create parent product (the one containing the BOM) [product.template]. 

b) Create child products (the ones inside the BOM) [product.template]. 

c) Create the BOM [mrp.bom]. 

d) Create the BOM lines [mrp.bom.line].


Hope that clarifies something.


And about the on change part. You should call it like this:

@api.onchange('partner_id')

def your_func():


'partner_id' is just an example, you need to find your object. I think you need 'product_tmpl_id' from mrp.bom.

アバター
破棄
著作者

The BoM is already created for the product. Even when I write on the 'BoM_id' field, the one2many 'components' field below stays empty

関連投稿 返信 ビュー 活動
2
4月 24
7751
1
8月 23
1987
5
11月 23
8907
1
7月 23
2483
1
2月 23
2251