콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
7951 화면

I am trying to create a module that creates new type of product, the new type act as a bundle of products, so that when this bundle is selected in the purchase order , it is automatically removed and replaced by all the products in the bundle. instead of selecting each product manually.


right now I'm stuck in the on_change function of product id to remove the bundle and add its child products

if product.is_package:
     for child_product in product.product_ids:
         active_id = context.get('active_id', [])
         line_vals = {'product_id' : child_product.product_id,}
         order_lines = []
         order_lines = order_lines.append([0,False,line_vals])
         po_line_obj = self.pool.get('purchase.order.line')
         po_line_id = po_line_obj.write(cr,uid,active_id, {'order_line' : order_lines})

But it isn't working any clue ?

아바타
취소
베스트 답변

Odoo have almost same functionality...if you are aware of the BOM type 'Set', it will be easy.
Suppose you have a product 'ABC' with a type 'Set' BOM contains products A ,B & C
When you make a sale order for ABC Sale order line will remain as ABC, But the delivery of ABC will be as a set of product A, B & C.

So i hope you can use the same method with slight modification for your case

아바타
취소
베스트 답변

In the first step, you create a line, like:

line_id = po_line_obj.create(cr, uid, line_vals, context=context)

then you can manipulate it.

아바타
취소
관련 게시물 답글 화면 활동
1
3월 15
3064
1
5월 24
1524
3
2월 24
2149
2
11월 22
11533
1
12월 16
5586