Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
3 Besvarelser
5533 Visninger

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
Kassér
Bedste svar

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
Kassér
Bedste svar

You click the one2many field  and add Mark field then save 

Avatar
Kassér
Forfatter

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