[FIX] delivery: compatibility with batch_picking.

Use case to reproduce:
- Install delivery/batch picking
- Process 2 pickings in a batch.
-> Traceback due to ensure_one.

It happens because the action_done method in delivery is
not multi and batch_picking launch action_done on multiple
picking.

This commit makes action_done in delivery multi.
This commit is contained in:
Arnold Moyaux
2018-02-05 14:03:54 +01:00
parent 2dbc1edef9
commit aed8f45346
+5 -9
View File
@@ -107,16 +107,12 @@ class StockPicking(models.Model):
@api.multi
def action_done(self):
# TDE FIXME: should work in batch
self.ensure_one()
res = super(StockPicking, self).action_done()
if self.carrier_id and self.carrier_id.integration_level == 'rate_and_ship':
self.send_to_shipper()
if self.carrier_id:
self._add_delivery_cost_to_so()
for pick in self:
if pick.carrier_id:
if pick.carrier_id.integration_level == 'rate_and_ship':
pick.send_to_shipper()
pick._add_delivery_cost_to_so()
return res
@api.multi