From deaeed15cc24b365b8df39cce73f38c05fef2aeb Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 2 Aug 2010 18:01:02 +0530 Subject: [PATCH] [IMP]: usability and code improvement bzr revid: atp@tinyerp.co.in-20100802123102-1x3s6ndjxiib0zmf --- addons/auction/wizard/auction_taken.py | 14 ++++++++------ addons/auction/wizard/auction_taken_view.xml | 15 +++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/addons/auction/wizard/auction_taken.py b/addons/auction/wizard/auction_taken.py index 005fd042646..6beadc6a312 100644 --- a/addons/auction/wizard/auction_taken.py +++ b/addons/auction/wizard/auction_taken.py @@ -38,20 +38,22 @@ class auction_taken(osv.osv_memory): } def _to_xml(s): - return s.replace('&','&').replace('<','<').replace('>','>') + return s.replace('&', '&').replace('<', '<').replace('>', '>') - def process(self, cr, uid, ids, context): + def process(self, cr, uid, ids, context=None): """ - Update Auction lots state to taken_away. + This Function update Auction lots state to taken_away. @param cr: the current row, from the database cursor. @param uid: the current user’s ID for security checks. @param ids: List of Auction taken’s IDs @return: dictionary of lot_ids fields with empty list """ + if not context: + context={} lot_obj = self.pool.get('auction.lots') - for data in self.read(cr, uid, ids): - if data['lot_ids']: - lot_obj.write(cr, uid, data['lot_ids'], {'state':'taken_away'}) + for current in self.browse(cr, uid, ids, context): + for lot in current.lot_ids: + lot_obj.write(cr, uid, lot.id, {'state':'taken_away'}) return {'lot_ids': []} auction_taken() diff --git a/addons/auction/wizard/auction_taken_view.xml b/addons/auction/wizard/auction_taken_view.xml index 626caa473ad..b6d59a3b344 100644 --- a/addons/auction/wizard/auction_taken_view.xml +++ b/addons/auction/wizard/auction_taken_view.xml @@ -8,11 +8,11 @@
- - +