Sorting and Filtering of functional fields in OpenERP

As per OpenERP policy, sorting and filtering of functional field will not be available in version 6.0.

So, as a workaround I found a way out. For all those functional fields which requires sorting and filtering we make a duplicate normal field (if the functional field is of type float, we create a new field of type fields.float). And keep the duplicate normal field in tree view and the actual functional field in form view. Now, to copy the value of functional field into duplicate normal field there are 2 strategies.

1. Accurate Value Method

The value of functional field is calculated when the value in other fields change. So, we can inherit create() and write() methods of that object and update our new duplicate normal field appropriately.

2. Approximate Value Method

We can run a cron job which calls the function of functional field and updates the duplicate normal field. Though, this method does not show the accurate value in tree view, but the user can see the exact value in form view. This method should be used when the overhead of create() and write() method is too expensive.

4 thoughts on “Sorting and Filtering of functional fields in OpenERP

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s