Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
9325 Weergaven

Hi,

I want to do an operation when a form is opened, is there any function is working at the time of opening of a form.I have tried with onchange and compute function but i think it will be depend on particular fields.Is there any other options available for the above purpose.

Expecting fast answers

Avatar
Annuleer
Beste antwoord

Hi peter,

Can you try the following function 

def fields_view_get

Thanks

Avatar
Annuleer
Beste antwoord

Hi,

You can check the function named view_init. 

In your odoo directory you can find the description of this function from the file odoo->models.py.

@api.model
def view_init(self, fields_list):
""" Override this method to do specific things when a form view is
opened. This method is invoked by :meth:`~default_get`.
"""
pass

Just write/super this function in your required model and you do the required operations in this function

Hope it helps

Avatar
Annuleer

This would be perfect if only it was called when opening an existing record. Currently it is only at creating a new one.

Beste antwoord
def read(self, fields=None, load='_classic_read'): 
	res = super(MyModel, self).read(fields=fields, load=load) 
	​//custom code

return res

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
jun. 24
4190
0
feb. 25
830
3
nov. 23
17332
3
nov. 24
24962
1
apr. 23
6082