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

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

By
Nick Adjei
on 6/22/16, 3:28 AM 168 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?

0
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:

        line.product_uos_qty=line.product_id.qty_gia

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/22/16, 3:28 AM
Seen: 168 times
Last updated: 6/22/16, 8:57 AM