I need to create a table in a new Odoo Studio module. A new line should be added to calculate the cost of employee meals. I'm trying to make it so when I select the type of meal, the cost changes.



I need to create a table in a new Odoo Studio module. A new line should be added to calculate the cost of employee meals. I'm trying to make it so when I select the type of meal, the cost changes.



The key point is step 3 — Studio doesn't support onchange directly, so the trick is using a related field (meal_type_id.cost) as the default, or if they need true dynamic behavior, they'll need a small custom module with @api.onchange('meal_type_id') to copy the cost over.
Hope it helps
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
unbild decimail place
Résolu
|
1
mai 26
|
2686 | ||
|
0
août 23
|
3879 | |||
|
0
juil. 23
|
2412 | |||
|
1
juil. 23
|
3820 | |||
|
Remove (studio) custom field
Résolu
|
1
mars 23
|
8032 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
"result" is a local variable so outside the method the value is not available.
You need to assign result to a field, like record['amount'] = result
You also need to loop through all records to support multi editing.
Review the documentation and other forum posts for examples.