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 :)