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

Save multiple order_line

By
Jerome Guerriat
on 10/16/15, 8:03 AM 301 views

Hi everyone,

i'm completely new to odoo and i'd like some help for something i'm doing.
I extended the product.product model, and added a m2m relation with the class itself, so a product can be "linked" to another product.

Now, i would like to be able to add those "linked products" to my sale_order when i add the "master" product.

I extended the sale_order class and i'm trying to redefine the method _create, but i don't know what to do next. I can't iterate on self.order_line :/


@api.model

def create(self, vals):

     for line in self.order_line:

        print("add new line")

     return super(sale_order,self).create(vals)


Thanks a lot for your help!

0

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 10/16/15, 8:27 AM

You redefine method create in class sale_order_line, not in sale_order. In this method, in first step create standard line and in next create new line with linked product.




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: 10/16/15, 8:03 AM
Seen: 301 times
Last updated: 10/16/15, 9:48 AM