Skip to Content
Menu
This question has been flagged
1 Reply
5409 Views

Hi,

I need to know how to duplicate one of the field value for another field without any action.is it possible or not.

if anyone knows please help me!

Avatar
Discard
Best Answer

Hi,

You can define the second field in which the value of the first field has to store as a Related field.

first_field = fields.Many2one('res.partner', string="Field 1")
second_field = fields.Char(string="Field 2", related=first_field.name)

Check whether the above method is working or not. If not write value to second field using the onchange.

@api.onchange('first_field')
def set_second_field(self):
      if self.first_field:
           self.second_field = self.first_field.name                                                                                                                 

Thanks

Avatar
Discard
Related Posts Replies Views Activity
2
Feb 24
13200
1
Dec 22
3863
2
Dec 22
12725
2
Jun 22
4688
2
Jun 22
3505