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 | |
| 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')
23 files changed, 262 insertions, 85 deletions
diff --git a/addons/auction/__openerp__.py b/addons/auction/__openerp__.py index 0959d6a4dd9..f9940571143 100644 --- a/addons/auction/__openerp__.py +++ b/addons/auction/__openerp__.py @@ -32,6 +32,11 @@ It completely manages an auction such as managing bids, keeping track of the sold articles along with the paid and unpaid objects including delivery of the articles. + Dashboards for auction that includes: + * My Latest Objects (list) + * My Latest Deposits (list) + * Objects Statistics (list) + * My Objects By Day (list) """, 'author': 'Tiny', 'depends': ['base', 'account', 'hr_attendance'], @@ -54,13 +59,15 @@ # 'wizard/auction_aie_send_result_view.xml', 'wizard/auction_lots_buyer_map_view.xml', # 'wizard/auction_lots_numerotate_view.xml', - + 'auction_view.xml', 'auction_report.xml', - 'auction_wizard.xml' + 'auction_wizard.xml', + 'board_auction_view.xml', + 'board_auction_manager_view.xml', + ], - 'demo_xml': ['auction_demo.xml'], -# 'test' : ['test/auction.yml','test/auction_wizard.yml'], + 'demo_xml': ['auction_demo.xml','board_auction_demo.xml'], 'installable': True, 'active': False, 'certificate': '0039333102717', diff --git a/addons/auction/auction.py b/addons/auction/auction.py index b7a379cd387..e7c6198579a 100644 --- a/addons/auction/auction.py +++ b/addons/auction/auction.py @@ -34,7 +34,7 @@ class auction_artists(osv.osv): _columns = { 'name': fields.char('Artist/Author Name', size=64, required=True), 'pseudo': fields.char('Pseudo', size=64), - 'birth_death_dates':fields.char('Birth / Death dates',size=64), + 'birth_death_dates':fields.char('Birth / Death dates', size=64), 'biography': fields.text('Biography'), } auction_artists() @@ -45,7 +45,7 @@ auction_artists() class auction_dates(osv.osv): _name = "auction.dates" - def _adjudication_get(self, cr, uid, ids, prop, unknow_none,unknow_dict): + def _adjudication_get(self, cr, uid, ids, prop, unknow_none, unknow_dict): tmp={} for id in ids: tmp[id]=0.0 @@ -97,15 +97,21 @@ 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',)) + cr.execute('select count(*) as c from auction_lots where auction_id IN %s and state=%s and obj_price>0', (tuple(ids),'draft',)) + cr.execute('SELECT COUNT(*) AS c ' + 'FROM auction_lots ' + 'WHERE auction_id IN %s ' + 'AND state=%s AND obj_price>0', (tuple(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',)) + cr.execute('SELECT id FROM auction_lots ' + 'WHERE auction_id IN %s ' + 'AND state=%s AND obj_price>0', (tuple(ids), 'draft')) 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,)) + cr.execute('select id from auction_lots where auction_id IN %s and obj_price>0',(tuple(ids),)) ids2 = [x[0] for x in cr.fetchall()] # for auction in auction_ids: - c = lots_obj.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() @@ -115,7 +121,9 @@ auction_dates() # Deposits #---------------------------------------------------------- def _inv_uniq(cr, ids): - cr.execute('select name from auction_deposit where id =ANY(%s)',(ids,)) + cr.execute('SELECT id FROM auction_lots ' + 'WHERE auction_id IN %s ' + 'AND obj_price>0', (tuple(ids),)) for datas in cr.fetchall(): cr.execute('select count(*) from auction_deposit where name=%s', (datas[0],)) if cr.fetchone()[0]>1: @@ -231,7 +239,9 @@ def _type_get(self, cr, uid,ids): # Lots #---------------------------------------------------------- def _inv_constraint(cr, ids): - cr.execute('select id, bord_vnd_id, lot_num from auction_lots where id =ANY(%s)', (ids,)) + cr.execute('SELECT id, bord_vnd_id, lot_num FROM auction_lots ' + 'WHERE id IN %s', + (tuple(ids),)) for datas in cr.fetchall(): cr.execute('select count(*) from auction_lots where bord_vnd_id=%s and lot_num=%s', (datas[1],datas[2])) if cr.fetchone()[0]>1: diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml index c65cd6d8451..91b2d171906 100644 --- a/addons/auction/auction_view.xml +++ b/addons/auction/auction_view.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <openerp> <data> - <menuitem name="Auction Management" id="auction_menu_root" icon="terp-purchase"/> + <menuitem name="Auction Management" id="auction_menu_root" icon="terp-purchase" sequence="26"/> <menuitem name="Configuration" parent="auction_menu_root" id="auction_config_menu" sequence="7"/> <menuitem name="Tools Bar Codes" id="auction_outils_menu" parent="auction_menu_root" sequence="5" /> <menuitem name="Deliveries Management" action="action_auction_taken" id="menu_wizard_emporte" parent="auction_outils_menu"/> diff --git a/addons/auction/board_auction_demo.xml b/addons/auction/board_auction_demo.xml new file mode 100644 index 00000000000..504a02263da --- /dev/null +++ b/addons/auction/board_auction_demo.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> + +<openerp> + <data noupdate="1"> + <record model="ir.ui.view_sc" id="sc_auction_dash"> + <field name="name">Auction dashboard</field> + <field name="user_id" ref="base.user_root"/> + <field name="resource">ir.ui.menu</field> + <field name="sequence">4</field> + <field name="res_id" ref="menu_board_auction"/> + </record> + + </data> +</openerp> diff --git a/addons/auction/board_auction_manager_view.xml b/addons/auction/board_auction_manager_view.xml new file mode 100644 index 00000000000..a7efd0ef0e0 --- /dev/null +++ b/addons/auction/board_auction_manager_view.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<openerp> + <data> + <record model="board.note.type" id="note_auction_type1"> + <field name="name">Auction manager</field> + </record> + + <record model="ir.ui.view" id="board_auction_manager_form1"> + <field name="name">board.auction.manager.form</field> + <field name="model">board.board</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Auction manager "> + <hpaned position="100"> + <child1> + + + <action + string="Latest objects" + name="%(auction.action_report_latest_objects_manager_tree)d" + height="200" + width="510" /> + <action string="Latest deposits" + name="%(auction.action_report_latest_doposit_manager_tree)d"/> + <action + string="Summary pointing by user" + name="%(auction.action_report_auction_sign_in_out_manager_tree1)d" + view_mode="tree,graph" + /> + <action string="Objects statistics" + name="%(auction.action_report_object_encoded_manager_tree)d" + /> + </child1> + + <child2> + <button + string="My board" + name="%(open_board_auction)d" + icon="terp-partner" + type="action" + colspan="4" + /> + <action + string="Total Adjudications" + name="%(auction.action_report_auction_adjudication_tree)d" + view_mode="graph,tree" + colspan="4"/> + <action + string="Min/Adj/Max" + name="%(auction.action_report_auction_estimation_adj_category_manager_tree)d" + view_mode="graph,tree" colspan="4" /> + + <action + string="Objects by day" + name="%(auction.action_report_auction_object_date_tree)d" + view_mode="graph,tree" colspan="4" /> + + </child2> + </hpaned> + </form> + </field> + </record> + + <record model="ir.actions.act_window" id="open_board_auction_manager"> + <field name="name">Auction manager board</field> + <field name="res_model">board.board</field> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="usage">menu</field> + <field name="view_id" ref="board_auction_manager_form1"/> + </record> + <menuitem + name="Auction Manager" + action="open_board_auction_manager" + sequence="1" + id="menu_board_auction_manager" icon="terp-graph" parent="menu_board_auction"/> + + </data> +</openerp> diff --git a/addons/auction/board_auction_view.xml b/addons/auction/board_auction_view.xml new file mode 100644 index 00000000000..674b5821309 --- /dev/null +++ b/addons/auction/board_auction_view.xml @@ -0,0 +1,71 @@ +<?xml version="1.0"?> +<openerp> +<data> + <record model="board.note.type" id="note_auction_type"> + <field name="name">Auction</field> + </record> + + <record model="ir.ui.view" id="board_auction_manager_form"> + <field name="name">board.auction.manager.form</field> + <field name="model">board.board</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Auction manager "> + <hpaned position="100"> + <child1> + <action + string="My Latest Objects" + name="%(auction.action_report_latest_objects_tree)d" + height="200" + width="510"/> + <action string="My Latest Deposits" + name="%(auction.action_report_latest_doposit_manager_tree)d" + domain="[('create_uid','=',uid)]" + /> + <action string="Objects statistics" + name="%(auction.action_report_object_encoded_member_tree)d" + /> + </child1> + + <child2> + <button + string="Menu" + name="%(base.action_menu_admin)d" + icon="gtk-justify-fill" + type="action" + colspan="4"/> + + <action + string="My Objects By Day" + name="%(auction.action_report_auction_object_date_tree)d" + view_mode="graph,tree" colspan="4" + domain="[('user_id','=',uid),('month','=',time.strftime('%%Y-%%m-01'))]"/> + <action + string="Estimations/Adjudication" + name="%(auction.action_report_auction_estimation_adj_category_member_tree)d" + view_mode="graph,tree" colspan="4"/> + </child2> + </hpaned> + </form> + </field> + </record> + + <record model="ir.actions.act_window" id="open_board_auction"> + <field name="name">Auction member board</field> + <field name="res_model">board.board</field> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="usage">menu</field> + <field name="view_id" ref="board_auction_manager_form"/> + </record> + <menuitem icon="terp-graph" id="base.dashboard" name="Dashboards" sequence="2" parent="base.reporting_menu"/> + <menuitem name="Auction" id="menu_board_auction" parent="base.dashboard" /> + <menuitem + name="Auction Member" + action="open_board_auction" + sequence="2" + id="board_menu_auction_member" icon="terp-graph" parent="menu_board_auction" /> + +</data> +</openerp> + 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'] diff --git a/addons/auction/wizard/auction_aie_send.py b/addons/auction/wizard/auction_aie_send.py index 51368349a98..238f9923677 100644 --- a/addons/auction/wizard/auction_aie_send.py +++ b/addons/auction/wizard/auction_aie_send.py @@ -142,7 +142,7 @@ class auction_lots_send_aie(osv.osv_memory): for (ref,id) in ids: # ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)]) - datas = service.execute(cr.db_name,uid, 'auction.lots', 'read',[id], ['name','image']) + datas = service.execute(cr.db_name, uid, 'auction.lots', 'read', [id], ['name','image']) if len(datas): bin = base64.decodestring(datas[0]['image']) fname = datas[0]['name'] diff --git a/addons/auction/wizard/auction_catalog_flagey_report.py b/addons/auction/wizard/auction_catalog_flagey_report.py index d8fec4b6d95..97440a6680c 100644 --- a/addons/auction/wizard/auction_catalog_flagey_report.py +++ b/addons/auction/wizard/auction_catalog_flagey_report.py @@ -52,9 +52,9 @@ class auction_catalog_flagey(osv.osv_memory): """ 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) + 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_buyer_map.py b/addons/auction/wizard/auction_lots_buyer_map.py index b20250edc38..bee39e0d258 100644 --- a/addons/auction/wizard/auction_lots_buyer_map.py +++ b/addons/auction/wizard/auction_lots_buyer_map.py @@ -84,7 +84,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory): """ rec_ids = context and context.get('active_ids',False) or False assert rec_ids, _('Active IDs not Found') - datas = self.read(cr, uid, ids[0],['ach_login','ach_uid']) + datas = self.read(cr, uid, ids[0], ['ach_login','ach_uid']) lots_obj = self.pool.get('auction.lots') recs = lots_obj.browse(cr, uid, rec_ids, context) for rec in recs: diff --git a/addons/auction/wizard/auction_lots_cancel.py b/addons/auction/wizard/auction_lots_cancel.py index edf530ac8aa..35207ff3bfc 100644 --- a/addons/auction/wizard/auction_lots_cancel.py +++ b/addons/auction/wizard/auction_lots_cancel.py @@ -43,11 +43,11 @@ class auction_lots_cancel(osv.osv): lots_obj = self.pool.get('auction.lots') invoice_obj = self.pool.get('account.invoice') - lot = lots_obj.browse(cr,uid,context['active_id'],context) + lot = lots_obj.browse(cr, uid, context['active_id'], context) if lot.ach_inv_id: - supplier_refund_inv_id = invoice_obj.refund(cr, uid,[lot.ach_inv_id.id]) + supplier_refund_inv_id = invoice_obj.refund(cr, uid, [lot.ach_inv_id.id]) if lot.sel_inv_id: - customer_refund_inv_id = invoice_obj.refund(cr, uid,[lot.sel_inv_id.id]) + customer_refund_inv_id = invoice_obj.refund(cr, uid, [lot.sel_inv_id.id]) return {} _columns = { diff --git a/addons/auction/wizard/auction_lots_invoice.py b/addons/auction/wizard/auction_lots_invoice.py index 9581941266f..999db109490 100644 --- a/addons/auction/wizard/auction_lots_invoice.py +++ b/addons/auction/wizard/auction_lots_invoice.py @@ -50,7 +50,7 @@ class auction_lots_invoice(osv.osv_memory): res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context) service = netsvc.LocalService("object_proxy") lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', [])) - auction = service.execute(cr.dbname,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0] + auction = service.execute(cr.dbname, uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0] price = 0.0 price_topay = 0.0 diff --git a/addons/auction/wizard/auction_transfer_unsold_object.py b/addons/auction/wizard/auction_transfer_unsold_object.py index 47aadc25d59..3e50a32f598 100644 --- a/addons/auction/wizard/auction_transfer_unsold_object.py +++ b/addons/auction/wizard/auction_transfer_unsold_object.py @@ -66,14 +66,14 @@ class auction_transfer_unsold_object(osv.osv): bid_line_obj = self.pool.get('auction.bid_line') lots_obj = self.pool.get('auction.lots') lot_history_obj = self.pool.get('auction.lot.history') - line_ids= bid_line_obj.search(cr,uid,[('lot_id','in',context['active_ids'])]) + line_ids= bid_line_obj.search(cr, uid, [('lot_id','in',context['active_ids'])]) bid_line_obj.unlink(cr, uid, line_ids) res = self.browse(cr, uid, ids) unsold_ids = lots_obj.search(cr,uid,[('auction_id','=',res[0].auction_id_from.id),('state','=','unsold')]) for rec in lots_obj.browse(cr, uid, unsold_ids, context): - new_id = lot_history_obj.create(cr,uid,{'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': rec.auction_id.auction1}) - up_auction = lots_obj.write(cr,uid,[rec.id],{'auction_id': res[0].auction_id_to.id, + new_id = lot_history_obj.create(cr, uid, {'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': rec.auction_id.auction1}) + up_auction = lots_obj.write(cr, uid, [rec.id], {'auction_id': res[0].auction_id_to.id, 'obj_ret':None, 'obj_price':None, 'ach_login':None, |
