From be58a61717e5ea270d280f145de7b7a54bd34745 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Tue, 3 Jan 2017 15:24:02 +0100 Subject: [PATCH] [IMP] delivery: send only new package with packaging_id to carrier Because now the carrier id is set on all picking from the same procurement group, we want to call the carrier API only when there are some package with a packaging_id set on it. --- addons/delivery/models/stock_picking.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index 22bc35971db..ebe6dc06b38 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -60,10 +60,8 @@ class StockPicking(models.Model): self.ensure_one() packs = set() for packop in self.pack_operation_ids: - if packop.result_package_id: + if packop.result_package_id and packop.result_package_id.packaging_id: packs.add(packop.result_package_id.id) - elif packop.package_id and not packop.product_id: - packs.add(packop.package_id.id) self.package_ids = list(packs) @api.one @@ -112,7 +110,7 @@ class StockPicking(models.Model): self.ensure_one() res = super(StockPicking, self).do_transfer() - if self.carrier_id and self.carrier_id.delivery_type not in ['fixed', 'base_on_rule'] and self.carrier_id.integration_level == 'rate_and_ship': + if self.carrier_id and self.carrier_id.delivery_type not in ['fixed', 'base_on_rule'] and self.carrier_id.integration_level == 'rate_and_ship' and self.package_ids: self.send_to_shipper() if self.carrier_id: