From b795c949e68cc593ab5af1e72cb2d147d5b41d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 19 Dec 2013 14:45:23 +0100 Subject: [PATCH] Use a sequence of records, values in write issue3499 review1641003 --- stock.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/stock.py b/stock.py index 542cc76cc1..fcf9adfea9 100644 --- a/stock.py +++ b/stock.py @@ -23,14 +23,17 @@ class ShipmentOut: }) @classmethod - def write(cls, shipments, vals): + def write(cls, *args): pool = Pool() Sale = pool.get('sale.sale') SaleLine = pool.get('sale.line') - super(ShipmentOut, cls).write(shipments, vals) + super(ShipmentOut, cls).write(*args) - if 'state' in vals and vals['state'] in ('done', 'cancel'): + actions = iter(args) + for shipments, values in zip(actions, actions): + if values.get('state') not in ('done', 'cancel'): + continue sales = [] move_ids = [] for shipment in shipments: @@ -70,14 +73,17 @@ class ShipmentOutReturn: }) @classmethod - def write(cls, shipments, vals): + def write(cls, *args): pool = Pool() Sale = pool.get('sale.sale') SaleLine = pool.get('sale.line') - super(ShipmentOutReturn, cls).write(shipments, vals) + super(ShipmentOutReturn, cls).write(*args) - if 'state' in vals and vals['state'] == 'received': + actions = iter(args) + for shipments, values in zip(actions, actions): + if values.get('state') != 'received': + continue sales = [] move_ids = [] for shipment in shipments: