[REF] netsvc: netsvc wont provide any longer LocalService("object_service"), better use the model directly.
bzr revid: vmt@openerp.com-20110729090820-6kvt9a2swqeepmhn
This commit is contained in:
parent
f4a8ef10df
commit
9ea28d5970
|
@ -21,14 +21,15 @@
|
|||
|
||||
from report.interface import report_int
|
||||
import netsvc
|
||||
import openerp.pooler
|
||||
|
||||
class report_artistlot(report_int):
|
||||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
|
||||
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'])
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
lots = pool.get('auction.lots').read(cr, uid, ids, ['artist_id'])
|
||||
artists = []
|
||||
for lot in lots:
|
||||
if lot['artist_id'] and lot['artist_id'] not in artists:
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
##############################################################################
|
||||
|
||||
from report.interface import report_int
|
||||
import netsvc
|
||||
import openerp.pooler
|
||||
|
||||
class auction_seller(report_int):
|
||||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
|
||||
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'])
|
||||
pool = openerp.pooler.get_pool(cr.dbname)
|
||||
lots = pool.get('auction.lots').read(cr, uid, 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 = pool.get('auction.deposit').read(cr, uid, new_ids, ['partner_id'])
|
||||
for l in partners:
|
||||
if l['partner_id']:
|
||||
parts[l['partner_id'][0]]=True
|
||||
|
|
|
@ -32,10 +32,8 @@ class report_custom(report_rml):
|
|||
report_rml.__init__(self, name, table, tmpl, xsl)
|
||||
|
||||
def create_xml(self, cr, uid, ids, datas, context=None):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
|
||||
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 = self.pool.get('auction.lots').read(cr, uid , ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
|
||||
auction = self.pool.get('auction.dates').read(cr, uid, [lots[0]['auction_id'][0]])[0]
|
||||
|
||||
unsold = comm = emp = paid = unpaid = 0
|
||||
est1 = est2 = adj = 0
|
||||
|
@ -75,7 +73,7 @@ class report_custom(report_rml):
|
|||
|
||||
|
||||
debit = adj
|
||||
costs = service.execute(cr.dbname, uid, 'auction.lots', 'compute_seller_costs', ids)
|
||||
costs = self.pool.get('auction.lots').compute_seller_costs(cr, uid, ids)
|
||||
for cost in costs:
|
||||
debit += cost['amount']
|
||||
|
||||
|
|
|
@ -141,9 +141,8 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
|
||||
|
||||
def _photos_send(cr, uid, uname, passwd, did, ids):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
for (ref,id) in ids:
|
||||
datas = service.execute(cr.db_name, uid, 'auction.lots', 'read', [id], ['name','image'])
|
||||
datas = self.pool.get('auction.lots').read(cr, uid, [id], ['name','image'])
|
||||
if len(datas):
|
||||
bin = base64.decodestring(datas[0]['image'])
|
||||
fname = datas[0]['name']
|
||||
|
@ -186,8 +185,7 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
|
||||
lots_ids = []
|
||||
datas = self.read(cr, uid, ids[0],['uname','login','lang','numerotation','dates'])
|
||||
for l in lots:
|
||||
|
|
|
@ -132,9 +132,8 @@ class auction_lots_pay(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
import pickle
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
datas = self.read(cr, uid, ids[0],['uname','password','dates'])
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','obj_price'])
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, context['active_ids'], ['obj_num','obj_price'])
|
||||
args = pickle.dumps(lots)
|
||||
self._catalog_send(datas['uname'], datas['password'], datas['dates'], args)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
|
|
@ -49,9 +49,8 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
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]
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, context.get('active_ids', []))
|
||||
auction = self.pool.get('auction.dates').read(cr, uid, [lots[0]['auction_id'][0]])[0]
|
||||
|
||||
price = 0.0
|
||||
price_topay = 0.0
|
||||
|
@ -59,7 +58,7 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
for lot in lots:
|
||||
price_lot = lot['obj_price'] or 0.0
|
||||
|
||||
costs = service.execute(cr.dbname, uid, 'auction.lots', 'compute_buyer_costs', [lot['id']])
|
||||
costs = self.pool.get('auction.lots').compute_buyer_costs(cr, uid, [lot['id']])
|
||||
price_lot += costs['amount']
|
||||
price += price_lot
|
||||
|
||||
|
@ -68,7 +67,7 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
raise osv.except_osv(_('UserError'), _('Two different buyers for the same invoice !\nPlease correct this problem before invoicing'))
|
||||
uid = lot['ach_uid'][0]
|
||||
elif lot['ach_login']:
|
||||
refs = service.execute(uid, 'res.partner', 'search', [('ref','=',lot['ach_login'])])
|
||||
refs = self.pool.get('res.partner').search(cr, uid, [('ref','=',lot['ach_login'])])
|
||||
if len(refs):
|
||||
uid = refs[-1]
|
||||
if 'ach_pay_id' in lot and lot['ach_pay_id']:
|
||||
|
@ -105,7 +104,6 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
datas = {'ids' : context.get('active_ids',[])}
|
||||
res = self.read(cr, uid, ids, ['number','ach_uid'])
|
||||
res = res and res[0] or {}
|
||||
|
|
Loading…
Reference in New Issue