A Dijous, 31 de desembre de 2009, [email protected] va escriure:
> class hotel_book(osv.osv):
> _name = 'hotel.book'
>
> def _complete_name(self, cr, uid, ids, name, args, context):
>
> t = {1: u'Physical Locations',
> 2: u'Partner Locations',
> 3: u'Virtual Locations'}
> print t
> return t
You should only return a value for the ids you've been queried. Probably
something like this:
t = {1: u'Physical Locations',
2: u'Partner Locations',
3: u'Virtual Locations'}
result={}
for id in ids:
result[id] = t.get(id,False)
return result
>
> def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
> #res = self.name_get(cr, uid, ids, context=context)
> t = {1: 'My Name',
> 2: 'My Other ',
> 3: 'Nhat'}
> return t
The same here.
>
> _columns = {
>
> 'check_in_date': fields.datetime('Created In', required=True),
> 'check_out_date': fields.datetime('Created Out'),
> 'room_id': fields.many2one('hotel.room', 'Room',required=True),
> 'name': fields.function(_name_get_fnc, method=True, type="char",
> string='Full Name') }
> I have fields.function type 'char', but I don't know returned data in
> function _name_get_fnc ( function get value), In this function I return
> dict and even thought 'string' type, but fields always is readonly status,
> please help me fix this issue.
Function fields are always read-only by default.unless you implement
'fnct_inv' parameter. Take a look at:
http://doc.openerp.com/developer/2_5_Objects_Fields_Methods/field_type.html
>
> Many Thanks
>
> Vu Nhut
>
>
>
>
> -------------------- m2f --------------------
>
> --
> http://www.openobject.com/forum/viewtopic.php?p=48765#48765
>
> -------------------- m2f --------------------
>
>
> _______________________________________________
> Tinyerp-users mailing list
> http://tiny.be/mailman2/listinfo/tinyerp-users
>
--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18
_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman2/listinfo/tinyerp-users