@@ -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,14 @@ 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 (lambda ml : not ml .result_package_id )
424
+ if not move_lines_without_package :
424
425
return []
425
426
weight = picking .shipping_weight or picking .weight
426
427
return [
@@ -430,14 +431,14 @@ def _schenker_shipping_information_without_packages(self, picking):
430
431
"cargoDesc" : picking .name ,
431
432
# For a more complex solution use packaging properly
432
433
"grossWeight" : self ._schenker_shipping_information_round_weight (
433
- weight / picking . number_of_packages
434
+ weight
434
435
),
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 (move_lines_without_package )
437
438
),
438
439
"packageType" : self .schenker_default_packaging_id .shipper_package_code ,
439
440
"stackable" : self .schenker_default_packaging_id .schenker_stackable ,
440
- "pieces" : picking . number_of_packages ,
441
+ "pieces" : 1 ,
441
442
}
442
443
]
443
444
0 commit comments