Improved related changes for browse support in reference field

bzr revid: hda@tinyerp.com-20100317141130-08v21img7a8tu9qx
This commit is contained in:
RGA(OpenERP) 2010-03-17 19:41:30 +05:30 committed by HDA (OpenERP)
parent 2dcd545f69
commit 397b5a36d8
2 changed files with 7 additions and 22 deletions

View File

@ -325,26 +325,17 @@ class calendar_attendee(osv.osv):
result[id][name] = ', '.join(fromdata)
if name == 'event_date':
if attdata.ref:
model, res_id = tuple(attdata.ref.split(','))
model_obj = self.pool.get(model)
obj = model_obj.read(cr, uid, res_id, ['date'])[0]
result[id][name] = obj.get('date')
result[id][name] = attdata.ref.date
else:
result[id][name] = False
if name == 'event_end_date':
if attdata.ref:
model, res_id = tuple(attdata.ref.split(','))
model_obj = self.pool.get(model)
obj = model_obj.read(cr, uid, res_id, ['date_deadline'])[0]
result[id][name] = obj.get('date_deadline')
result[id][name] = attdata.ref.date_deadline
else:
result[id][name] = False
if name == 'sent_by_uid':
if attdata.ref:
model, res_id = tuple(attdata.ref.split(','))
model_obj = self.pool.get(model)
obj = model_obj.read(cr, uid, res_id, ['user_id'])[0]
result[id][name] = obj.get('user_id')
result[id][name] = (attdata.ref.user_id.id,attdata.ref.user_id.name)
else:
result[id][name] = uid
if name == 'language':
@ -441,8 +432,7 @@ request was delegated to"),
for att in self.browse(cr, uid, ids, context=context):
sign = att.sent_by_uid and att.sent_by_uid.signature or ''
sign = '<br>'.join(sign and sign.split('\n') or [])
model, res_id = tuple(att.ref.split(','))
res_obj = self.pool.get(model).browse(cr, uid, res_id)
res_obj = att.ref
if res_obj and len(res_obj):
res_obj = res_obj[0]
sub = '[%s Invitation][%d] %s' % (company, att.id, res_obj.name)
@ -490,9 +480,7 @@ request was delegated to"),
if user:
ref = vals.get('ref', None)
if ref:
model, event = ref.split(',')
model_obj = self.pool.get(model)
event_ref = model_obj.browse(cr, uid, event, context=context)[0]
event_ref = ref
if event_ref.user_id.id != user[0]:
defaults = {'user_id': user[0]}
new_event = model_obj.copy(cr, uid, event, default=defaults, context=context)

View File

@ -74,17 +74,14 @@ class calendar_attendee(osv.osv):
result[id] = {}
if name == 'categ_id':
if attdata.ref:
model, res_id = tuple(attdata.ref.split(','))
model_obj = self.pool.get(model)
obj = model_obj.read(cr, uid, res_id, ['categ_id'])[0]
result[id][name] = obj.get('categ_id')
result[id][name] = (attdata.ref.categ_id.id,attdata.ref.categ_id.name,)
else:
result[id][name] = False
return result
_columns = {
'categ_id': fields.function(_compute_data, method=True, \
string='Event Type', type="many2one", \
relation="crm.case.categ", multi='categ_id'),
relation="crm.case.categ", multi='categ_id'),
}
calendar_attendee()