Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
7467 Представления

How to add onchange event with Save, Create or Edite Buttons (these are default button within a form)?

Аватар
Отменить
Лучший ответ

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
нояб. 23
1257
3
июн. 21
12717
1
нояб. 15
5725
1
янв. 24
1411
2
июл. 22
4739