Skip to Content
Menu
This question has been flagged
3 Replies
5317 Views

Is it possible to have a Many2One field equal a default value?  I am trying to have a Many2One field return a certain value from the menu I selected if a checkbox is true.  

Avatar
Discard
Best Answer

Hello Doug, 

You just need to create the computed fields and put the condition on the function as per your requirements. 

Feel free to ask if you still have any doubt. 

Thanks

Anisha Bahukhandi

Avatar
Discard
Best Answer

Hi,

For Many2one you can set a default value in different ways, like you can call a default function and set the default value for it, or you can make the field as computed function or you can achieve the same by passing default values in the context.


If you are looking to filter the values in the many2one field, based on the another field in the same form, you can return domain for the many2one field from the onchange of the first Field, you can see a example here:  https://www.youtube.com/watch?v=IpXXYCsK2ow


And if you are looking to set the value of the Many2one field while changing a field value, you can write a onchange function for the first field, see: https://www.youtube.com/watch?v=qyRhjyp1MeE&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM&index=39

Thanks

Avatar
Discard