Community: Framework mailing list archives

Re: Edit domains with new API onchange

Camptocamp SA, Guewen Baconnier - Software Developer, Camptocamp
- 01/06/2015 02:29:40
On 01/05/2015 06:12 PM, Leonardo "LeartS" Donelli wrote:
> With the old API, in an onchange function I could return a dictionary
> with a 'domain' key to alter the domain of a field dynamically based
> on the changed field. How can I do this with the new API?
> Here's the concrete example I'm working on: I've added a selection
> field to products for their shelf life (fresh, dry, maybe others in
> the future) and a similar selection field to sale order (goods_type:
> fresh, dry, mixed, maybe others in the future).
> I want the domain of the product_id field of the order lines to change
> according to selected goods_type of the sale order: fresh ->
> ('shelf_life', '=', 'fresh'); dry -> ('shelf_life', '=', 'dry'); mixed
> -> no domain
> Any ideas?
> _______________________________________________
> Mailing-List:
> Post to:
> Unsubscribe:

You can still return a dict from the methods decorated with
@api.onchange, either with a 'domain' or a 'warning'.

Guewen Baconnier
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 39
Office: +41 21 619 10 10