Using Odoo 13 Community Edition on Windows.
I'm trying to learn how onchange works.
I want to change a many2one field (id) when the user chooses a specefic value from a selection field.
I have the selection field:
vorgang_auswahl = fields.Selection([
('gewinde', 'Gewinde schneiden'),
('senken', 'Senken'),
('kanten', 'Kanten'),
('mikro', 'Mikroecken entfernen'),
('schweissen', 'Schweißen'),
('schleifen', 'Schleifen')],
string="Operations", default="gewinde")
So if the user choose the value "gewinde" the field "workcenter_id" should change to a specefic workcenter.
I'm doing this in the "mrp_routing.py".
I tried to get an answer from other questions but still i dont get it.
The base is something like:
@api.onchange('vorgang_auswahl')
def _onchange_vorgang_auswahl(self):
if (((self.vorgang auswahl = 'gewinde')))
self.workcenter_id = ((('6')))