Skip to Content
Menu
This question has been flagged
1 Reply
1835 Views

Hello, 

I have a function for filling in many fields automatically with an api.onchange() decorator.

@api.onchange('nursery_morning', 'nursery_evening', 'responsible_partner')
def retrieve_responsible_nursery(self):
    if self.nursery_morning or self.nursery_evening:
        if self.responsible_partner:
            if not self.resp_civility1 and not self.resp_name1 and not self.resp_cp1 and not self.resp_num1 \
                    and not self.resp_address1 and not self.resp_town1 \
                    and not self.resp_phone1 and not self.resp_phonemobile1:
                self.resp_civility1 = self.responsible_partner.title.name
                self.resp_name1 = self.responsible_partner.name
                self.resp_cp1 = self.responsible_partner.zip_id.name
                self.resp_num1 = self.responsible_partner.street_number_id.name
                self.resp_address1 = self.responsible_partner.street_id.name
                self.resp_town1 = self.responsible_partner.city_id.name
                self.resp_phone1 = self.responsible_partner.phone
                self.resp_phonemobile1 = self.responsible_partner.mobile

 

Currently, the fields do not change once one of the fields listed are filled but not saved in database but I would like them to change until the recording is saved. Then the fields remain blocked. How to do ?

Thanks you :) 

Avatar
Discard
Best Answer

Verify all the fields are on the view and not readonly mode. 

Avatar
Discard
Related Posts Replies Views Activity
0
Mar 21
5196
3
Jul 20
18527
2
Jan 19
5093
1
Jul 18
6089
1
Apr 18
2542