0
votes

I have a little problem.

I have a wizard where i have all sale orders BUT i need to have only those that have balance less than 0 (zero). Balance field is a functional field so domain is not working.

Any ideeas how i can resolve this ? I need to be able to select those sale orders that have balance less than 0.

Thank you!

1

1 Answers

0
votes

For fields of type function or compute you have two options:

1) Either give the field the attribute store=True so that the calculated values are saved on the database

2) Or even better provide your own search method that will do the searching and apply the domain.

How you will do the above depends on the version of Odoo that you are using. Take a look at the documentation on odoo/fields.py on field class. Use the search parameter on the field definition:

    One can define a field whose value is computed instead of simply being
    read from the database. The attributes that are specific to computed
    fields are given below. To define such a field, simply provide a value
    for the attribute ``compute``.

    :param compute: name of a method that computes the field

    :param inverse: name of a method that inverses the field (optional)

    **:param search: name of a method that implement search on the field (optional)**