Skip to content

Commit 46ba3c2

Browse files
update delivery_schenker
1 parent e81b8cf commit 46ba3c2

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

delivery_schenker/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "AGPL-3",
1212
"application": False,
1313
"installable": True,
14-
"depends": ["delivery_package_number", "delivery_state"],
14+
"depends": ["delivery_state"],
1515
"external_dependencies": {"python": ["zeep"]},
1616
"data": [
1717
"views/delivery_schenker_view.xml",

delivery_schenker/models/delivery_carrier.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def _schenker_shipping_information_with_packages(self, picking):
404404
for package in picking.package_ids
405405
]
406406

407-
def _schenker_shipping_information_without_packages_volume(self, picking):
407+
def _schenker_shipping_information_without_packages_volume(self, move_lines):
408408
# Obviously products should be well configured. This parameter is mandatory.
409409
return sum(
410410
[
@@ -414,13 +414,14 @@ def _schenker_shipping_information_without_packages_volume(self, picking):
414414
ml.qty_done, ml.product_id.uom_id
415415
),
416416
)
417-
for ml in picking.move_line_ids
417+
for ml in move_lines
418418
if not ml.result_package_id
419419
]
420420
)
421421

422422
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:
424425
return []
425426
weight = picking.shipping_weight or picking.weight
426427
return [
@@ -430,14 +431,14 @@ def _schenker_shipping_information_without_packages(self, picking):
430431
"cargoDesc": picking.name,
431432
# For a more complex solution use packaging properly
432433
"grossWeight": self._schenker_shipping_information_round_weight(
433-
weight / picking.number_of_packages
434+
weight
434435
),
435436
"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)
437438
),
438439
"packageType": self.schenker_default_packaging_id.shipper_package_code,
439440
"stackable": self.schenker_default_packaging_id.schenker_stackable,
440-
"pieces": picking.number_of_packages,
441+
"pieces": 1,
441442
}
442443
]
443444

0 commit comments

Comments
 (0)