Odoo Help


How to pass product_ids from old sales order to new sales order.

on 3/3/16, 2:16 AM 444 views


Can anyone tell how can i pass product from old sales order into new sales order. I made one reference veriable of sales order as many2one in sales order, from here we can able to select any sales order. when i am creating a sales order i can able to select any previous orders , if i selected any one of them , i need to pass the entire products from that order line into my new sales order. How can i do that.?? i added one button for that, but its not working.

Thanking you,


i got a same situation in form , but its for purchase . exact same thing i needed for my sales. i am attaching that for reference.https://www.odoo.com/forum/help-1/question/how-to-fill-purchase-order-line-with-sale-order-line-9924

on 3/3/16, 4:40 AM
On 3/3/16, 7:30 AM

in this you all ready told that you created on but, you can continue with that,if you refer the module "sale_add_products_wizard" apps, you can easily add that into your function.

i will give you my code , if you can modify it .

def button_submission_submit(self,cr,uid,ids,context=None):

order_line_obj = self.pool.get('sale.order.line')

product_obj = self.pool.get('product.product')


partner = data.partner_id.id  

pricelist = data.pricelist_id.id  

line_ids = data.sale_id.order_line

for line in line_ids:

product_id = line.product_id.id

p = product_obj.browse(cr,uid,product_id)

uom_q = p.uom_id.id

qty_p = line.product_uom_qty 

product = self.pool.get('sale.order.line').product_id_change(cr, uid, ids,







val = {

'name': product['value'].get('name'),

'product_uom_qty': qty_p,

'order_id': ids[0],

'product_id': p.id or False,


'price_unit': product['value'].get('price_unit'), 


return True

@pks thank you , its working fine.

on 3/3/16, 7:34 AM

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: 3/3/16, 2:16 AM
Seen: 444 times
Last updated: 7/7/16, 6:23 AM