Merge lp:~acsone-openerp/stock-logistic-warehouse/7.0-inventory-hierarchical-fill2-lga into lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical

Proposed by Laetitia Gangloff (Acsone)
Status: Merged
Approved by: Loïc Bellier - Numérigraphe
Approved revision: 44
Merged at revision: 41
Proposed branch: lp:~acsone-openerp/stock-logistic-warehouse/7.0-inventory-hierarchical-fill2-lga
Merge into: lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical
Diff against target: 493 lines (+363/-18)
12 files modified
stock_inventory_hierarchical_location/__init__.py (+1/-0)
stock_inventory_hierarchical_location/__openerp__.py (+1/-1)
stock_inventory_hierarchical_location/inventory_hierarchical_location.py (+0/-10)
stock_inventory_hierarchical_location/inventory_hierarchical_location_demo.xml (+1/-1)
stock_inventory_hierarchical_location/tests/__init__.py (+39/-0)
stock_inventory_hierarchical_location/tests/fill_inventory_test.py (+118/-0)
stock_inventory_hierarchical_location/wizard/__init__.py (+21/-0)
stock_inventory_hierarchical_location/wizard/stock_fill_location_inventory.py (+89/-0)
stock_inventory_location/__openerp__.py (+3/-3)
stock_inventory_location/stock_inventory_location.py (+4/-3)
stock_inventory_location/tests/__init__.py (+39/-0)
stock_inventory_location/tests/stock_inventory_location_test.py (+47/-0)
To merge this branch: bzr merge lp:~acsone-openerp/stock-logistic-warehouse/7.0-inventory-hierarchical-fill2-lga
Reviewer Review Type Date Requested Status
Loïc Bellier - Numérigraphe code review, testing Approve
Lionel Sausin - Initiatives/Numérigraphe has conflicts Pending
Review via email: mp+222984@code.launchpad.net

This proposal supersedes a proposal from 2014-06-12.

Description of the change

I make some change in the module stock_inventory_hierarchical_location.

The goal is to take account of sub-inventories in case of an exhaustive inventory in two case :

-fill inventory

I also correct a little mistake in demo data of this module.

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

Thanks for your help.
I've just merged our own fixes of the day, will you please merge them to avoid conflicts ?

I think I understand what you're trying to do in fill_inventory and it's not exactly how we had it in v6 - which is broken right now in v7, and would require a patch on the code addons.
Your patch completely excludes the locations of sub-inventories, whereas we used to only exclude the generated inventory lines. That would allow us to "catch" the lines that could have been missing from sub-inventories, but since they're exhaustive anyway there should not be any.
So I guess your approach is correct.
I'll let Loïc decide, he's working on the problem too.

review: Needs Resubmitting (has conflicts)
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) : Posted in a previous version of this proposal
review: Needs Fixing (has conflicts)
Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I redo a branch based on your last version (38).

So this one contains change for fill inventory. The fill inventory, is used when confirm inventory or when click on button.

In case of confirm inventory, the sub-inventory are already confirmed -> no missing lines.

In case of click on button, it is true that we can have some missing lines, but the confirmation, is not possible (sub-inventories are not confirmed). I think it is 'dangerous' if lines are added, because the confirmation on sub-inventory will also add these lines !

Maybe can we prevent this action when sub-inventories are not confirmed ? (like confirm)

40. By Laetitia Gangloff (Acsone)

stock_inventory_location : use SUPERUSER for check in stock.location and stock.move

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I complete this mp, with the user of SUPERUSER for check on stock.location and stock.move.
It is in the module stock_inventory_location.

A user with no access to stock.inventory, have acl error with these check. And record rules can give wrong result.

41. By Laetitia Gangloff (Acsone)

stock_inventory_location : avoid recursive write on stock.location

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I resolve another problem on the write of stock_location.
There is a "RuntimeError: maximum recursion depth exceeded" when change location_id. ids was just assigned in ids_to_check so, when ids_to_check change, ids change too and the write is not done with right parameter.

42. By Laetitia Gangloff (Acsone)

stock_inventory_hierarchical_location : in fill inventory, if exclude location is empty do not add it in domain

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

Following Loïc's test, in fill inventory I remove the exclude clause when location list to exclude is empty.

43. By Laetitia Gangloff (Acsone)

stock_inventory_hierarchical_location : remove unused method _fill_location_lines

44. By Laetitia Gangloff (Acsone)

stock_inventory_hierarchical_location: fill_inventory ignore no product exception in case of an exhaustive inventory

Revision history for this message
Loïc Bellier - Numérigraphe (lb-b) wrote :

After lot's of test, your module seems to work !

review: Approve (code review, testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock_inventory_hierarchical_location/__init__.py'
2--- stock_inventory_hierarchical_location/__init__.py 2014-06-12 12:48:28 +0000
3+++ stock_inventory_hierarchical_location/__init__.py 2014-06-13 13:19:05 +0000
4@@ -19,3 +19,4 @@
5 ##############################################################################
6
7 from . import inventory_hierarchical_location
8+from . import wizard
9
10=== modified file 'stock_inventory_hierarchical_location/__openerp__.py'
11--- stock_inventory_hierarchical_location/__openerp__.py 2014-06-10 14:04:38 +0000
12+++ stock_inventory_hierarchical_location/__openerp__.py 2014-06-13 13:19:05 +0000
13@@ -43,6 +43,6 @@
14 "data": [
15 "inventory_hierarchical_location_view.xml",
16 ],
17- "test": ["test/inventory_hierarchical_location_test.yml"],
18+ "test": ["tests/inventory_hierarchical_location_test.yml"],
19 "demo": ["inventory_hierarchical_location_demo.xml"],
20 }
21
22=== modified file 'stock_inventory_hierarchical_location/inventory_hierarchical_location.py'
23--- stock_inventory_hierarchical_location/inventory_hierarchical_location.py 2014-06-12 12:48:28 +0000
24+++ stock_inventory_hierarchical_location/inventory_hierarchical_location.py 2014-06-13 13:19:05 +0000
25@@ -86,13 +86,3 @@
26 "It cannot be added.")}
27 }
28 return {}
29-
30- def _fill_location_lines(self, cr, uid, inventory_id, location_ids,
31- set_stock_zero, context=None):
32- """Add ids of children inventory into list """
33- children_inventory_ids = self.search(
34- cr, uid, [('parent_id', 'child_of', inventory_id)])
35- context['children_inventory_ids'] = children_inventory_ids
36- return super(HierarchicalExhInventory, self)._fill_location_lines(
37- cr, uid, inventory_id, location_ids, set_stock_zero,
38- context=context)
39
40=== modified file 'stock_inventory_hierarchical_location/inventory_hierarchical_location_demo.xml'
41--- stock_inventory_hierarchical_location/inventory_hierarchical_location_demo.xml 2014-06-12 16:40:46 +0000
42+++ stock_inventory_hierarchical_location/inventory_hierarchical_location_demo.xml 2014-06-13 13:19:05 +0000
43@@ -22,7 +22,7 @@
44 <record id="child_2_id" model="stock.inventory">
45 <field name="name">Team B</field>
46 <field name="parent_id" ref="parent_inventory"/>
47- <field name="location_id" model="stock.location" search="stock.stock_location_components"/>
48+ <field name="location_id" model="stock.location" ref="stock.stock_location_components"/>
49 </record>
50 </data>
51 </openerp>
52
53=== renamed directory 'stock_inventory_hierarchical_location/test' => 'stock_inventory_hierarchical_location/tests'
54=== added file 'stock_inventory_hierarchical_location/tests/__init__.py'
55--- stock_inventory_hierarchical_location/tests/__init__.py 1970-01-01 00:00:00 +0000
56+++ stock_inventory_hierarchical_location/tests/__init__.py 2014-06-13 13:19:05 +0000
57@@ -0,0 +1,39 @@
58+# -*- coding: utf-8 -*-
59+#
60+#
61+# Authors: Laetitia Gangloff
62+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
63+# All Rights Reserved
64+#
65+# WARNING: This program as such is intended to be used by professional
66+# programmers who take the whole responsibility of assessing all potential
67+# consequences resulting from its eventual inadequacies and bugs.
68+# End users who are looking for a ready-to-use solution with commercial
69+# guarantees and support are strongly advised to contact a Free Software
70+# Service Company.
71+#
72+# This program is free software: you can redistribute it and/or modify
73+# it under the terms of the GNU Affero General Public License as
74+# published by the Free Software Foundation, either version 3 of the
75+# License, or (at your option) any later version.
76+#
77+# This program is distributed in the hope that it will be useful,
78+# but WITHOUT ANY WARRANTY; without even the implied warranty of
79+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80+# GNU Affero General Public License for more details.
81+#
82+# You should have received a copy of the GNU Affero General Public License
83+# along with this program. If not, see <http://www.gnu.org/licenses/>.
84+#
85+#
86+
87+import fill_inventory_test
88+
89+fast_suite = [
90+]
91+
92+checks = [
93+ fill_inventory_test,
94+]
95+
96+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
97
98=== added file 'stock_inventory_hierarchical_location/tests/fill_inventory_test.py'
99--- stock_inventory_hierarchical_location/tests/fill_inventory_test.py 1970-01-01 00:00:00 +0000
100+++ stock_inventory_hierarchical_location/tests/fill_inventory_test.py 2014-06-13 13:19:05 +0000
101@@ -0,0 +1,118 @@
102+# -*- coding: utf-8 -*-
103+#
104+#
105+# Authors: Laetitia Gangloff
106+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
107+# All Rights Reserved
108+#
109+# WARNING: This program as such is intended to be used by professional
110+# programmers who take the whole responsibility of assessing all potential
111+# consequences resulting from its eventual inadequacies and bugs.
112+# End users who are looking for a ready-to-use solution with commercial
113+# guarantees and support are strongly advised to contact a Free Software
114+# Service Company.
115+#
116+# This program is free software: you can redistribute it and/or modify
117+# it under the terms of the GNU Affero General Public License as
118+# published by the Free Software Foundation, either version 3 of the
119+# License, or (at your option) any later version.
120+#
121+# This program is distributed in the hope that it will be useful,
122+# but WITHOUT ANY WARRANTY; without even the implied warranty of
123+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124+# GNU Affero General Public License for more details.
125+#
126+# You should have received a copy of the GNU Affero General Public License
127+# along with this program. If not, see <http://www.gnu.org/licenses/>.
128+#
129+#
130+
131+import openerp.tests.common as common
132+
133+DB = common.DB
134+ADMIN_USER_ID = common.ADMIN_USER_ID
135+
136+
137+class fill_inventory_test(common.TransactionCase):
138+
139+ def setUp(self):
140+ super(fill_inventory_test, self).setUp()
141+
142+ def test_missing_location(self):
143+ """
144+ Test that when confirm a parent inventory, the child location are not in the confirmation result
145+ """
146+ parent_inventory_id = self.ref('stock_inventory_hierarchical_location.parent_inventory')
147+ self.registry('stock.inventory').action_open(self.cr, self.uid, [parent_inventory_id])
148+ # confirm shelf 1 inventory
149+ inventory_id = self.ref('stock_inventory_hierarchical_location.child_2_id')
150+ self.registry('stock.inventory').action_open(self.cr, self.uid, [inventory_id])
151+ missing_location = self.registry('stock.inventory').get_missing_locations(self.cr, self.uid, [inventory_id])
152+ self.assertEqual(len(missing_location), 1, "1 missing location should be find, because the inventory is empty")
153+ wizard_id = self.registry('stock.inventory.uninventoried.locations').create(self.cr, self.uid, {}, context={'active_ids': [inventory_id]})
154+ self.registry('stock.inventory.uninventoried.locations').confirm_uninventoried_locations(self.cr, self.uid, wizard_id, context={'active_ids': [inventory_id]})
155+ missing_location = self.registry('stock.inventory').get_missing_locations(self.cr, self.uid, [inventory_id])
156+ self.assertEqual(len(missing_location), 0, "No missing location should be find, because the inventory is confirmed")
157+ # confirm shelf 2 inventory
158+ inventory_id = self.ref('stock_inventory_hierarchical_location.child_1_id')
159+ self.registry('stock.inventory').action_open(self.cr, self.uid, [inventory_id])
160+ missing_location = self.registry('stock.inventory').get_missing_locations(self.cr, self.uid, [inventory_id])
161+ self.assertEqual(len(missing_location), 1, "1 missing location should be fine, because the inventory is empty")
162+ self.registry('stock.inventory.line').create(self.cr, self.uid, {'product_id': self.ref('product.product_product_7'),
163+ 'product_uom': self.ref('product.product_uom_unit'),
164+ 'company_id': self.ref('base.main_company'),
165+ 'inventory_id': inventory_id,
166+ 'product_qty': 18.0,
167+ 'location_id': self.ref('stock.stock_location_14')})
168+ missing_location = self.registry('stock.inventory').get_missing_locations(self.cr, self.uid, [inventory_id])
169+ self.assertEqual(len(missing_location), 0, "No missing location should be find, because the inventory is filled")
170+ wizard_id = self.registry('stock.inventory.uninventoried.locations').create(self.cr, self.uid, {}, context={'active_ids': [inventory_id]})
171+ wizard = self.registry('stock.inventory.uninventoried.locations').browse(self.cr, self.uid, wizard_id, context={'active_ids': [inventory_id]})
172+ self.assertEqual(len(wizard.location_ids), 0, "The wizard should not contain any lines but contains %s." % wizard.location_ids)
173+ self.registry('stock.inventory.uninventoried.locations').confirm_uninventoried_locations(self.cr, self.uid, wizard_id, context={'active_ids': [inventory_id]})
174+ # confirm parent inventory
175+ missing_location = self.registry('stock.inventory').get_missing_locations(self.cr, self.uid, [parent_inventory_id])
176+ self.assertEqual(len(missing_location), 1, "Only 1 missing location should be find, because there is some location in child inventory")
177+
178+ def test_fill_inventory(self):
179+ """
180+ Test that when fill a parent inventory, the child location are not in the result
181+ """
182+ parent_inventory_id = self.ref('stock_inventory_hierarchical_location.parent_inventory')
183+ self.registry('stock.inventory').action_open(self.cr, self.uid, [parent_inventory_id])
184+ # confirm shelf 1 inventory
185+ inventory_id = self.ref('stock_inventory_hierarchical_location.child_2_id')
186+ self.registry('stock.inventory').action_open(self.cr, self.uid, [inventory_id])
187+ wizard_id = self.registry('stock.fill.inventory').create(self.cr, self.uid, {'location_id': self.ref('stock.stock_location_components'),
188+ 'recursive': True,
189+ 'exhaustive': True,
190+ 'set_stock_zero': True}, context={'active_ids': [inventory_id]})
191+ self.registry('stock.fill.inventory').fill_inventory(self.cr, self.uid, [wizard_id], context={'active_ids': [inventory_id]})
192+ inventory_line_ids = self.registry('stock.inventory.line').search(self.cr, self.uid, [('inventory_id', '=', inventory_id)])
193+ self.assertEqual(len(inventory_line_ids), 12, "12 inventory line is fount after filling inventory")
194+ # confirm shelf 2 inventory
195+ inventory_id = self.ref('stock_inventory_hierarchical_location.child_1_id')
196+ self.registry('stock.inventory').action_open(self.cr, self.uid, [inventory_id])
197+ wizard_id = self.registry('stock.fill.inventory').create(self.cr, self.uid, {'location_id': self.ref('stock.stock_location_14'),
198+ 'recursive': True,
199+ 'exhaustive': True,
200+ 'set_stock_zero': True}, context={'active_ids': [inventory_id]})
201+ self.registry('stock.fill.inventory').fill_inventory(self.cr, self.uid, [wizard_id], context={'active_ids': [inventory_id]})
202+ inventory_line_ids = self.registry('stock.inventory.line').search(self.cr, self.uid, [('inventory_id', '=', inventory_id)])
203+ self.assertEqual(len(inventory_line_ids), 4, "1 inventory line is fount after filling inventory")
204+ # confirm parent inventory
205+ wizard_id = self.registry('stock.fill.inventory').create(self.cr, self.uid, {'location_id': self.ref('stock.stock_location_stock'),
206+ 'recursive': True,
207+ 'exhaustive': True,
208+ 'set_stock_zero': True}, context={'active_ids': [parent_inventory_id]})
209+ try:
210+ self.registry('stock.fill.inventory').fill_inventory(self.cr, self.uid, [wizard_id], context={'active_ids': [parent_inventory_id]})
211+ except Exception, e:
212+ self.assertEqual(e.value, 'No product in this location. Please select a location in the product form.', "The message should be ''No product in this location. Please select a location in the product form.''")
213+ exception_happened = True
214+ pass
215+ self.assertTrue(exception_happened)
216+ inventory_line_ids = self.registry('stock.inventory.line').search(self.cr, self.uid, [('inventory_id', '=', parent_inventory_id)])
217+ self.assertEqual(len(inventory_line_ids), 0, "No inventory line is fount after filling inventory")
218+
219+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
220
221=== added directory 'stock_inventory_hierarchical_location/wizard'
222=== added file 'stock_inventory_hierarchical_location/wizard/__init__.py'
223--- stock_inventory_hierarchical_location/wizard/__init__.py 1970-01-01 00:00:00 +0000
224+++ stock_inventory_hierarchical_location/wizard/__init__.py 2014-06-13 13:19:05 +0000
225@@ -0,0 +1,21 @@
226+# -*- coding: utf-8 -*-
227+##############################################################################
228+#
229+# This module is copyright (C) 2013 Numérigraphe SARL. All Rights Reserved.
230+#
231+# This program is free software: you can redistribute it and/or modify
232+# it under the terms of the GNU General Public License as published by
233+# the Free Software Foundation, either version 3 of the License, or
234+# (at your option) any later version.
235+#
236+# This program is distributed in the hope that it will be useful,
237+# but WITHOUT ANY WARRANTY; without even the implied warranty of
238+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
239+# GNU General Public License for more details.
240+#
241+# You should have received a copy of the GNU General Public License
242+# along with this program. If not, see <http://www.gnu.org/licenses/>.
243+#
244+##############################################################################
245+
246+from . import stock_fill_location_inventory
247
248=== added file 'stock_inventory_hierarchical_location/wizard/stock_fill_location_inventory.py'
249--- stock_inventory_hierarchical_location/wizard/stock_fill_location_inventory.py 1970-01-01 00:00:00 +0000
250+++ stock_inventory_hierarchical_location/wizard/stock_fill_location_inventory.py 2014-06-13 13:19:05 +0000
251@@ -0,0 +1,89 @@
252+# -*- coding: utf-8 -*-
253+#
254+#
255+# Authors: Laetitia Gangloff
256+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
257+# All Rights Reserved
258+#
259+# WARNING: This program as such is intended to be used by professional
260+# programmers who take the whole responsibility of assessing all potential
261+# consequences resulting from its eventual inadequacies and bugs.
262+# End users who are looking for a ready-to-use solution with commercial
263+# guarantees and support are strongly advised to contact a Free Software
264+# Service Company.
265+#
266+# This program is free software: you can redistribute it and/or modify
267+# it under the terms of the GNU Affero General Public License as
268+# published by the Free Software Foundation, either version 3 of the
269+# License, or (at your option) any later version.
270+#
271+# This program is distributed in the hope that it will be useful,
272+# but WITHOUT ANY WARRANTY; without even the implied warranty of
273+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
274+# GNU Affero General Public License for more details.
275+#
276+# You should have received a copy of the GNU Affero General Public License
277+# along with this program. If not, see <http://www.gnu.org/licenses/>.
278+#
279+#
280+
281+from openerp.osv import orm
282+from openerp.tools.translate import _
283+
284+
285+class FillInventoryWizard(orm.TransientModel):
286+ """If inventory as sub inventories, do not fill with sub inventories location"""
287+ _inherit = 'stock.fill.inventory'
288+
289+ def fill_inventory(self, cr, uid, ids, context=None):
290+ """ To Import stock inventory according to products available in the location and not already in a sub inventory
291+
292+ We split fill_inventory on many fill_inventory (one for each location)
293+ @param self: The object pointer.
294+ @param cr: A database cursor
295+ @param uid: ID of the user currently logged in
296+ @param ids: the ID or list of IDs if we want more than one
297+ @param context: A standard dictionary
298+ @return:
299+ """
300+ if context is None:
301+ context = {}
302+
303+ if ids and len(ids):
304+ ids = ids[0]
305+ else:
306+ return {'type': 'ir.actions.act_window_close'}
307+ fill_inventory = self.browse(cr, uid, ids, context=context)
308+ if fill_inventory.recursive and fill_inventory.exhaustive:
309+ exclude_location_ids = []
310+ for i in self.pool['stock.inventory'].browse(cr, uid, context['active_ids']):
311+ for sub_inventory in i.inventory_ids:
312+ # exclude these location
313+ exclude_location_ids.append(sub_inventory.location_id.id)
314+ domain = [('location_id', 'child_of', [fill_inventory.location_id.id])]
315+ if exclude_location_ids:
316+ domain.append('!')
317+ domain.append(('location_id', 'child_of', exclude_location_ids))
318+ location_ids = self.pool['stock.location'].search(cr, uid, domain,
319+ order="id",
320+ context=context)
321+ all_in_exception = 0
322+ for location_id in location_ids:
323+ try:
324+ super(FillInventoryWizard, self).fill_inventory(cr, uid,
325+ [self.copy(cr, uid, ids, {'location_id': location_id,
326+ 'recursive': False, }, context=context)],
327+ context=context)
328+ except Exception, e:
329+ if e.value == _('No product in this location. Please select a location in the product form.'):
330+ all_in_exception = all_in_exception + 1
331+ pass
332+ else:
333+ raise e
334+ if all_in_exception == len(location_ids):
335+ raise orm.except_orm(_('Warning!'), _('No product in this location. Please select a location in the product form.'))
336+ return {'type': 'ir.actions.act_window_close'}
337+ else:
338+ return super(FillInventoryWizard, self).fill_inventory(cr, uid, [ids], context=context)
339+
340+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
341
342=== modified file 'stock_inventory_location/__openerp__.py'
343--- stock_inventory_location/__openerp__.py 2014-06-10 16:02:09 +0000
344+++ stock_inventory_location/__openerp__.py 2014-06-13 13:19:05 +0000
345@@ -62,9 +62,9 @@
346 "wizard/stock_fill_location_inventory_view.xml",
347 ],
348 "test": [
349- "test/inventory_standard_test.yml",
350- "test/inventory_exhaustive_test.yml",
351- "test/inventory_future_test.yml",
352+ "tests/inventory_standard_test.yml",
353+ "tests/inventory_exhaustive_test.yml",
354+ "tests/inventory_future_test.yml",
355 ],
356 "images": [
357 "images/inventory_form.png",
358
359=== modified file 'stock_inventory_location/stock_inventory_location.py'
360--- stock_inventory_location/stock_inventory_location.py 2014-06-12 16:49:28 +0000
361+++ stock_inventory_location/stock_inventory_location.py 2014-06-13 13:19:05 +0000
362@@ -27,6 +27,7 @@
363 # TODOv8! remove, feature is included upstream
364 from openerp.osv import osv
365 from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
366+from openerp import SUPERUSER_ID
367
368 from .exceptions import ExhaustiveInventoryException
369
370@@ -270,7 +271,7 @@
371 """Error if an exhaustive Inventory is being conducted here"""
372 inv_obj = self.pool['stock.inventory']
373 location_inventory_open_ids = inv_obj._get_locations_open_inventories(
374- cr, uid, context=context)
375+ cr, SUPERUSER_ID, context=context)
376 if not isinstance(ids, Iterable):
377 ids = [ids]
378 for inv_id in ids:
379@@ -286,7 +287,7 @@
380 self._check_inventory(cr, uid, ids, context=context)
381 if not isinstance(ids, Iterable):
382 ids = [ids]
383- ids_to_check = ids
384+ ids_to_check = list(ids)
385 # If changing the parent, no inventory must conducted there either
386 if vals.get('location_id'):
387 ids_to_check.append(vals['location_id'])
388@@ -326,7 +327,7 @@
389 message = ""
390 inv_obj = self.pool['stock.inventory']
391 locked_location_ids = inv_obj._get_locations_open_inventories(
392- cr, uid, context=context)
393+ cr, SUPERUSER_ID, context=context)
394 if not locked_location_ids:
395 # Nothing to verify
396 return True
397
398=== renamed directory 'stock_inventory_location/test' => 'stock_inventory_location/tests'
399=== added file 'stock_inventory_location/tests/__init__.py'
400--- stock_inventory_location/tests/__init__.py 1970-01-01 00:00:00 +0000
401+++ stock_inventory_location/tests/__init__.py 2014-06-13 13:19:05 +0000
402@@ -0,0 +1,39 @@
403+# -*- coding: utf-8 -*-
404+#
405+#
406+# Authors: Laetitia Gangloff
407+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
408+# All Rights Reserved
409+#
410+# WARNING: This program as such is intended to be used by professional
411+# programmers who take the whole responsibility of assessing all potential
412+# consequences resulting from its eventual inadequacies and bugs.
413+# End users who are looking for a ready-to-use solution with commercial
414+# guarantees and support are strongly advised to contact a Free Software
415+# Service Company.
416+#
417+# This program is free software: you can redistribute it and/or modify
418+# it under the terms of the GNU Affero General Public License as
419+# published by the Free Software Foundation, either version 3 of the
420+# License, or (at your option) any later version.
421+#
422+# This program is distributed in the hope that it will be useful,
423+# but WITHOUT ANY WARRANTY; without even the implied warranty of
424+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
425+# GNU Affero General Public License for more details.
426+#
427+# You should have received a copy of the GNU Affero General Public License
428+# along with this program. If not, see <http://www.gnu.org/licenses/>.
429+#
430+#
431+
432+import stock_inventory_location_test
433+
434+fast_suite = [
435+]
436+
437+checks = [
438+ stock_inventory_location_test,
439+]
440+
441+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
442
443=== added file 'stock_inventory_location/tests/stock_inventory_location_test.py'
444--- stock_inventory_location/tests/stock_inventory_location_test.py 1970-01-01 00:00:00 +0000
445+++ stock_inventory_location/tests/stock_inventory_location_test.py 2014-06-13 13:19:05 +0000
446@@ -0,0 +1,47 @@
447+# -*- coding: utf-8 -*-
448+#
449+#
450+# Authors: Laetitia Gangloff
451+# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
452+# All Rights Reserved
453+#
454+# WARNING: This program as such is intended to be used by professional
455+# programmers who take the whole responsibility of assessing all potential
456+# consequences resulting from its eventual inadequacies and bugs.
457+# End users who are looking for a ready-to-use solution with commercial
458+# guarantees and support are strongly advised to contact a Free Software
459+# Service Company.
460+#
461+# This program is free software: you can redistribute it and/or modify
462+# it under the terms of the GNU Affero General Public License as
463+# published by the Free Software Foundation, either version 3 of the
464+# License, or (at your option) any later version.
465+#
466+# This program is distributed in the hope that it will be useful,
467+# but WITHOUT ANY WARRANTY; without even the implied warranty of
468+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
469+# GNU Affero General Public License for more details.
470+#
471+# You should have received a copy of the GNU Affero General Public License
472+# along with this program. If not, see <http://www.gnu.org/licenses/>.
473+#
474+#
475+
476+import openerp.tests.common as common
477+
478+DB = common.DB
479+ADMIN_USER_ID = common.ADMIN_USER_ID
480+
481+
482+class stock_inventory_location_test(common.TransactionCase):
483+
484+ def setUp(self):
485+ super(stock_inventory_location_test, self).setUp()
486+
487+ def test_update_parent_location(self):
488+ """
489+ Test the update of the parent of a location (no inventory in progress
490+ """
491+ self.registry('stock.location').write(self.cr, self.uid, self.ref('stock.stock_location_5'), {'location_id': self.ref('stock.stock_location_4')})
492+
493+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches