changeset 4ded90293407 in modules/stock_assign_manual:default
details:
https://hg.tryton.org/modules/stock_assign_manual?cmd=changeset&node=4ded90293407
description:
Add method to sort quantities for assignation
issue10814
review362811002
diffstat:
stock.py | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diffs (19 lines):
diff -r 97dd291f26c8 -r 4ded90293407 stock.py
--- a/stock.py Mon Oct 04 18:52:01 2021 +0200
+++ b/stock.py Tue Oct 12 00:04:27 2021 +0200
@@ -258,12 +258,10 @@
# Try first to pick from source location
locations.remove(self.move.from_location)
locations.insert(0, self.move.from_location)
- index = {l.id: i for i, l in enumerate(locations)}
places = [(None, '')]
- pbl_items = pbl.items()
- pbl_items = filter(lambda x: x[0][0] in index, pbl_items)
- pbl_items = sorted(pbl_items, key=lambda x: index[x[0][0]])
- for key, qty in pbl_items:
+ quantities = self.move.sort_quantities(
+ pbl.items(), locations, grouping)
+ for key, qty in quantities:
move_key = get_key(self.move, key[0])
if qty > 0 and match(key, move_key):
uom = self.move.product.default_uom