From edeff81c49cfefe130127c4b8b61ee976019f310 Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Mon, 5 Apr 2010 15:44:12 +0530 Subject: [PATCH] [IMP] auction: Code optimization and improvements. bzr revid: uco@tinyerp.co.in-20100405101412-9vemft1la0018i46 --- addons/auction/auction.py | 40 +++++----- .../wizard/auction_catalog_flagey_report.py | 18 ++++- .../wizard/auction_lots_auction_move.py | 24 +++--- addons/auction/wizard/auction_lots_enable.py | 12 +-- .../wizard/auction_lots_make_invoice.py | 77 +++++++++---------- .../wizard/auction_lots_make_invoice_buyer.py | 63 +++++++-------- addons/auction/wizard/auction_pay_buy.py | 62 +++++++-------- addons/auction/wizard/auction_pay_sel.py | 30 +++----- addons/auction/wizard/auction_payer_sel.py | 7 -- addons/auction/wizard/auction_taken.py | 6 +- .../wizard/auction_transfer_unsold_object.py | 22 +++--- 11 files changed, 165 insertions(+), 196 deletions(-) diff --git a/addons/auction/auction.py b/addons/auction/auction.py index 854c917ee68..cf5f27775df 100644 --- a/addons/auction/auction.py +++ b/addons/auction/auction.py @@ -96,15 +96,16 @@ class auction_dates(osv.osv): """ # objects vendus mais non factures #TODO: convert this query to tiny API + lots_obj = self.pool.get('auction.lots') cr.execute('select count(*) as c from auction_lots where auction_id =ANY(%s) and state=%s and obj_price>0', (ids,'draft',)) nbr = cr.fetchone()[0] ach_uids = {} cr.execute('select id from auction_lots where auction_id =ANY(%s) and state=%s and obj_price>0', (ids,'draft',)) - r=self.pool.get('auction.lots').lots_invoice(cr, uid, [x[0] for x in cr.fetchall()],{},None) + r = lots_obj.lots_invoice(cr, uid, [x[0] for x in cr.fetchall()],{},None) cr.execute('select id from auction_lots where auction_id =ANY(%s) and obj_price>0',(ids,)) ids2 = [x[0] for x in cr.fetchall()] # for auction in auction_ids: - c=self.pool.get('auction.lots').seller_trans_create(cr, uid, ids2,{}) + c = lots_obj.seller_trans_create(cr, uid, ids2,{}) self.write(cr, uid, ids, {'state':'closed'}) #close the auction return True auction_dates() @@ -509,14 +510,14 @@ class auction_lots(osv.osv): ##CHECKME: est-ce que ca vaudrait la peine de faire des groupes de lots qui ont les memes couts pour passer des listes de lots a compute? taxes = [] amount=0.0 - # pt_tax=pool.get('account.tax') + pt_tax = self.pool.get('account.tax') for lot in lots: taxes = lot.product_id.taxes_id if lot.author_right: taxes.append(lot.author_right) elif lot.auction_id: taxes += lot.auction_id.buyer_costs - tax=self.pool.get('account.tax').compute(cr,uid,taxes,lot.obj_price,1) + tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1) for t in tax: amount+=t['amount'] #amount+=lot.obj_price*0.2 @@ -631,18 +632,20 @@ class auction_lots(osv.osv): def buyer_proforma(self,cr,uid,ids,context): invoices = {} - inv_ref=self.pool.get('account.invoice') + inv_ref = self.pool.get('account.invoice') + partner_r = self.pool.get('res.partner') + inv_line_obj = self.pool.get('account.invoice.line') + wf_service = netsvc.LocalService('workflow') # acc_receiv=self.pool.get('account.account').search([cr,uid,[('code','=','4010')]]) for lot in self.browse(cr,uid,ids,context): if not lot.obj_price>0: continue - partner_r=self.pool.get('res.partner') if not lot.ach_uid.id: raise orm.except_orm(_('Missed buyer !'), _('The object "%s" has no buyer assigned.') % (lot.name,)) else: partner_ref =lot.ach_uid.id lot_name = lot.obj_num - res = self.pool.get('res.partner').address_get(cr, uid, [partner_ref], ['contact', 'invoice']) + res = partner_r.address_get(cr, uid, [partner_ref], ['contact', 'invoice']) contact_addr_id = res['contact'] invoice_addr_id = res['invoice'] if not invoice_addr_id: @@ -676,12 +679,11 @@ class auction_lots(osv.osv): 'account_id': lot.auction_id.acc_income.id, 'price_unit': lot.obj_price, } - self.pool.get('account.invoice.line').create(cr, uid, inv_line,context) + inv_line_obj.create(cr, uid, inv_line,context) # inv_ref.button_compute(cr, uid, [inv_id]) # wf_service = netsvc.LocalService('workflow') # wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr) inv_ref.button_compute(cr, uid, invoice.values()) - wf_service = netsvc.LocalService('workflow') wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_proforma', cr) return invoices.values() @@ -695,6 +697,9 @@ class auction_lots(osv.osv): # use each list of object in turn invoices = {} inv_ref=self.pool.get('account.invoice') + partner_obj = self.pool.get('res.partner') + inv_line_obj = self.pool.get('account.invoice.line') + wf_service = netsvc.LocalService('workflow') for lot in self.browse(cr,uid,ids,context): partner_id = lot.bord_vnd_id.partner_id.id if not lot.auction_id.id: @@ -703,7 +708,7 @@ class auction_lots(osv.osv): if lot.bord_vnd_id.id in invoices: inv_id = invoices[lot.bord_vnd_id.id] else: - res = self.pool.get('res.partner').address_get(cr, uid, [lot.bord_vnd_id.partner_id.id], ['contact', 'invoice']) + res = partner_obj.address_get(cr, uid, [lot.bord_vnd_id.partner_id.id], ['contact', 'invoice']) contact_addr_id = res['contact'] invoice_addr_id = res['invoice'] inv = { @@ -735,13 +740,12 @@ class auction_lots(osv.osv): 'account_id': lot.auction_id.acc_expense.id, 'price_unit': lot.obj_price, } - self.pool.get('account.invoice.line').create(cr, uid, inv_line,context) + inv_line_obj.create(cr, uid, inv_line,context) inv_ref.button_compute(cr, uid, invoices.values()) for inv in inv_ref.browse(cr, uid, invoices.values(), context): inv_ref.write(cr, uid, [inv.id], { 'check_total': inv.amount_total }) - wf_service = netsvc.LocalService('workflow') wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_open', cr) return invoices.values() @@ -757,13 +761,15 @@ class auction_lots(osv.osv): RETURN: id of generated invoice """ dt = time.strftime('%Y-%m-%d') - inv_ref=self.pool.get('account.invoice') + inv_ref = self.pool.get('account.invoice') + partner_r = self.pool.get('res.partner') + inv_line_obj = self.pool.get('account.invoice.line') + wf_service = netsvc.LocalService('workflow') invoices={} for lot in self.browse(cr, uid, ids,context): # partner_ref = lot.ach_uid.id if not lot.auction_id.id: continue - partner_r=self.pool.get('res.partner') if not lot.ach_uid.id: raise orm.except_orm(_('Missed buyer !'), _('The object "%s" has no buyer assigned.') % (lot.name,)) if (lot.auction_id.id,lot.ach_uid.id) in invoices: @@ -774,13 +780,12 @@ class auction_lots(osv.osv): raise orm.except_orm(_('Missed Address !'), _('The Buyer has no Invoice Address.')) price = lot.obj_price or 0.0 lot_name =lot.obj_num - inv={ + inv = { 'name':lot.auction_id.name or '', 'reference': lot.ach_login, 'journal_id': lot.auction_id.journal_id.id, 'partner_id': lot.ach_uid.id, 'type': 'out_invoice', - } if invoice_number: inv['number'] = invoice_number @@ -805,12 +810,11 @@ class auction_lots(osv.osv): 'account_id': lot.auction_id.acc_income.id, 'price_unit': lot.obj_price, } - self.pool.get('account.invoice.line').create(cr, uid, inv_line,context) + inv_line_obj.create(cr, uid, inv_line,context) # inv_ref.button_compute(cr, uid, [inpq tu dis cav_id]) # inv_ref.button_compute(cr, uid, [inv_id]) inv_ref.button_compute(cr, uid, [inv_id]) for l in inv_ref.browse(cr, uid, invoices.values(), context): - wf_service = netsvc.LocalService('workflow') # wf_service.trg_validate(uid, 'account.invoice',l.id, 'invoice_proforma', cr) wf_service.trg_validate(uid, 'account.invoice',l.id, 'invoice_open', cr) return invoices.values() diff --git a/addons/auction/wizard/auction_catalog_flagey_report.py b/addons/auction/wizard/auction_catalog_flagey_report.py index 119c3273ee0..d8fec4b6d95 100644 --- a/addons/auction/wizard/auction_catalog_flagey_report.py +++ b/addons/auction/wizard/auction_catalog_flagey_report.py @@ -40,9 +40,21 @@ class auction_catalog_flagey(osv.osv_memory): return res def view_init(self, cr, uid, fields, context): - current_auction = self.pool.get('auction.dates').browse(cr,uid,context.get('active_ids', [])) - v_lots = self.pool.get('auction.lots').search(cr,uid,[('auction_id','=',current_auction.id)]) - v_ids = self.pool.get('auction.lots').browse(cr,uid,v_lots) + """ + Creates view dynamically, adding fields at runtime, raises exception + at the time of initialization of view. + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + @return: New arch of view with new columns. + """ + lots_obj = self.pool.get('auction.lots') + auc_dates_obj = self.pool.get('auction.dates') + current_auction = auc_dates_obj.browse(cr,uid,context.get('active_ids', [])) + v_lots = lots_obj.search(cr,uid,[('auction_id','=',current_auction.id)]) + v_ids = lots_obj.browse(cr,uid,v_lots) for ab in v_ids: if not ab.auction_id : raise osv.except_osv('Error!','No Lots belong to this Auction Date') diff --git a/addons/auction/wizard/auction_lots_auction_move.py b/addons/auction/wizard/auction_lots_auction_move.py index 24b2604d1d7..d1303be0887 100644 --- a/addons/auction/wizard/auction_lots_auction_move.py +++ b/addons/auction/wizard/auction_lots_auction_move.py @@ -32,16 +32,16 @@ class auction_lots_auction_move(osv.osv_memory): _name = "auction.lots.auction.move" _description = "Auction move " _columns= { - 'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True), - } + 'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True), + } - def _top(self, cr, uid, ids, context={}): - refs = self.pool.get('auction.lots') - rec_ids = refs.browse(cr, uid, context['active_ids']) - for rec in rec_ids: - if not rec.auction_id: - raise osv.except_osv('Error !', 'You can not move a lot that has no auction date') - return {} +# def _top(self, cr, uid, ids, context={}): +# refs = self.pool.get('auction.lots') +# rec_ids = refs.browse(cr, uid, context['active_ids']) +# for rec in rec_ids: +# if not rec.auction_id: +# raise osv.except_osv('Error !', 'You can not move a lot that has no auction date') +# return {} def auction_move_set(self, cr, uid, ids, context={}): """ @@ -56,13 +56,13 @@ class auction_lots_auction_move(osv.osv_memory): auction_bid_line_obj = self.pool.get('auction.bid_line') auction_lot_history_obj = self.pool.get('auction.lot.history') auction_lots_obj = self.pool.get('auction.lots') + rec_ids = refs.browse(cr, uid, context['active_ids']) for datas in self.read(cr, uid, ids): if not (datas['auction_id'] and len(context['active_ids'])) : return {} - rec_ids = refs.browse(cr, uid, context['active_ids']) - line_ids = auction_bid_line_obj.search(cr, uid, [('lot_id', 'in', context['active_ids'])]) - # pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids) +# line_ids = auction_bid_line_obj.search(cr, uid, [('lot_id', 'in', context['active_ids'])]) +# pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids) for rec in rec_ids: new_id = auction_lot_history_obj.create(cr, uid, { 'auction_id': rec.auction_id.id, diff --git a/addons/auction/wizard/auction_lots_enable.py b/addons/auction/wizard/auction_lots_enable.py index e8aa5edadf5..65cb0c4d49e 100644 --- a/addons/auction/wizard/auction_lots_enable.py +++ b/addons/auction/wizard/auction_lots_enable.py @@ -19,20 +19,14 @@ # ############################################################################## from osv import fields, osv -from tools.translate import _ -import netsvc -import pooler -import time -import tools -import wizard class auction_lots_enable(osv.osv_memory): - _name = "auction.lots.enable" _description = "Lots Enable" + _columns= { - 'confirm_en':fields.integer('Catalog Number') - } + 'confirm_en':fields.integer('Catalog Number') + } def confirm_enable(self, cr, uid, ids, context={}): """ diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py index 6be49f7336a..8cda461e186 100644 --- a/addons/auction/wizard/auction_lots_make_invoice.py +++ b/addons/auction/wizard/auction_lots_make_invoice.py @@ -27,20 +27,29 @@ import tools import wizard class auction_lots_make_invoice(osv.osv_memory): + _name = "auction.lots.make.invoice" + _description = "Make invoice" + _columns = { + 'amount': fields.float('Invoiced Amount', required =True, readonly=True), + 'objects':fields.integer('# of objects', required =True, readonly=True), + 'number':fields.char('Invoice Number', size=64), + + } + + _defaults = { + 'number': lambda *a: False, + } def default_get(self, cr, uid, fields, context): """ - To get default values for the object. - - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param fields: List of fields for which we want default values - @param context: A standard dictionary - - @return: A dictionary which of fields with values. - + To get default values for the object. + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + @return: A dictionary which of fields with values. """ 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', [])): @@ -53,7 +62,7 @@ class auction_lots_make_invoice(osv.osv_memory): def makeInvoices(self, cr, uid, ids, context): """ - seller invoice :Create an invoice. + Seller invoice :Create an invoice. @param cr: the current row, from the database cursor. @param uid: the current user’s ID for security checks. @param ids: List of Auction lots make invoice’s IDs @@ -61,36 +70,20 @@ class auction_lots_make_invoice(osv.osv_memory): """ order_obj = self.pool.get('auction.lots') mod_obj = self.pool.get('ir.model.data') - - for data in self.read(cr, uid, ids): - result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') - id = mod_obj.read(cr, uid, result, ['res_id']) - newinv = [] - ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context) - cr.commit() - return { - 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]", - 'name': 'Seller invoices', - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'account.invoice', - 'view_id': False, - 'context': "{'type':'out_refund'}", - 'type': 'ir.actions.act_window', - 'search_view_id': id['res_id'] - } + result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') + id = mod_obj.read(cr, uid, result, ['res_id']) + lots_ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context) + cr.commit() + return { + 'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]", + 'name': 'Seller invoices', + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'account.invoice', + 'view_id': False, + 'context': "{'type':'out_refund'}", + 'type': 'ir.actions.act_window', + 'search_view_id': id['res_id'] + } - _name = "auction.lots.make.invoice" - _description = "Make invoice" - _columns= { - 'amount': fields.float('Invoiced Amount', required =True, readonly=True), - 'objects':fields.integer('# of objects', required =True, readonly=True), - 'number':fields.char('Invoice Number', size=64), - - } - _defaults={ - 'number':lambda *a: False, - - } - auction_lots_make_invoice() diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py index 53c3519d225..5d2e370a81e 100644 --- a/addons/auction/wizard/auction_lots_make_invoice_buyer.py +++ b/addons/auction/wizard/auction_lots_make_invoice_buyer.py @@ -19,27 +19,31 @@ # ############################################################################## from osv import fields, osv -from tools.translate import _ -import netsvc -import pooler -import time -import tools -import wizard class auction_lots_make_invoice_buyer(osv.osv_memory): + _name = "auction.lots.make.invoice.buyer" + _description = "Make invoice buyer " + + _columns= { + 'amount': fields.float('Invoiced Amount', required =True, readonly=True), + 'objects':fields.integer('# of objects', required =True, readonly=True), + 'number':fields.char('Invoice Number', size=64), + 'buyer_id':fields.many2one('res.partner', 'Buyer', required=True), + } + + _defaults={ + 'number': lambda *a: False, + } def default_get(self, cr, uid, fields, context): """ - To get default values for the object. - - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param fields: List of fields for which we want default values - @param context: A standard dictionary - - @return: A dictionary which of fields with values. - + To get default values for the object. + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + @return: A dictionary which of fields with values. """ res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context) for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])): @@ -59,22 +63,19 @@ class auction_lots_make_invoice_buyer(osv.osv_memory): @param ids: List of Auction lots make invoice buyer’s IDs @return: dictionary of account invoice form. """ - newinv = [] - order_obj = self.pool.get('auction.lots') mod_obj = self.pool.get('ir.model.data') - + result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') + id = mod_obj.read(cr, uid, result, ['res_id']) + lots = order_obj.browse(cr, uid, context['active_ids']) for data in self.read(cr, uid, ids): - result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') - id = mod_obj.read(cr, uid, result, ['res_id']) - lots = order_obj.browse(cr, uid, context['active_ids']) invoice_number = data['number'] for lot in lots: - up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid':data['buyer_id']}) - ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number']) + up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid': data['buyer_id']}) + lots_ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number']) cr.commit() return { - 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]", + 'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]", 'name': 'Buyer invoices', 'view_type': 'form', 'view_mode': 'tree,form', @@ -84,17 +85,5 @@ class auction_lots_make_invoice_buyer(osv.osv_memory): 'type': 'ir.actions.act_window', 'search_view_id': id['res_id'] } - - _name = "auction.lots.make.invoice.buyer" - _description = "Make invoice buyer " - _columns= { - 'amount': fields.float('Invoiced Amount', required =True, readonly=True), - 'objects':fields.integer('# of objects', required =True, readonly=True), - 'number':fields.char('Invoice Number', size=64), - 'buyer_id':fields.many2one('res.partner', 'Buyer', required=True), - } - _defaults={ - 'number':lambda *a: False, - } auction_lots_make_invoice_buyer() diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py index 8f16ea9e7de..28028f45538 100644 --- a/addons/auction/wizard/auction_pay_buy.py +++ b/addons/auction/wizard/auction_pay_buy.py @@ -21,26 +21,33 @@ from osv import fields, osv from tools.translate import _ -import netsvc -import pooler import time import tools -import wizard class auction_pay_buy(osv.osv_memory): + _name = "auction.pay.buy" + _description = "Pay buy" + + _columns= { + 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))), + 'buyer_id':fields.many2one('res.partner', 'Buyer'), + 'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True), + 'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))), + 'statement_id2':fields.many2one('account.bank.statement', 'Statement'), + 'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))), + 'statement_id3':fields.many2one('account.bank.statement', 'Statement'), + 'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True), + } def default_get(self, cr, uid, fields, context): """ - To get default values for the object. - - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param fields: List of fields for which we want default values - @param context: A standard dictionary - - @return: A dictionary which of fields with values. - + To get default values for the object. + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for which we want default values + @param context: A standard dictionary + @return: A dictionary which of fields with values. """ 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', [])): @@ -54,13 +61,12 @@ class auction_pay_buy(osv.osv_memory): def pay_and_reconcile(self, cr, uid, ids, context): """ - Pay and Reconcile - - @param cr: the current row, from the database cursor. - @param uid: the current user’s ID for security checks. - @param ids: the ID or list of IDs - @param context: A standard dictionary - @return: + Pay and Reconcile + @param cr: the current row, from the database cursor. + @param uid: the current user’s ID for security checks. + @param ids: the ID or list of IDs + @param context: A standard dictionary + @return: """ lot_obj = self.pool.get('auction.lots') bank_statement_line_obj = self.pool.get('account.bank.statement.line') @@ -94,22 +100,8 @@ class auction_pay_buy(osv.osv_memory): for lot in lots: lot_obj.write(cr, uid, [lot.id], {'statement_id':[(4, new_id)]}) return {} - - _name = "auction.pay.buy" - _description = "Pay buy" - _columns= { - 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))), - 'buyer_id':fields.many2one('res.partner', 'Buyer'), - 'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True), - 'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))), - 'statement_id2':fields.many2one('account.bank.statement', 'Statement'), - 'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))), - 'statement_id3':fields.many2one('account.bank.statement', 'Statement'), - 'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True), - } + auction_pay_buy() - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auction/wizard/auction_pay_sel.py b/addons/auction/wizard/auction_pay_sel.py index df7b4a794f3..6873092c7e9 100644 --- a/addons/auction/wizard/auction_pay_sel.py +++ b/addons/auction/wizard/auction_pay_sel.py @@ -20,33 +20,27 @@ ############################################################################## from osv import fields, osv from tools.translate import _ -import netsvc -import pooler -import time import tools -import wizard class auction_pay_sel(osv.osv_memory): - _name = "auction.pay.sel" _description = "Pay Invoice" + _columns= { - 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True), - 'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]), - 'journal_id':fields.many2one('account.journal', 'Journal', required=True), - 'period_id':fields.many2one('account.period', 'Period', required=True), - } + 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True), + 'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]), + 'journal_id':fields.many2one('account.journal', 'Journal', required=True), + 'period_id':fields.many2one('account.period', 'Period', required=True), + } def pay_and_reconcile(self, cr, uid, ids, context): - """ - Pay and Reconcile - - @param cr: the current row, from the database cursor. - @param uid: the current user’s ID for security checks. - @param ids: the ID or list of IDs - @param context: A standard dictionary - @return: + Pay and Reconcile + @param cr: the current row, from the database cursor. + @param uid: the current user’s ID for security checks. + @param ids: the ID or list of IDs + @param context: A standard dictionary + @return: """ lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context) invoice_obj = self.pool.get('account.invoice') diff --git a/addons/auction/wizard/auction_payer_sel.py b/addons/auction/wizard/auction_payer_sel.py index 349f10d4dec..c422ee91857 100644 --- a/addons/auction/wizard/auction_payer_sel.py +++ b/addons/auction/wizard/auction_payer_sel.py @@ -20,15 +20,8 @@ ############################################################################## from osv import fields, osv -from tools.translate import _ -import netsvc -import pooler -import time -import tools -import wizard class auction_payer(osv.osv_memory): - _name = "auction.payer" _description = "Auction payer" diff --git a/addons/auction/wizard/auction_taken.py b/addons/auction/wizard/auction_taken.py index 63c3db7583c..005fd042646 100644 --- a/addons/auction/wizard/auction_taken.py +++ b/addons/auction/wizard/auction_taken.py @@ -32,10 +32,10 @@ class auction_taken(osv.osv_memory): """ _name = "auction.taken" _description = "Auction taken" + _columns = { - 'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'), - - } + 'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'), + } def _to_xml(s): return s.replace('&','&').replace('<','<').replace('>','>') diff --git a/addons/auction/wizard/auction_transfer_unsold_object.py b/addons/auction/wizard/auction_transfer_unsold_object.py index 9beb4893560..47aadc25d59 100644 --- a/addons/auction/wizard/auction_transfer_unsold_object.py +++ b/addons/auction/wizard/auction_transfer_unsold_object.py @@ -29,10 +29,18 @@ class auction_transfer_unsold_object(osv.osv): _name = 'auction.transfer.unsold.object' _description = 'To transfer unsold objects' + _columns = { + 'auction_id_from':fields.many2one('auction.dates', 'From Auction Date', required=True), + 'auction_id_to':fields.many2one('auction.dates', 'To Auction Date', required=True), + } + + _defaults = { + 'auction_id_from': _start, + } + def _start(self, cr, uid, context): """ To initialize auction_id_from - @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @@ -48,14 +56,12 @@ class auction_transfer_unsold_object(osv.osv): def transfer_unsold_object(self, cr, uid, ids, context): """ To Transfer the unsold object - @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: - """ bid_line_obj = self.pool.get('auction.bid_line') lots_obj = self.pool.get('auction.lots') @@ -76,13 +82,5 @@ class auction_transfer_unsold_object(osv.osv): 'sel_inv_id':None, 'state':'draft'}) return {} - - _columns = { - 'auction_id_from':fields.many2one('auction.dates', 'From Auction Date', required=True), - 'auction_id_to':fields.many2one('auction.dates', 'To Auction Date', required=True), - } - - _defaults = { - 'auction_id_from': _start, - } + auction_transfer_unsold_object() \ No newline at end of file