fix patch stock by locations
This commit is contained in:
parent
2921331adc
commit
8836984f3c
|
@ -1,47 +1,47 @@
|
|||
diff -r 4795583a375d move.py
|
||||
--- a/trytond/trytond/modules/stock/move.py Mon Feb 01 12:12:47 2016 +0100
|
||||
+++ b/trytond/trytond/modules/stock/move.py Mon Feb 01 12:16:17 2016 +0100
|
||||
@@ -1136,16 +1136,31 @@
|
||||
diff -r 731d9bf41d33 move.py
|
||||
--- a/trytond/trytond/modules/stock/move.py Mon Feb 08 16:12:29 2016 +0100
|
||||
+++ b/trytond/trytond/modules/stock/move.py Mon Feb 08 16:19:33 2016 +0100
|
||||
@@ -16,6 +16,9 @@
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.config import config
|
||||
+from collections import defaultdict
|
||||
+
|
||||
+
|
||||
DIGITS = config.getint('digits', 'unit_price_digits', 4)
|
||||
|
||||
__all__ = ['StockMixin', 'Move']
|
||||
@@ -1134,18 +1137,25 @@
|
||||
|
||||
product_getter = operator.itemgetter(grouping.index('product') + 1)
|
||||
res_product_ids = set()
|
||||
quantities = {}
|
||||
- quantities = {}
|
||||
+ quantities = defaultdict(lambda: 0)
|
||||
keys = set()
|
||||
- for line in raw_lines:
|
||||
+ # We can do a quick loop without propagation if the request is for a
|
||||
+ # single location because all the locations are children and we can sum
|
||||
+ # them directly.
|
||||
+ if len(location_ids) == 1:
|
||||
+ location, = location_ids
|
||||
+
|
||||
for line in raw_lines:
|
||||
- location = line[0]
|
||||
- key = tuple(line[1:-1])
|
||||
- quantity = line[-1]
|
||||
+ if len(location_ids) > 1:
|
||||
+ location = line[0]
|
||||
key = tuple(line[1:-1])
|
||||
quantity = line[-1]
|
||||
- quantities[(location,) + key] = quantity
|
||||
- res_product_ids.add(product_getter(line))
|
||||
- keys.add(key)
|
||||
+
|
||||
+ if with_childs and len(location_ids) == 1:
|
||||
+ for line in raw_lines:
|
||||
+ location = line[0]
|
||||
+ row_key = tuple(line[1:-1])
|
||||
+ quantity = line[-1]
|
||||
+ key = (location,) + row_key
|
||||
+ if key not in quantities:
|
||||
+ quantities[key] = 0
|
||||
+ quantities[key] += quantity
|
||||
+ res_product_ids.add(product_getter(line))
|
||||
+ keys.add(key)
|
||||
+
|
||||
+ if len(location_ids) > 1:
|
||||
+ for line in raw_lines:
|
||||
+ location = line[0]
|
||||
+ key = tuple(line[1:-1])
|
||||
+ quantity = line[-1]
|
||||
+ quantities[(location,) + key] = quantity
|
||||
+ res_product_ids.add(product_getter(line))
|
||||
+ keys.add(key)
|
||||
+ quantities[(location,) + key] += quantity
|
||||
res_product_ids.add(product_getter(line))
|
||||
keys.add(key)
|
||||
|
||||
# Propagate quantities on from child locations to their parents
|
||||
- if with_childs:
|
||||
+ if with_childs and len(location_ids) > 1:
|
||||
+
|
||||
# Fetch all child locations
|
||||
locations = Location.search([
|
||||
('parent', 'child_of', location_ids),
|
||||
@@ -1184,9 +1199,28 @@
|
||||
@@ -1184,9 +1194,28 @@
|
||||
if location not in location_ids:
|
||||
del quantities[key]
|
||||
|
||||
|
|
6
series
6
series
|
@ -81,7 +81,7 @@ issue4536.diff
|
|||
#incremental_wait_in_retries.diff
|
||||
# Uncomment in calfruitos
|
||||
#issue4727.diff
|
||||
#fix_rounding_in_sync_inventory_to_outgoing.patch
|
||||
fix_rounding_in_sync_inventory_to_outgoing.patch
|
||||
#chart_not_translatable.diff
|
||||
#024726_account_bank_remove_company.diff
|
||||
#024726_account_payment_type_remove_company.diff
|
||||
|
@ -89,7 +89,7 @@ issue4536.diff
|
|||
#stock_lot_fix_pick_product_without_outgoing_moves.diff
|
||||
#purchase_fix_get_move_done_rounding.diff
|
||||
#multicompany_cron.diff
|
||||
#025476_5154_5155_5456_optimize_move_write_assign.diff
|
||||
025476_5154_5155_5456_optimize_move_write_assign.diff
|
||||
#do_not_lock_on_assign_try.diff
|
||||
#limit_invoices_in_creit_note_action_by_domain.diff
|
||||
#move_do_batch_write.diff
|
||||
move_do_batch_write.diff
|
||||
|
|
Loading…
Reference in New Issue