File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 11from . import data
22from . import schema
33from . import message
4+ from . import stock
Original file line number Diff line number Diff line change 1+ from odoo .addons .component .core import Component
2+
3+
4+ class StockAction (Component ):
5+ """Provide methods to work with stock operations."""
6+
7+ _inherit = "shopfloor.stock.action"
8+
9+ def unmark_move_line_as_picked (self , move_lines ):
10+ res = super ().unmark_move_line_as_picked (move_lines )
11+ move_lines .write ({"lot_id" : False })
12+ return res
Original file line number Diff line number Diff line change @@ -169,3 +169,31 @@ def test_cancel_action(self):
169169 )
170170 # This line has been created by shopfloor, therefore, we unlinked it
171171 self .assertFalse (move_line_user_2 .exists ())
172+
173+ def test_cancel_action_clears_lot (self ):
174+ product = self .selected_move_line .product_id
175+ product .sudo ().tracking = "lot"
176+ self .picking .sudo ().picking_type_id .use_create_lots = True
177+
178+ response = self .service .dispatch (
179+ "set_lot_confirm_action" ,
180+ params = {
181+ "picking_id" : self .picking .id ,
182+ "selected_line_id" : self .selected_move_line .id ,
183+ "lot_name" : "FooBar" ,
184+ "expiration_date" : "2022-08-24T12:00:00" ,
185+ },
186+ )
187+ self .assertEqual (response .get ("next_state" ), "set_quantity" )
188+ self .assertEqual (self .selected_move_line .lot_id .name , "FooBar" )
189+
190+ response = self .service .dispatch (
191+ "set_quantity__cancel_action" ,
192+ params = {
193+ "picking_id" : self .picking .id ,
194+ "selected_line_id" : self .selected_move_line .id ,
195+ },
196+ )
197+ self .assertFalse (
198+ self .selected_move_line .lot_id , "Cancel action should clear the lot"
199+ )
You can’t perform that action at this time.
0 commit comments