Odoo Help


Set the default product_uos_qty based on a custom field in the product form

Nick Adjei
on 6/22/16, 3:28 AM 216 views

I'm customizing Odoo 8.0 to support sale of Real Estate properties by each property's Gross internal Area (GIA) in square metres. I have created a custom model extending the product.template model with the following field 

'qty_gia': fields.integer('Floor Space', help="Gross internal area of property")

How do I create a function that will set the qty_gia value as the default product_uos_qty and quantity values in the sale_order_line and account.invoice.line models respectively?

Nikunj Antala
On 6/22/16, 8:57 AM

I think you can write onchange method on sale_order_line and account_invoice_line. so, while creating sale_order_line or account_invoice_line product_uos_qty will auto-populate form product screen.

def onchange_product(self)

    for line in self:


This code is for your reference. it may not be directly work.

Hope this help.

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: 6/22/16, 3:28 AM
Seen: 216 times
Last updated: 6/22/16, 8:57 AM