[IMP] index on partner's ref

bzr revid: fp@tinyerp.com-20110110170328-85g072pod3v2x3d9
This commit is contained in:
Fabien Pinckaers 2011-01-10 18:03:28 +01:00
parent 438232f6be
commit 849e49a2b4
3 changed files with 10 additions and 3 deletions

View File

@ -136,6 +136,7 @@ class ir_property(osv.osv):
return super(ir_property, self).create(cr, uid, self._update_values(cr, uid, None, values), context=context)
def get_by_record(self, cr, uid, record, context=None):
print 'record type', record.type
if record.type in ('char', 'text'):
return record.value_text
elif record.type == 'float':
@ -157,13 +158,18 @@ class ir_property(osv.osv):
return False
def get(self, cr, uid, name, model, res_id=False, context={}):
print 'Property Get', name, model
domain = self._get_domain(cr, uid, name, model, context=context)
if domain is not None:
domain = [('res_id', '=', res_id)] + domain
nid = self.search(cr, uid, domain, context=context)
print 'DOMAIN', domain, nid
if not nid: return False
record = self.browse(cr, uid, nid[0], context=context)
return self.get_by_record(cr, uid, record, context=context)
print 'RECORD', record
res = self.get_by_record(cr, uid, record, context=context)
print 'Result', res
return res
return False
def _get_domain_default(self, cr, uid, prop_name, model, context=None):

View File

@ -113,9 +113,9 @@ class res_partner(osv.osv):
'name': fields.char('Name', size=128, required=True, select=True),
'date': fields.date('Date', select=1),
'title': fields.many2one('res.partner.title','Partner Form'),
'parent_id': fields.many2one('res.partner','Parent Partner', select=2),
'parent_id': fields.many2one('res.partner','Parent Partner'),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Partner Ref.'),
'ref': fields.char('Reference', size=64),
'ref': fields.char('Reference', size=64, select=1),
'lang': fields.selection(_lang_get, 'Language', size=5, help="If the selected language is loaded in the system, all documents related to this partner will be printed in this language. If not, it will be english."),
'user_id': fields.many2one('res.users', 'Salesman', help='The internal user that is in charge of communicating with this partner if any.'),
'vat': fields.char('VAT',size=32 ,help="Value Added Tax number. Check the box if the partner is subjected to the VAT. Used by the VAT legal statement."),

View File

@ -983,6 +983,7 @@ class property(function):
prop = obj.pool.get('ir.property')
domain = [('fields_id.model', '=', obj._name), ('fields_id.name','in',prop_name), ('res_id','=',False)]
ids = prop.search(cr, uid, domain, context=context)
print 'GOT IDS', ids, 'FOR', prop_name
replaces = {}
default_value = {}.fromkeys(prop_name, False)
for prop_rec in prop.browse(cr, uid, ids, context=context):