Community: Framework mailing list archives

expert-framework@mail.odoo.com

Edit domains with new API onchange

by
Leonardo Donelli
- 01/05/2015 12:10:05
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?