[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.
This commit is contained in:
Pierre Masereel
2017-01-03 17:53:37 +01:00
parent d744f8d912
commit be58a61717
+2 -4
View File
@@ -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: