Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
6787 มุมมอง

@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!!!!!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

dear jithin

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


I hope I helped you ...

อวตาร
ละทิ้ง
ผู้เขียน

thanks ayman i got the answer.

@api.model to @api.multi

คำตอบที่ดีที่สุด

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. :) 

อวตาร
ละทิ้ง