Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2304 Widoki

Can someone provide a simple example of how to use on_change ?

I want that when a user changes the value of many2one field, the on_change method would fetch values of the parent object and populate other fields with them.

I areally appreciate your help.

 

Awatar
Odrzuć
Najlepsza odpowiedź

Hi Abdullah,

   First of all you decide the field to give on-change then add on_change attribute to that field

<field name="demo_field" on_change="onchange_demo_field(arguments)"/>

 

Then define onchange function in .py file:-

def onchange_demo_field(self, cr, uid, ids, product_id, product_qty=0, context=None):
        res = {}

        function body
        return res

 

Awatar
Odrzuć