7
7
inventory_state = self.read(cr, uid, [ref('inventory_exhaustive')], ['state'])[0]['state']
8
8
assert inventory_state == 'open', "Inventory in state '%s'. It should be 'open'" % inventory_state
10
I will check that the function get_missing_locations return some locations.
12
!python {model: stock.inventory}: |
13
missing_loc_ids = self.get_missing_locations(cr, uid, [ref('inventory_exhaustive')], context=context)
14
assert len(missing_loc_ids), "get_missing_locations did not return any ID."
10
16
I create a wizard record for stock_confirm_uninventoried_location to verify that it contains the uninventoried locations
12
18
!python {model: stock.inventory.uninventoried.locations}: |
50
56
The function must return True in the first case, and return a warning dictionnary in the second test.
52
58
!python {model: stock.inventory.line}: |
53
res = self.onchange_location_id(cr, uid, [], [(6,0,[ref('stock.stock_location_14')])], True, ref('stock.stock_location_14'))
59
res = self.onchange_location_id(cr, uid, [], ref('stock.stock_location_14'), True, ref('stock.stock_location_14'))
54
60
assert res == True, "Exhaustive: The function 'onchange_location_id' should return True and return '%s'" % res
55
res = self.onchange_location_id(cr, uid, [], [(6,0,[ref('stock.stock_location_14')])], True, ref('stock.stock_location_components'))
61
res = self.onchange_location_id(cr, uid, [], ref('stock.stock_location_14'), True, ref('stock.stock_location_components'))
56
62
assert res.get('warning', False) != False , "Function 'onchange_location_id': Warning not raise. ('%s)" % res
65
I will check that the function get_missing_locations does not return any locations.
67
!python {model: stock.inventory}: |
68
missing_loc_ids = self.get_missing_locations(cr, uid, [ref('inventory_exhaustive')], context=context)
69
assert not missing_loc_ids, "get_missing_locations should not return IDs but returned %s" % missing_loc_ids
59
71
I create a wizard record for stock_confirm_uninventoried_location and validate it
61
73
!python {model: stock.inventory.uninventoried.locations}: |
88
100
!python {model: stock.inventory}: |
89
101
self.action_confirm(cr, uid, [ref('inventory_exhaustive')])
90
102
inventory_state = self.read(cr, uid, [ref('inventory_exhaustive')], ['state'])[0]['state']
91
assert inventory_state == 'confirm', "Exhaustive inventory have '%s' state. It should be 'confirm'" % inventory_state
103
assert inventory_state == 'confirm', "Exhaustive inventory is in state '%s'. It should be 'confirm'" % inventory_state
94
106
I will validate the exhaustive inventory
96
108
!python {model: stock.inventory}: |
97
109
self.action_done(cr, uid, [ref('inventory_exhaustive')])
98
110
inventory_state = self.read(cr, uid, [ref('inventory_exhaustive')], ['state'])[0]['state']
99
assert inventory_state == 'done', "Exhaustive inventory have '%s' state. It should be 'done'" % inventory_state
111
assert inventory_state == 'done', "Exhaustive inventory is in state '%s'. It should be 'done'" % inventory_state
102
114
I will verify the quantity for each products.