diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py index 231802bcba4..11d177e45f7 100644 --- a/addons/auction/wizard/auction_lots_make_invoice.py +++ b/addons/auction/wizard/auction_lots_make_invoice.py @@ -42,16 +42,14 @@ class auction_lots_make_invoice(osv.osv_memory): @return: A dictionary which of fields with values. """ - res = {} - res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context) - record_id = context and context.get('active_id',False) - if not record_id: - return res + res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context) + for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])): + if 'amount' in fields: + res.update({'amount': lot.buyer_price}) + if 'objects' in fields: + res.update({'objects': len(context['active_ids'])}) + return res - lot= self.pool.get('auction.lots').browse(cr, uid, record_id) - res['amount']=lot.buyer_price - res['objects'] = len(context['active_ids']) - return res def makeInvoices(self, cr, uid, ids, context): """ diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py index 71a4563812b..6173c7d8b77 100644 --- a/addons/auction/wizard/auction_lots_make_invoice_buyer.py +++ b/addons/auction/wizard/auction_lots_make_invoice_buyer.py @@ -41,16 +41,14 @@ class auction_lots_make_invoice_buyer(osv.osv_memory): @return: A dictionary which of fields with values. """ - res = {} - record_id = context and context.get('active_id',False) res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context) - if not record_id: - return res - - lot= self.pool.get('auction.lots').browse(cr, uid, record_id) - res['amount']=lot.buyer_price - res['buyer_id']=lot.ach_uid and lot.ach_uid.id or False - res['objects'] = len(context['active_ids']) + for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])): + if 'amount' in fields: + res.update({'amount': lot.buyer_price}) + if 'buyer_id' in fields: + res.update({'buyer_id': lot.ach_uid and lot.ach_uid.id or False}) + if 'objects' in fields: + res.update({'objects': len(context['active_ids'])}) return res def makeInvoices(self, cr, uid, ids, context): diff --git a/addons/auction/wizard/auction_lots_sms_send.py b/addons/auction/wizard/auction_lots_sms_send.py index 3b26f2a914f..a5736ce4990 100644 --- a/addons/auction/wizard/auction_lots_sms_send.py +++ b/addons/auction/wizard/auction_lots_sms_send.py @@ -54,7 +54,6 @@ class auction_lots_sms_send(osv.osv_memory): partner_address_obj = self.pool.get('res.partner.address') for datas in self.read(cr, uid, ids): lots = lot_obj.read(cr, uid, context['active_ids'], ['obj_num','obj_price','ach_uid']) - print "lots",lots, [l['ach_uid'][0] for l in lots if l['ach_uid']] res = partner_obj.read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context) nbr = 0 diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py index 919d62cce66..bd0a026d2ba 100644 --- a/addons/auction/wizard/auction_pay_buy.py +++ b/addons/auction/wizard/auction_pay_buy.py @@ -42,20 +42,14 @@ class auction_pay_buy(osv.osv_memory): @return: A dictionary which of fields with values. """ - res = {} - res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context) - record_id = context and context.get('active_id',False) - if not record_id: - return res - - lot= self.pool.get('auction.lots').browse(cr, uid, record_id) - if lot.is_ok : - raise osv.except_osv('Error !', 'Some lots of the selection are already paid.') - - res['amount']=lot.buyer_price - res['total']=lot.buyer_price - res['buyer_id']=lot.ach_uid and lot.ach_uid.id or False - res['objects'] = len(context['active_ids']) + res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context) + for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])): + if 'amount' in fields: + res.update({'amount': lot.buyer_price}) + if 'buyer_id' in fields: + res.update({'buyer_id': lot.ach_uid and lot.ach_uid.id or False}) + if 'total' in fields: + res.update({'total': lot.buyer_price}) return res def pay_and_reconcile(self, cr, uid, ids, context):