Skip to Content
Menu
This question has been flagged
2 Replies
3195 Views

how to  set default field value (subject name)  when a particular field(branch)  is selected .

in my menu Branch ,I have branchname.When the user enters the branch name I have to show all the Subjects corresponding to  the branch...How to implement it..

Please Help

Thanks in Advance

Avatar
Discard

Hi, you can use onchange function for the field branch and set value in all required fields.

Look Into Odoo Customization Tips: https://www.scoop.it/t/learn-openerp

Best Answer

Hi Aswathy,

There are actually a few ways to do this. The best way (most likely) is to create an onchange which automatically fills in the subject name field with the value you'd like. Some concept code:

@api.onchange('branche_id')
def change_subject_name(self):
    self.subject_name = self.branche_id.name or 'Custom title'

Regards,
Yenthe

Avatar
Discard