mirror of
https://gitlab.com/datalifeit/trytond-stock_distribute_kit
synced 2023-12-14 04:42:58 +01:00
Productos que ocupan espacio pueden ser kit o formar parte de uno.
This commit is contained in:
parent
e06feed860
commit
c7e4b62d98
16
stock.py
16
stock.py
|
@ -25,15 +25,23 @@ class Move:
|
|||
result = super(Move, cls).distribute(moves, order)
|
||||
|
||||
kits = {}
|
||||
# dictionary with product.id as key an list of location-quantity tuple as value
|
||||
# dictionary with kit product.id as key an list of location-quantity tuple as value
|
||||
for m in result:
|
||||
if not m.product.kit or not m.product.occupy_space:
|
||||
if not m.product.occupy_space:
|
||||
continue
|
||||
kits.setdefault(m.product.id, [])
|
||||
kits[m.product.id].append((m.to_location.id, Uom.compute_qty(m.uom, m.quantity, m.product.default_uom)))
|
||||
kit_id = m.product.id
|
||||
if not m.product.kit:
|
||||
kit_line = KitLine.search([('product', '=', m.product.id)],
|
||||
limit=1)
|
||||
if not kit_line:
|
||||
continue
|
||||
kit_id = kit_line[0].parent.id
|
||||
kits.setdefault(kit_id, [])
|
||||
kits[kit_id].append((m.to_location.id, Uom.compute_qty(m.uom, m.quantity, m.product.default_uom)))
|
||||
|
||||
new_moves = []
|
||||
discard_moves = []
|
||||
# distributes non spacial products according to kit
|
||||
for m in result:
|
||||
if m.product.occupy_space:
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue