This question has been flagged
2 Replies
4985 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..

Avatar
Discard
Best Answer

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.

Avatar
Discard
Best Answer

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

Avatar
Discard