Hello,
So my problem is, I have already created some Items and lines objects, and I'd like to pass those objects from Line to Order.
I'm trying to pass values through buttons by using this:
(4, ID) link to existing record with id = ID (adds a relationship)
but the only thing I get is an error.
This is an example of my code:
class Item(models.Model): _name = 'a.a' name= fields.Integer(string = "Name")
class Line(models.Model): _name = 'b.b' item_id = fields.Many2one('a.a', string="Item")
quantity = fields.Integer(string = "Quantity")
@api.multi def addOrder(self):
for m in self:
result = self.env['c.c'].create( {'line_id':[(4,m.id)], }
) return result
class Order(models.Model): _name = 'c.c' line_id = fields.One2many('b.b','item_id')