@@ -404,7 +404,7 @@ def _schenker_shipping_information_with_packages(self, picking):
404
404
for package in picking .package_ids
405
405
]
406
406
407
- def _schenker_shipping_information_without_packages_volume (self , picking ):
407
+ def _schenker_shipping_information_without_packages_volume (self , move_lines ):
408
408
# Obviously products should be well configured. This parameter is mandatory.
409
409
return sum (
410
410
[
@@ -414,13 +414,16 @@ def _schenker_shipping_information_without_packages_volume(self, picking):
414
414
ml .qty_done , ml .product_id .uom_id
415
415
),
416
416
)
417
- for ml in picking . move_line_ids
417
+ for ml in move_lines
418
418
if not ml .result_package_id
419
419
]
420
420
)
421
421
422
422
def _schenker_shipping_information_without_packages (self , picking ):
423
- if all (move_line .result_package_id for move_line in picking .move_line_ids ):
423
+ move_lines_without_package = picking .move_line_ids .filtered (
424
+ lambda ml : not ml .result_package_id
425
+ )
426
+ if not move_lines_without_package :
424
427
return []
425
428
weight = picking .shipping_weight or picking .weight
426
429
return [
@@ -429,15 +432,15 @@ def _schenker_shipping_information_without_packages(self, picking):
429
432
"dgr" : False ,
430
433
"cargoDesc" : picking .name ,
431
434
# For a more complex solution use packaging properly
432
- "grossWeight" : self ._schenker_shipping_information_round_weight (
433
- weight / picking .number_of_packages
434
- ),
435
+ "grossWeight" : self ._schenker_shipping_information_round_weight (weight ),
435
436
"volume" : self ._schenker_shipping_information_round_volume (
436
- self ._schenker_shipping_information_without_packages_volume (picking )
437
+ self ._schenker_shipping_information_without_packages_volume (
438
+ move_lines_without_package
439
+ )
437
440
),
438
441
"packageType" : self .schenker_default_packaging_id .shipper_package_code ,
439
442
"stackable" : self .schenker_default_packaging_id .schenker_stackable ,
440
- "pieces" : picking . number_of_packages ,
443
+ "pieces" : 1 ,
441
444
}
442
445
]
443
446
0 commit comments