Merge lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical-location-fix-subinventory-locations into lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical

Proposed by Lionel Sausin - Initiatives/Numérigraphe
Status: Merged
Merged at revision: 44
Proposed branch: lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical-location-fix-subinventory-locations
Merge into: lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical
Diff against target: 40 lines (+16/-3)
2 files modified
stock_inventory_hierarchical_location/inventory_hierarchical_location.py (+16/-2)
stock_inventory_location/stock_inventory_location.py (+0/-1)
To merge this branch: bzr merge lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical-location-fix-subinventory-locations
Reviewer Review Type Date Requested Status
Laetitia Gangloff (Acsone) Pending
Numérigraphe Pending
Review via email: mp+224770@code.launchpad.net

Description of the change

tentative fix to take subinventories into account when validating an exhaustive structured inventory

To post a comment you must log in.
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

fixes the warning popup but still tries to insert wrong lines.
I'll fix it now.

46. By Numérigraphe

[FIX] do not fail when there are no subinventories (leaf or non-hierarchical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock_inventory_hierarchical_location/inventory_hierarchical_location.py'
2--- stock_inventory_hierarchical_location/inventory_hierarchical_location.py 2014-06-13 11:31:30 +0000
3+++ stock_inventory_hierarchical_location/inventory_hierarchical_location.py 2014-06-27 10:17:42 +0000
4@@ -48,8 +48,22 @@
5 """Extend the list of inventories with their children"""
6 ids = self.search(
7 cr, uid, [('parent_id', 'child_of', ids)], context=context)
8- return super(HierarchicalExhInventory, self).get_missing_locations(
9- cr, uid, ids, context=context)
10+ missing_ids = super(HierarchicalExhInventory,
11+ self).get_missing_locations(
12+ cr, uid, ids, context=context)
13+ # Find the locations already included in sub-inventories
14+ inventories = self.browse(cr, uid, ids, context=context)
15+ subinv_location_ids = [sub.location_id.id
16+ for i in inventories
17+ for sub in i.inventory_ids]
18+ if not subinv_location_ids:
19+ return missing_ids
20+ # Extend to the children locations
21+ subinv_location_ids = set(self.pool['stock.location'].search(
22+ cr, uid, [
23+ ('location_id', 'child_of', subinv_location_ids),
24+ ('usage', '=', 'internal')], context=context))
25+ return list(set(missing_ids) - subinv_location_ids)
26
27 # TODO v8: probably only keep the state "done"
28 def confirm_missing_locations(self, cr, uid, ids, context=None):
29
30=== modified file 'stock_inventory_location/stock_inventory_location.py'
31--- stock_inventory_location/stock_inventory_location.py 2014-06-20 11:57:10 +0000
32+++ stock_inventory_location/stock_inventory_location.py 2014-06-27 10:17:42 +0000
33@@ -266,7 +266,6 @@
34 _inherit = 'stock.location'
35 _order = 'name'
36
37- # TODOv7: why not put this in an ORM "_constraint" instead?
38 def _check_inventory(self, cr, uid, ids, context=None):
39 """Error if an exhaustive Inventory is being conducted here"""
40 inv_obj = self.pool['stock.inventory']

Subscribers

People subscribed via source and target branches