Technical mailing list archives
Re: Edit domains with new API onchangeby
But don't put @api.one, because the return value will be encapsulated in a list.
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: https://www.odoo.com/groups/community-framework-62 > Post to: mailto:firstname.lastname@example.org > Unsubscribe: https://www.odoo.com/groups?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 http://www.camptocamp.com/
Post to: mailto:email@example.com