@@ -15,11 +15,14 @@ def setUpClass(cls):
1515 {"name" : "product to repair" , "type" : "product" }
1616 )
1717 cls .product_c = cls .env ["product.product" ].create (
18- {"name" : "product to consume" , "type" : "product" }
18+ {"name" : "product to consume" , "type" : "product" , "tracking" : "lot" }
1919 )
2020 cls .product_c_2 = cls .env ["product.product" ].create (
2121 {"name" : "product to consume 2" , "type" : "product" }
2222 )
23+ cls .lot = cls .env ["stock.lot" ].create (
24+ {"name" : "lot" , "product_id" : cls .product_c .id }
25+ )
2326 cls .warehouse = cls .env ["stock.warehouse" ].create (
2427 {"name" : "WH" , "code" : "wh_test" }
2528 )
@@ -75,7 +78,7 @@ def setUpClass(cls):
7578 cls .product , cls .prep_loc , 1.0
7679 )
7780 cls .env ["stock.quant" ]._update_available_quantity (
78- cls .product_c , cls .stock_loc , 10.0
81+ cls .product_c , cls .stock_loc , 10.0 , lot_id = cls . lot
7982 )
8083 cls .env ["stock.quant" ]._update_available_quantity (
8184 cls .product_c_2 , cls .stock_loc , 10.0
@@ -146,7 +149,7 @@ def test_write_done_move_not_allowed(self):
146149 self .test_validate_runs_procurement ()
147150 self ._do_picking (self .repair .preparation_picking_ids )
148151 self .assertEqual (self .repair .preparation_picking_ids .state , "done" )
149- with self .assertRaisesRegexp (
152+ with self .assertRaisesRegex (
150153 ValidationError ,
151154 "You cannot modify product/quantity for preparation lines "
152155 "because some linked moves are already done" ,
@@ -171,14 +174,14 @@ def test_write_repair_line_cancels_and_reprocures(self):
171174
172175 def test_action_repair_end_checks (self ):
173176
174- with self .assertRaisesRegexp (
177+ with self .assertRaisesRegex (
175178 ValidationError ,
176179 "Preparation picking not found. Please procure/prepare parts first" ,
177180 ):
178181 self .repair .action_repair_end ()
179182 self .repair .action_validate ()
180183 self .repair .action_repair_start ()
181- with self .assertRaisesRegexp (
184+ with self .assertRaisesRegex (
182185 ValidationError , "Preparation picking is not done yet"
183186 ):
184187 self .repair .action_repair_end ()
@@ -198,8 +201,14 @@ def test_preparation_disabled(self):
198201 self .repair .action_validate ()
199202 self .assertFalse (self .repair .preparation_picking_ids )
200203 self .repair .action_repair_start ()
201- self .repair .action_repair_end ()
202- self .repair .action_repair_done ()
203- self .assertEqual (self .repair .state , "done" )
204204 self .assertFalse (self .line .preparation_move_ids )
205- self .assertTrue (self .line .move_id )
205+
206+ def test_update_repair_line_after_preparation (self ):
207+ self .test_validate_runs_procurement ()
208+ self .line .location_id = self .stock_loc
209+ self .assertFalse (self .line .lot_id )
210+ move_line = self .repair .preparation_picking_ids .move_line_ids
211+ self .assertEqual (move_line .lot_id , self .lot )
212+ self ._do_picking (self .repair .preparation_picking_ids )
213+ self .assertEqual (self .line .location_id , self .prep_loc )
214+ self .assertEqual (self .line .lot_id , self .lot )
0 commit comments