Whenever i try to pull data from current model to other model with create it shows error as
'requisition_id':temp.id
TypeError: create() takes 2 positional arguments but 3 were given
If we see the code it seems like
@api.one
@api.multi
def action_approve_requistion(self):
cr = self.env.cr
uid = self.env.uid
ids = self.ids
context = 'context'
for temp in self:
ebsl_id = self.pool.get('purchase.requisition_approve').create(cr,uid, {
'requisition_date':temp.requisition_date,
'requisition_no':temp.requisition_no,
'requisition_id':temp.id
})
for item in temp.requisition_line:
erp_id = self.pool.get('purchase.requisition_approve_line').create(cr,uid, {
'product_id': item.product_id.id,
'description': item.description,
'uom_id': item.uom_id.id,
'required_quantity': item.required_quantity,
'requisition_line_id':item.id,
'requisition_approve_id': approve_id
})
cr.execute("UPDATE purchase.requisition SET state = 'requisition_approve' WHERE purchase.requisition.id = cast(%s as integer)",((temp.id),))
return {}
Use new api