Odoo Help

5
4
Anaël Closson (acl)
On 3/26/13, 8:07 AM

Integer (and float) fields are actually well searchable.

If some integer fields aren't, it's because they hide functional fields. In those field, the integer value is computed each time the values shows up in form fields.

You can't search through those values as they are not available in a computed form. Using the computing function when searching is not a good idea either as it may be CPU intensive.

fnct_search

A solution can be to assign a search dedicated function to the field. This may be intersting when you can return false positives, use an optimized method or you may search other data than the actual field. That function is setup using the "fnct_search" parameter of field.function(). Unfortunately this is not always the best solution.

store

A second one is to ask the server to store the computed value. But in order to update the value when needed, you also need to know what will update it : which data change should trigger the field computation ?

Here the default is to recompute it when the object changed. Therefore you can use the "store=True" parameter. But as it may not be accurate if your value depends of other objects, you may also use a 3-tuple like this one : (mapping_function,['trigger_field1','trigger_field2'],priority).

  • mapping_function : returns the list of ids that needs to be recomputed

  • ['trigger_field1','trigger_field2'] : fields that triggers computation when changed

  • priority : allows ordering functional fields, useful to computed functional fields based on others

For this one, you need to take into account that it needs a database structure change when added on fields that don't have the store attribute, and that it may sometimes be difficult to predict which changes will trigger an update.

You may find more information about it in fields.py : bazaar.launchpad.net/~openerp/openobject-server/7.0/view/head:/openerp/osv/fields.py#L840

With that in mind, if you still think a field should be searchable (technically and practically), then a bug report is sure welcome.

ok!!!!!!!!I just need to filter openerp.com standard fileds like Quantity on hand.

AD LIBITOM, michel Guénard
on 3/26/13, 9:05 AM

alvar.vilu just wrote This is not a bug. You can not sort nor filter by function values! I do not understand this statement; I just want to be able to filter fields appearing on the search box of the online standard V7; until now I obtain no result when filtering on" quantity on hand"

AD LIBITOM, michel Guénard
on 3/31/13, 4:37 PM

Yes, those fields should not be listed, like in the 6.x OpenERP series... this should be corrected soon.

Anaël Closson (acl)
on 4/2/13, 5:23 AM

If field can be filtered via "Advanced Search" in a standard OpenERP v7 installation and it does not work, like with Quantity on Hand and Future Stock (new name of Forecast), than it is a bug. These fields should not appear in the Advanced Search field list, if they are not filterable.

wjn
on 4/7/13, 9:18 AM

@Anael Closson: We started recently with consignment stock in OpenERP. To do so, an additional location under warehouses was created. Now we want to see all products in consignment, thus we have to filter on "on hand / delivered" or "forecasted / future stock". Otherwise we have to check over 700 products, or, like you suggested, create some custom fields/report.

wjn
on 4/16/13, 8:02 PM

Hi all, even I'm facing a same issue. Did you find any solution to filter on quantity on hand?

Sam path
on 4/24/14, 5:50 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/24/13, 11:17 AM
Seen: 5156 times
Last updated: 1/22/16, 8:31 AM