Help

2

How to change the value of a field through Based on Form Modification of Automated action and server action in odoo 9 ?

Avatar
deb

I want to change the field value, when i select value of another field like sate and country. But I want to do that through automated action and server action. For that, i create a custom model x_city and x_city  model contain two field name city and state id , after that create a field x_city_id  in crm.lead  model. My requirement is when I select city, then corresponding state automatic fill the state field. 


For that i create a automated action and select Based on Form Modification option from When to Run field, then x_city_id name give to the  On Change Fields Trigger field, then write A server action for this. Ie


    City_id = object.x_city_id

    If city_id:

    State_id_city = self.pool.get ('x_city'). Browse (cr, uid, city_id, context) .x_state_id.id And i want to need when server action run, then it returns the below code, ie


    Return {'value': {'state_id': state_id_city}}


So, if you have any idea please share with me. Thank you.

Avatar
Discard