How to add onchange event with Save, Create or Edite Buttons (these are default button within a form)?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Бухоблік
- Склад
- PoS
- Project
- MRP
Це запитання позначене
You can try to override the create/write methods and call the onchange methods.
Ex:
@api.model
def create(self, vals):
res = super(...).create(vals)
res.onchange_product_id()
return res
You cannot you can only just override the create/write methods like Sudhir Arya suggested.
If you want to do operations before the data is saved you have to do before the super(<your_class_name>).create(vals) method. Then your data is in the vals dict. If you need the record to be already save do it after. Then your data is in the res object.
Oh and you do not need the onchange decorator on the method you wanna execute.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
РеєстраціяRelated Posts | Відповіді | Переглядів | Дія | |
---|---|---|---|---|
|
0
лист. 23
|
1127 | ||
|
3
черв. 21
|
12532 | ||
|
1
лист. 15
|
5609 | ||
|
1
січ. 24
|
1290 | ||
|
2
лип. 22
|
4576 |