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

I have already added some values in one2many field and on button click i want to update only one field value. How can i do that?

For example :

my one2many field stud_details  have values:

Roll No
Name
Mark
1
abc

2
pqr

Here rollno , name are already added and on Clicking BUTTon "UPDATE" the marks field need to get updated..

I need to add the same mark for all the students..

for say, for taking marks values having one integer field called Mark_update field, and on clicking the button "UPDATE" the values in Mark_update field  need to get updated to the one2many  Mark field for all student

.



Avatar
Discard
Best Answer

You can Use write() method for updating the one2many field.

For example :            

Here below is the code , here we can write mark for each record in one2many field.

for record in self.browse(cr,uid,ids,context=context): 
    for order in record.stud_details:      
        order.write({'mark': record.mark_update})
return
Avatar
Discard
Best Answer

You click the one2many field  and add Mark field then save 

Avatar
Discard
Author

Bro, i have updated my question , please go through it and guide me with the necessary.