@@ -228,7 +228,6 @@ class ShopfloorMenu(models.Model):
228
228
allow_alternative_destination_package_is_possible = fields .Boolean (
229
229
compute = "_compute_allow_alternative_destination_package_is_possible"
230
230
)
231
-
232
231
move_line_search_additional_domain_is_possible = fields .Boolean (
233
232
compute = "_compute_move_line_search_additional_domain_is_possible"
234
233
)
@@ -250,6 +249,16 @@ class ShopfloorMenu(models.Model):
250
249
move_line_search_sort_order_custom_code = fields .Text (
251
250
string = "Custom sort key code" , help = "Python code to sort move lines. "
252
251
)
252
+ require_destination_package = fields .Boolean (
253
+ string = "Destination package required" ,
254
+ default = True ,
255
+ help = "If set, the user will have to scan only the source location "
256
+ "and the destination location to process a line. The unload step will be skipped." ,
257
+ )
258
+
259
+ require_destination_package_is_possible = fields .Boolean (
260
+ compute = "_compute_require_destination_package_is_possible"
261
+ )
253
262
254
263
@api .onchange ("unload_package_at_destination" )
255
264
def _onchange_unload_package_at_destination (self ):
@@ -267,6 +276,16 @@ def _onchange_pick_pack_same_time(self):
267
276
record .unload_package_at_destination = False
268
277
record .multiple_move_single_pack = False
269
278
279
+ @api .onchange ("require_destination_package" )
280
+ def _onchange_require_destination_package (self ):
281
+ # require_destination_package is incompatible with pick_pack_same_time and
282
+ # unload_package_at_destination and multiple_move_single_pack
283
+ for record in self :
284
+ if not record .require_destination_package :
285
+ record .pick_pack_same_time = False
286
+ record .unload_package_at_destination = False
287
+ record .multiple_move_single_pack = False
288
+
270
289
@api .onchange ("multiple_move_single_pack" )
271
290
def _onchange_multiple_move_single_pack (self ):
272
291
# multiple_move_single_pack is incompatible with pick_pack_same_time,
@@ -278,6 +297,7 @@ def _onchange_multiple_move_single_pack(self):
278
297
"unload_package_at_destination" ,
279
298
"pick_pack_same_time" ,
280
299
"multiple_move_single_pack" ,
300
+ "require_destination_package" ,
281
301
)
282
302
def _check_options (self ):
283
303
if self .pick_pack_same_time and self .unload_package_at_destination :
@@ -294,6 +314,19 @@ def _check_options(self):
294
314
"'Multiple moves same destination package'."
295
315
)
296
316
)
317
+ elif not self .require_destination_package and (
318
+ self .pick_pack_same_time
319
+ or self .unload_package_at_destination
320
+ or self .multiple_move_single_pack
321
+ ):
322
+ raise exceptions .UserError (
323
+ _ (
324
+ "'No destination package required' is incompatible with "
325
+ "'Pick and pack at the same time',"
326
+ "'Unload package at destination' and 'Multiple moves "
327
+ "same destination package'."
328
+ )
329
+ )
297
330
298
331
@api .depends ("scenario_id" , "picking_type_ids" )
299
332
def _compute_move_create_is_possible (self ):
@@ -497,6 +530,13 @@ def _compute_move_line_search_sort_order_is_possible(self):
497
530
"allow_move_line_search_sort_order"
498
531
)
499
532
533
+ @api .depends ("scenario_id" )
534
+ def _compute_require_destination_package_is_possible (self ):
535
+ for menu in self :
536
+ menu .require_destination_package_is_possible = menu .scenario_id .has_option (
537
+ "require_destination_package"
538
+ )
539
+
500
540
@api .constrains (
501
541
"move_line_search_sort_order" , "move_line_search_sort_order_custom_code"
502
542
)
0 commit comments