Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: Edit domains with new API onchange

by
Leonardo Donelli
- 01/07/2015 05:24:23
Thanks for your answers,
I didn't know you can still return 'domain' and 'warning' in a
onchange decorated method, good!

I am now facing another related problem: if you look at my example
you'll see I have to edit
the domain of a field of sale.order.line based on a field of sale.order.

I tried by putting the onchange on sale.order and returning something like

    'domain': {
                'order_line.product_id': [('shelf_life', '=', 'dry')]
            }

but it doesn't work (no errors but the domain is not applied).

I also tried putting the onchange on the line directly:

    @api.onchange('order_id.goods_type')

but it gives an error on initialization:

    _logger.warning("@onchange%r parameters must be field names",
func._onchange)
    [ followed by semi related error when trying to log the warning
about list not having _onchange attr ]