diff options
| author | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
|---|---|---|
| committer | atp (Open ERP) <atp@tinyerp.co.in> | 2010-06-22 10:45:44 +0530 |
| commit | b0efd26edd9f4e2aa75424b787ea46d2be15cd04 (patch) | |
| tree | e78cdb693e62a5c9a17f77a395eec51fb34becbf /addons/auction/report | |
| parent | 46bb1ea51be702758d68a5f69db32c82dbccf9bd (diff) | |
| parent | 2319190c5a20cb8095f85cacca89a33164ba93d7 (diff) | |
[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2
bzr revid: atp@tinyerp.co.in-20100622051544-c7hig73zk2at66cy
Diffstat (limited to 'addons/auction/report')
| -rw-r--r-- | addons/auction/report/artists_lots.py | 6 | ||||
| -rw-r--r-- | addons/auction/report/auction_invoice.py | 4 | ||||
| -rw-r--r-- | addons/auction/report/auction_objects.py | 11 | ||||
| -rw-r--r-- | addons/auction/report/auction_total_rml.py | 37 | ||||
| -rw-r--r-- | addons/auction/report/buyer_form_report.py | 4 | ||||
| -rw-r--r-- | addons/auction/report/buyer_list.py | 24 | ||||
| -rw-r--r-- | addons/auction/report/catalog2.py | 8 | ||||
| -rw-r--r-- | addons/auction/report/lots_list.py | 2 | ||||
| -rw-r--r-- | addons/auction/report/seller_address.py | 8 | ||||
| -rw-r--r-- | addons/auction/report/seller_form_report.py | 4 | ||||
| -rw-r--r-- | addons/auction/report/total.py | 8 |
11 files changed, 56 insertions, 60 deletions
diff --git a/addons/auction/report/artists_lots.py b/addons/auction/report/artists_lots.py index 652a5d9801d..981440dac53 100644 --- a/addons/auction/report/artists_lots.py +++ b/addons/auction/report/artists_lots.py @@ -26,9 +26,9 @@ class report_artistlot(report_int): def __init__(self, name): report_int.__init__(self, name) - def create(self,cr, uid, ids, datas, context): + def create(self, cr, uid, ids, datas, context): service = netsvc.LocalService("object_proxy") - lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['artist_id']) + lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['artist_id']) artists = [] for lot in lots: if lot['artist_id'] and lot['artist_id'] not in artists: @@ -40,7 +40,7 @@ class report_artistlot(report_int): datas['ids'] = artists self._obj_report = netsvc.LocalService('report.report.auction.artists') - return self._obj_report.create(cr,uid, artists, datas, context) + return self._obj_report.create(cr, uid, artists, datas, context) def result(self): return self._obj_report.result() diff --git a/addons/auction/report/auction_invoice.py b/addons/auction/report/auction_invoice.py index b8c508237a5..40ca8498756 100644 --- a/addons/auction/report/auction_invoice.py +++ b/addons/auction/report/auction_invoice.py @@ -27,7 +27,7 @@ class auction_invoice(report_int): report_int.__init__(self, name) def create(self,cr, uid, ids, datas, context): - lots = self.pool.get('auction.lots').read(cr,uid, ids, ['ach_inv_id'], context=context) + lots = self.pool.get('auction.lots').read(cr, uid, ids, ['ach_inv_id'], context=context) invoices = {} for l in lots: @@ -40,7 +40,7 @@ class auction_invoice(report_int): datas['ids'] = new_ids self._obj_invoice = netsvc.LocalService('report.account.invoice') - return self._obj_invoice.create(cr,uid, new_ids, datas, context) + return self._obj_invoice.create(cr, uid, new_ids, datas, context) def result(self): return self._obj_invoice.result() diff --git a/addons/auction/report/auction_objects.py b/addons/auction/report/auction_objects.py index b3f632bb27e..a83a75a873e 100644 --- a/addons/auction/report/auction_objects.py +++ b/addons/auction/report/auction_objects.py @@ -28,19 +28,8 @@ class auction_objects(report_sxw.rml_parse): super(auction_objects, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, - #'lines': self.lines - #'get_data' : self.get_data }) -# def lines(self, auction_id): -# -# cr.execute('select ad.name from auction_dates ad, a1uction_lots al where ad.id=al.%d group by ad.name',(auction_id)) -# return self.cr.fetchone()[0] -# def get_data(self, auction_id): -# res = self.pool.get('auction.bid.lines').read(self.cr,self.uid,[lot_id]) -# return True - - report_sxw.report_sxw('report.auction.objects', 'auction.lots', 'addons/auction/report/auction_objects.rml', parser=auction_objects) diff --git a/addons/auction/report/auction_total_rml.py b/addons/auction/report/auction_total_rml.py index 0e207db62bc..576ed47a84d 100644 --- a/addons/auction/report/auction_total_rml.py +++ b/addons/auction/report/auction_total_rml.py @@ -54,62 +54,65 @@ class auction_total_rml(report_sxw.rml_parse): for lot_id in objects: auc_lot_ids.append(lot_id.id) self.total_obj=auc_lot_ids - self.cr.execute('select auction_id from auction_lots where id =ANY(%s) group by auction_id',(auc_lot_ids,)) + self.cr.execute('SELECT auction_id FROM auction_lots ' + 'WHERE id IN %s ' + 'GROUP BY auction_id', + (tuple(auc_lot_ids),)) auc_date_ids = self.cr.fetchall() auct_dat=[] for ad_id in auc_date_ids: - auc_dates_fields = self.pool.get('auction.dates').read(self.cr,self.uid,ad_id[0],['name','auction1','id']) + auc_dates_fields = self.pool.get('auction.dates').read(self.cr, self.uid, ad_id[0], ['name','auction1','id']) auct_dat.append(auc_dates_fields) return auct_dat def sum_taxes(self,auction_id): - self.cr.execute("select count(1) from auction_lots where id =ANY(%s) and auction_id=%s group by auction_id ", (self.total_obj,auction_id,)) + self.cr.execute("select count(1) from auction_lots where id IN %s and auction_id=%s group by auction_id ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return res[0] def sold_item(self, object_id): - self.cr.execute("select count(1) from auction_lots where id =ANY(%s) and auction_id=%s and state in ('unsold') ", (self.total_obj,object_id,)) + self.cr.execute("select count(1) from auction_lots where id IN %s and auction_id=%s and state IN ('unsold') ", (tuple(self.total_obj),object_id,)) res = self.cr.fetchone() return str(res[0]) def sum_buyer(self, auction_id): - self.cr.execute("select count(*) from auction_lots where id =ANY(%s) and auction_id=%s and (ach_uid is not null or ach_login is not null) ", (self.total_obj,auction_id,)) + self.cr.execute("select count(*) from auction_lots where id IN %s and auction_id=%s and (ach_uid is not null or ach_login is not null) ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) def sum_seller(self, auction_id): - self.cr.execute("select count(distinct bord_vnd_id) from auction_lots where id =ANY(%s) and auction_id=%s AND bord_vnd_id is not null ", (self.total_obj,auction_id,)) + self.cr.execute("select count(distinct bord_vnd_id) from auction_lots where id IN %s and auction_id=%s AND bord_vnd_id is not null ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return res[0] def sum_adj(self, auction_id): - self.cr.execute("select sum(obj_price) from auction_lots where id =ANY(%s) and auction_id=%s ", (self.total_obj,auction_id,)) + self.cr.execute("select sum(obj_price) from auction_lots where id IN %s and auction_id=%s ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) def count_take(self, auction_id): - self.cr.execute("select count(*) from auction_lots where id =ANY(%s) and auction_id=%s and ach_emp='True' ", (self.total_obj,auction_id,)) + self.cr.execute("select count(*) from auction_lots where id IN %s and auction_id=%s and ach_emp='True' ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) def chek_paid(self, auction_id): - self.cr.execute("select count(1) from auction_lots where id =ANY(%s) and auction_id=%s and ((paid_ach='T') or (is_ok='T')) ", (self.total_obj,auction_id,)) + self.cr.execute("select count(1) from auction_lots where id IN %s and auction_id=%s and ((paid_ach='T') or (is_ok='T')) ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) def check_paid_seller(self,auction_id): - self.cr.execute("select sum(seller_price) from auction_lots where id =ANY(%s) and auction_id=%s and paid_vnd != 'T' ", (self.total_obj,auction_id,)) + self.cr.execute("select sum(seller_price) from auction_lots where id IN %s and auction_id=%s and paid_vnd != 'T' ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) or 0.0 def sum_credit(self,auction_id): - self.cr.execute("select sum(buyer_price) from auction_lots where id =ANY(%s) and auction_id=%s", (self.total_obj,auction_id,)) + self.cr.execute("select sum(buyer_price) from auction_lots where id IN %s and auction_id=%s", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) def sum_debit_buyer(self,auction_id): - self.cr.execute("select sum(buyer_price) from auction_lots where id =ANY(%s) and auction_id=%s", (self.total_obj,auction_id,)) + self.cr.execute("select sum(buyer_price) from auction_lots where id IN %s and auction_id=%s", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0] or 0) @@ -121,27 +124,27 @@ class auction_total_rml(report_sxw.rml_parse): def sum_credit_seller(self, object_id): - self.cr.execute("select sum(seller_price) from auction_lots where id =ANY(%s) and auction_id=%s", (self.total_obj,object_id,)) + self.cr.execute("select sum(seller_price) from auction_lots where id IN %s and auction_id=%s", (tuple(self.total_obj),object_id,)) res = self.cr.fetchone() return str(res[0] or 0) def sum_minadj(self, auction_id): - self.cr.execute('select sum(lot_est1) from auction_lots where id =ANY(%s) and auction_id=%s', (self.total_obj,auction_id,)) + self.cr.execute('select sum(lot_est1) from auction_lots where id IN %s and auction_id=%s', (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) or 0 def sum_maxadj(self, auction_id): - self.cr.execute('select sum(lot_est2) from auction_lots where id =ANY(%s) and auction_id=%s', (self.total_obj,auction_id,)) + self.cr.execute('select sum(lot_est2) from auction_lots where id IN %s and auction_id=%s', (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) or 0 def sum_buyer_paid(self, auction_id): - self.cr.execute("select count(*) from auction_lots where id =ANY(%s) and auction_id=%s and state = 'paid' ", (self.total_obj,auction_id,)) + self.cr.execute("select count(*) from auction_lots where id IN %s and auction_id=%s and state = 'paid' ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) def count_comm(self, auction_id): - self.cr.execute("select count(*) from auction_lots where id =ANY(%s) and auction_id=%s and obj_comm is not null ", (self.total_obj,auction_id,)) + self.cr.execute("select count(*) from auction_lots where id IN %s and auction_id=%s and obj_comm is not null ", (tuple(self.total_obj),auction_id,)) res = self.cr.fetchone() return str(res[0]) diff --git a/addons/auction/report/buyer_form_report.py b/addons/auction/report/buyer_form_report.py index 2284ff78a16..5dfe5fecca6 100644 --- a/addons/auction/report/buyer_form_report.py +++ b/addons/auction/report/buyer_form_report.py @@ -44,7 +44,7 @@ class buyer_form_report(report_sxw.rml_parse): taxes.append(lot.author_right) if lot.auction_id: taxes += lot.auction_id.buyer_costs - tax=self.pool.get('account.tax').compute(self.cr,self.uid,taxes,lot.obj_price,1) + tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1) for t in tax: amount+=t['amount'] return amount @@ -55,7 +55,7 @@ class buyer_form_report(report_sxw.rml_parse): for object in objects: partner = ret_dict.get(object.ach_uid.id,False) if not partner: - ret_dict[object.ach_uid.id] = {'partner' : object.ach_uid or False,'lots':[object]} + ret_dict[object.ach_uid.id] = {'partner' : object.ach_uid or False, 'lots':[object]} else: lots = partner.get('lots') lots.append(object) diff --git a/addons/auction/report/buyer_list.py b/addons/auction/report/buyer_list.py index 06430efdc85..dde5c6ede04 100644 --- a/addons/auction/report/buyer_list.py +++ b/addons/auction/report/buyer_list.py @@ -43,22 +43,23 @@ class buyer_list(report_sxw.rml_parse): 'sum_lots':self.sum_lots }) - def lines_lots_from_auction(self,objects): + def lines_lots_from_auction(self, objects): auc_lot_ids = [] for lot_id in objects: auc_lot_ids.append(lot_id.id) self.auc_lot_ids=auc_lot_ids - self.cr.execute('select auction_id from auction_lots where id =ANY(%s) group by auction_id',(auc_lot_ids,)) + self.cr.execute('SELECT auction_id FROM auction_lots WHERE id IN %s GROUP BY auction_id', + (tuple(auc_lot_ids),)) auc_date_ids = self.cr.fetchall() auct_dat=[] for ad_id in auc_date_ids: - auc_dates_fields = self.pool.get('auction.dates').read(self.cr,self.uid,ad_id[0],['name']) + auc_dates_fields = self.pool.get('auction.dates').read(self.cr, self.uid, ad_id[0], ['name']) self.cr.execute('select * from auction_buyer_taxes_rel abr,auction_dates ad where ad.id=abr.auction_id and ad.id=%s', (ad_id[0],)) res=self.cr.fetchall() total=0 for r in res: - buyer_rel_field = self.pool.get('account.tax').read(self.cr,self.uid,r[1],['amount']) + buyer_rel_field = self.pool.get('account.tax').read(self.cr, self.uid, r[1], ['amount']) total = total + buyer_rel_field['amount'] auc_dates_fields['amount']=total auct_dat.append(auc_dates_fields) @@ -67,15 +68,18 @@ class buyer_list(report_sxw.rml_parse): def lines_lots_auct_lot(self,obj): auc_lot_ids = [] - auc_date_ids = self.pool.get('auction.dates').search(self.cr,self.uid,([('name','like',obj['name'])])) + auc_date_ids = self.pool.get('auction.dates').search(self.cr, self.uid, ([('name','like',obj['name'])])) -# self.cr.execute('select ach_uid,count(1) as no_lot, sum(obj_price) as adj_price, sum(buyer_price)-sum(obj_price) as buyer_cost ,sum(buyer_price) as to_pay from auction_lots where id in ('+','.join(map(str,self.auc_lot_ids))+') and auction_id=%s and ach_uid is not null group by ach_uid ', (auc_date_ids[0],)) - self.cr.execute('select ach_login as ach_uid,count(1) as no_lot, sum(obj_price) as adj_price, sum(buyer_price)-sum(obj_price) as buyer_cost ,sum(buyer_price) as to_pay from auction_lots where id =ANY(%s) and auction_id=%s and ach_login is not null group by ach_login order by ach_login', (self.auc_lot_ids,auc_date_ids[0],)) + self.cr.execute('SELECT ach_login AS ach_uid, COUNT(1) AS no_lot, '\ + 'SUM(obj_price) AS adj_price, '\ + 'SUM(buyer_price)-SUM(obj_price) AS buyer_cost, '\ + 'SUM(buyer_price) AS to_pay '\ + 'FROM auction_lots WHERE id IN %s '\ + 'AND auction_id=%s AND ach_login IS NOT NULL '\ + 'GROUP BY ach_login ORDER BY ach_login', + (tuple(self.auc_lot_ids), auc_date_ids[0],)) res = self.cr.dictfetchall() for r in res: -# if r['ach_uid']: -# tnm=self.pool.get('res.partner').read(self.cr,self.uid,[r['ach_uid']],['name'])# -# r.__setitem__('ach_uid',tnm[0]['name']) self.sum_adj_price_val = self.sum_adj_price_val + r['adj_price'] self.sum_buyer_obj_price_val = self.sum_buyer_obj_price_val + r['buyer_cost'] self.sum_buyer_price_val = self.sum_buyer_price_val + r['to_pay'] diff --git a/addons/auction/report/catalog2.py b/addons/auction/report/catalog2.py index 3eb993c55ce..b84bab5b9fd 100644 --- a/addons/auction/report/catalog2.py +++ b/addons/auction/report/catalog2.py @@ -69,7 +69,7 @@ class auction_catalog(report_rml): temp=self.post_process_xml_data(cr, uid, xml, context) return temp - def catalog_xml(self,cr,uid,ids,data,context,cwid="0"): + def catalog_xml(self, cr, uid, ids, data, context, cwid="0"): impl = minidom.getDOMImplementation() doc = impl.createDocument(None, "report", None) @@ -84,10 +84,10 @@ class auction_catalog(report_rml): tab_no_photo=[] for id in ids: lot_ids=pooler.get_pool(cr.dbname).get('auction.lots').search(cr, uid, [('auction_id', '=', id)]) - ab=pooler.get_pool(cr.dbname).get('auction.lots').read(cr,uid,lot_ids,['auction_id','name','lot_num','lot_est1','lot_est2'],context) + ab=pooler.get_pool(cr.dbname).get('auction.lots').read(cr, uid, lot_ids, ['auction_id','name','lot_num','lot_est1','lot_est2'], context) auction_dates_ids = [x["auction_id"][0] for x in ab] - res=pooler.get_pool(cr.dbname).get('auction.dates').read(cr,uid,ids,['name','auction1','auction2'],context) + res=pooler.get_pool(cr.dbname).get('auction.dates').read(cr, uid, ids, ['name','auction1','auction2'], context) # name emelment key = 'name' categ = doc.createElement(key) @@ -126,7 +126,7 @@ class auction_catalog(report_rml): for test in ab: if test.has_key('auction_id'): auction_ids.append(test['auction_id'][0]) - cr.execute('select * from auction_lots where auction_id =ANY(%s)',(auction_ids,)) + cr.execute('select * from auction_lots where auction_id IN %s',(tuple(auction_ids),)) res = cr.dictfetchall() for cat in res: product =doc.createElement('product') diff --git a/addons/auction/report/lots_list.py b/addons/auction/report/lots_list.py index e56c7cd7866..e21df216c64 100644 --- a/addons/auction/report/lots_list.py +++ b/addons/auction/report/lots_list.py @@ -31,7 +31,7 @@ class lots_list(report_sxw.rml_parse): 'bid_line' : self.bid_line }) def bid_line(self, lot_id): - res = self.pool.get('auction.bid.lines').read(self.cr,self.uid,[lot_id]) + res = self.pool.get('auction.bid.lines').read(self.cr, self.uid, [lot_id]) return True report_sxw.report_sxw('report.lots.list', 'auction.lots', 'addons/auction/report/lots_list.rml', parser=lots_list) diff --git a/addons/auction/report/seller_address.py b/addons/auction/report/seller_address.py index cd33f690ea5..315533e99f4 100644 --- a/addons/auction/report/seller_address.py +++ b/addons/auction/report/seller_address.py @@ -26,9 +26,9 @@ class auction_seller(report_int): def __init__(self, name): report_int.__init__(self, name) - def create(self,cr, uid, ids, datas, context): + def create(self, cr, uid, ids, datas, context): service = netsvc.LocalService("object_proxy") - lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['bord_vnd_id']) + lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['bord_vnd_id']) bords = {} for l in lots: @@ -37,7 +37,7 @@ class auction_seller(report_int): new_ids = bords.keys() parts = {} - partners = service.execute(cr.dbname,uid, 'auction.deposit', 'read', new_ids, ['partner_id']) + partners = service.execute(cr.dbname, uid, 'auction.deposit', 'read', new_ids, ['partner_id']) for l in partners: if l['partner_id']: parts[l['partner_id'][0]]=True @@ -48,7 +48,7 @@ class auction_seller(report_int): datas['ids'] = new_ids self._obj_invoice = netsvc.LocalService('report.res.partner.address') - return self._obj_invoice.create(cr,uid, new_ids, datas, context) + return self._obj_invoice.create(cr, uid, new_ids, datas, context) def result(self): return self._obj_invoice.result() diff --git a/addons/auction/report/seller_form_report.py b/addons/auction/report/seller_form_report.py index cc476558df9..7e8af752796 100644 --- a/addons/auction/report/seller_form_report.py +++ b/addons/auction/report/seller_form_report.py @@ -28,7 +28,7 @@ from osv import osv class seller_form_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(seller_form_report, self).__init__(cr, uid, name, context=context) - lot=self.pool.get('auction.lots').browse(cr,uid,uid) + lot=self.pool.get('auction.lots').browse(cr, uid, uid) #address=lot.bord_vnd_id.address_get(self.cr,self.uid,[partner.id]) # partner=lot.bord_vnd_id.partner_id # address=partner.address and partner.address[0] or "" @@ -53,7 +53,7 @@ class seller_form_report(report_sxw.rml_parse): taxes.append(lot.bord_vnd_id.tax_id) elif lot.auction_id and lot.auction_id.seller_costs: taxes += lot.auction_id.seller_costs - tax=self.pool.get('account.tax').compute(self.cr,self.uid,taxes,lot.obj_price,1) + tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1) for t in tax: amount+=t['amount'] return amount diff --git a/addons/auction/report/total.py b/addons/auction/report/total.py index 135e495e4b6..0d87709cbee 100644 --- a/addons/auction/report/total.py +++ b/addons/auction/report/total.py @@ -35,14 +35,14 @@ class report_custom(report_rml): def __init__(self, name, table, tmpl, xsl): report_rml.__init__(self, name, table, tmpl, xsl) - def create_xml(self,cr, uid, ids, datas, context={}): + def create_xml(self, cr, uid, ids, datas, context={}): service = netsvc.LocalService("object_proxy") # start_time = time.clock() # lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['obj_price','ach_pay_id','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id']) - lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id']) - auction = service.execute(cr.dbname,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0] + lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id']) + auction = service.execute(cr.dbname, uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0] # mid_time = time.clock() @@ -96,7 +96,7 @@ class report_custom(report_rml): # mid_time3 = time.clock() debit = adj - costs = service.execute(cr.dbname,uid, 'auction.lots', 'compute_seller_costs', ids) + costs = service.execute(cr.dbname, uid, 'auction.lots', 'compute_seller_costs', ids) for cost in costs: debit += cost['amount'] |
