跳至內容
選單
此問題已被標幟
3 回覆
273 瀏覽次數

Hi, I have a issue with odoo12 while returning product with BoM setup.

  1. Assuming product relation: Wine Bottle *4 (consumable)= Wine Case (Stockable), with KIT BoM Type.


2. When I create a order with Wine Bottle *4,and finished the delivery order as well.


3. NOW I want to return 2 Bottle Wine and finish the return order.


4. As returned 2 Bottle wine, delivery Qty should be reduced to 2, but the result is 0.00  Showed below.


5. MY Question: IS IT a bug with the BoM. If it is and How to fix it. Thank you.

PS: I have updated the core code from github.

頭像
捨棄
作者 最佳答案

Thanks for your help.

Here is the code to update delivery Qty. Who can help to fix it. Thank you.

    @api.multi
@api.depends('move_ids.state', 'move_ids.scrapped', 'move_ids.product_uom_qty', 'move_ids.product_uom')
def _compute_qty_delivered(self):
super(SaleOrderLine, self)._compute_qty_delivered()

for line in self: # TODO: maybe one day, this should be done in SQL for performance sake
if line.qty_delivered_method == 'stock_move':
qty = 0.0
for move in line.move_ids.filtered(lambda r: r.state == 'done' and not r.scrapped and line.product_id == r.product_id):
if move.location_dest_id.usage == "customer":
if not move.origin_returned_move_id or (move.origin_returned_move_id and move.to_refund):
qty += move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
elif move.location_dest_id.usage != "customer" and move.to_refund:
qty -= move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
line.qty_delivered = qty
頭像
捨棄
最佳答案

The relationship between bottles and case as you mention is 4 bottles = 1. case.

In this relationship, when 4 bottles are ordered 1 case was delivered, there are no bottles. Hence the return is only for case.

With your relationship a case can be directly sold.

If your product is ‘Wine with case’ then the KiT BoM components would need to be 4 bottles and 1 case.

This would create delivery of 4 bottles and 1 case, subsequently bottles and or case can returned.

Not sure if my understanding of your product to sell is accurate.

頭像
捨棄
最佳答案

Hi,

Please refer to the module:

1. https://apps.odoo.com/apps/modules/18.0/sale_line_returned_qty_mrp

This module improves how returned quantities are computed on sales order lines when using Kit BOMs.


Hope it helps



頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
8月 22
6606
2
12月 23
15479
0
10月 23
33
3
10月 23
790
1
10月 23
569