Skip to Content
Menu
This question has been flagged
1 Reply
2090 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!

Avatar
Discard
Best Answer

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.




Avatar
Discard