Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
3 Respostas
149 Visualizações

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.

Avatar
Cancelar
Autor Melhor resposta

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
Avatar
Cancelar
Melhor resposta

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.

Avatar
Cancelar
Melhor resposta

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



Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
ago. 22
6489
2
dez. 23
15286
0
out. 23
33
3
out. 23
790
1
out. 23
569