Odoo Help


Sale Order LIne Selected by Product Code not by Product Name

Sansal Birbas
on 12/3/14, 12:24 AM 1,504 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..


Akhil P Sivan

--Akhil P Sivan--

| 5 4 7
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.


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.


Kiran Kumar

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