This question has been flagged
4 Replies
6312 Views

@api.model

def action_purchase_order(self):

    rec= self.env['purchase.order'].create({

        'partner_id' : self.vendors.id,

        'store_id' : self.store_id.id,

        'purchase_order_type' : self.order_type.id,

        'date_order' : self.date_order.id,

        'product_id' : self.product_id.id,

        'date_planned' : self.date_order.id,

        'product_qty' : self.name.id,

        'brand_id' : self.brand_id.id,

        'product_id' : self.product_id.id,

        'part_number': self.part_number.id,

        'date_planned' : self.date_order.id,

        'product_qty' : self.quantity_no.id,

    })

    return rec




pls identify the mistake!!!!!

Avatar
Discard
Best Answer

dear jithin

I think you must replace @api.model to @api.one


I hope I helped you ...

Avatar
Discard
Author

thanks ayman i got the answer.

@api.model to @api.multi

Best Answer

Hello Jithin

Simplification for you doubt.

@api.model is used when you don't have a record set (ID of record) in self.
@api.multi or @api.one is used when you have a record set with self.

I Hope now you are clear with this. :) 

Avatar
Discard