This question has been flagged

Hello, I'm using Odoo 13 Community Edition.


In the product_template.py I have the onchange method:


    @api.onchange('beschichtung')

    def _onchange_beschichtung(self):

        if self.beschichtung.id == 2:

            self.route_ids = [1, 5]

        else:

            self.route_ids = [8]     


My custom field "beschichtung" in product_template.py:

beschichtung = fields.Many2one(

        'mrp.beschichtung', 'Beschichtung', required=True, help="Beschichtungsart auswählen")




If I open the common form view, the onchange method works correctly, for example if I choose the "beschichtung" id 2, the routes 1 and 5 are selected.

But when I want to create a new sale order and I want to create a new product in it or edit a product (so it opens the extended view), nothing happens if I choose a "beschichtung" id, so what is wrong?

Avatar
Discard