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.

1

Sale Order LIne Selected by Product Code not by Product Name

By
Sansal Birbas
on 12/3/14, 12:24 AM 950 views

Hi All,

In Sales Module, when we want to create a new sales order , its required to choose products. Normally we do it by selecting product names among available products. I need to change that. I must choose according to product codes. So I created a new field called x_product_code of char type in product.template object. I checked the sale.order.line model. My new field appears there. Then in the view of sale order creation (sale.order.form), i tried to add my own x_product_code field. But i could not understand how i should relate it with the other elements. especially, on_change part . How must i fill in that? When i choose product code, the other elements such as product name in slae order line must be filled automatically. Could you help me with that, please? 

 

Kind Regards..

1

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 12/3/14, 9:39 AM

Hi Sansal,

There is no need to create new fields for that. You can use Internal Reference field available in the product form (under "Information" tab). Give the product code there. So that in sale order lines, you only need to type in the product code to get the product you want.

0

Hi Sansal,

     In sale.order.line class by default there will be an on change function created for product selectiion as "onchange_product_id" which will be used to return the default order line fields. So we have to override this method and manage your code aswell to return the data for new fields.

Cheers

Kiran Kumar

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: 12/3/14, 12:24 AM
Seen: 950 times
Last updated: 3/16/15, 8:10 AM