Odoo Help


take value of a field on item add - sale order form

Daouda Diop
on 8/12/16, 11:17 AM 302 views

Hello !

I added a field in the sale order form and in the product template.

When, in the sale order form, I add an item, i want that the field I added in the form take the value of the field in the product template.

Do you know how can I do that ?

Sorry for my english.



Bejaoui Souheil

--Bejaoui Souheil--
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant


Bejaoui Souheil
On 8/13/16, 5:51 AM


Rather you use @api.onchange to update the sale order line field by any value you want

@api.onchange('field1', 'field2') # if these fields are changed, call method
def check_change(self):
    if self.field1 < self.field2:
        self.field3 = True # filed3 get True in the form view if field1 < field2

Or you can use related field. The field will be updated automatically by the ORM

field_x = fields.Char(related='product_id.field_x', store=True)

Best regards

Daouda Diop
On 8/16/16, 6:24 AM

Thanks for your answers.

I used a related field and it worked fine. But when I change the value of my field in order line, it also change the value in product template.

Ajeet Yadav
On 8/13/16, 2:22 AM

You can inherit product onchange of sale order line form and and update value from product template in your new field. 

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/12/16, 11:17 AM
Seen: 302 times
Last updated: 8/16/16, 6:24 AM