Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to update only one field of one2many field in odoo8?

By
Undan
on 8/17/16, 8:43 AM 217 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

.



1
Deepak Krishna
On 8/23/16, 3:19 AM

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
0
Arunkumar
On 8/18/16, 2:19 AM

You click the one2many field  and add Mark field then save 

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

Undan
on 8/18/16, 3:00 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/17/16, 8:43 AM
Seen: 217 times
Last updated: 8/23/16, 3:22 AM