How to dd a function field in odoo


py file

from openerp.osv import fields, osv

def _a_text(self, cursor, user, ids, name, arg, context=None):
res = {}
for order in self.browse(cursor, user, ids, context=context):
res[order.id] = order.name
return res
class sale(osv.osv):
_inherit = “sale.order”
_columns = {
‘a_name’: fields.function(_a_text, string=’Amount Total (Text)’, type=’char’),
}

xml file

<field name=”a_name”/>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s