This question has been flagged
2 Replies
5959 Views

to start with I just want to be able to set a char field in a res.partner object given that the 'supplier' boolean is set to true. So far I know that I can use automated actions to call a server action when the supplier field is changed. I don't know how to write the python code for the server action. And I don't know how to only execute it if the boolean is true. Could I please get some pointers on this?

Avatar
Discard

please elaborate your query ," I just want to be able to set a char field in a res.partner object given that the 'supplier' boolean is set to true" and "And I don't know how to only execute it if the boolean is true"

Author

@Prakash Sharma does my response below make more sense?

Author Best Answer

Let me be more clear. In the res.partner.form view the user can tick or untick the checkbox which says that the contact is a 'Vendor' (by default the model calls this field 'supplier' and it is a boolean). I want to be able to set the value of a custom char field to 'whatever' if the 'supplier' boolean is set to true, otherwise I want that char field empty. This is all just a stepping stone for me to eventually be able to do something more complex but I'll omit that as I don't want to add complexity here.

So far I know that I can use automated actions to call a server action when the 'supplier' field is changed. I don't know how to write the python code for the server action. Could I please get some pointers on this?

Avatar
Discard