Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: Edit domains with new API onchange

by
Pedro M. Baeza
- 01/08/2015 05:38:10
Hi, Leonardo,

Try this: put a related field on line for the header field, and code an onchange for this field.

Regards.

2015-01-07 11:27 GMT+01:00 Leonardo "LeartS" Donelli <learts92@gmail.com>:
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 ]

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe