Make a functional field editable in Openerp? -


how make functional field editable in openerp?

when create

'capname': fields.function(     _convert_capital, string='display name', type='char', store=true ), 

this displayed has read-only , can't able edit text.

how make field has editable?

you must add inverse function make field editable. parameter called fnct_inv in openerp v7. example:

def _get_test(self, cr, uid, ids, name, args=none, context=none):     result = dict.fromkeys(ids, false)     line in self.browse(cr, uid, ids, context=context):         if line.test:             result[line.id] = line.test     return result         def _set_test(self, cr, uid, id, field_name, field_value, args=none, context=none):     obj = self.browse(cr, uid, id)     record in obj:         if record.test != field_value:             # record exists              ...              cr.execute(                 'update your_table '                 'set test=%s '                 'where id=%s', (field_value, id)             )         else:             # new record              # (or value of field not modified)      return true  _columns = {     'test': fields.function(         string='string testing',          fnct=_get_test,          fnct_inv=_set_test,                     type='char',          size=50,          store=true,     ), } 

Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -