Show Account Number(Partial or Semi Visible Number) Formatting in OpenERP 7.0

HI All,

Here I am in a situation to display either a charecter or integer field which is capable to store a 10 digit value,

and need to display it in semi password/ semi visible format.

I mean if the account number is 9876543210123, i just want to show 987*******123 in the list or tree view.

Can anyone help me to do the above formatting, Is there any default widget available.

Also any suggestions for creating a custom widget or any other way to acheive the above need is appeciable.

Thanks In Advance.

Komala Kiran Kumar,

If you want the whole text as *, use widget="password", or password='1'.

You can override the read method which can do the job better.

See the example:

vals = super(account_voucher, self).read(cr, uid, ids, fields, context, load)
        for val in vals:
            if val.get('cc_number', False) :
                dec_data = rsa_encrypt.decrypt(val.get('cc_number', False), val.get('key', False))
                val['cc_number'] = dec_data
                if context.get('cc_no', '') != 'no_mask':
                    i = len(val['cc_number']) - 4
                    val['cc_number'] = 'X' * i + val['cc_number'][-4:len(val['cc_number'])]
        if not is_list:
            vals = vals[0]
        return vals


Need more info?

This documentation page has been extracted from the Q&A section where you can discuss it and get feedback.
Related question