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

Hi, i have a problem. When i create a project via project->create 2 projects are created. How this can be fixed?

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

Hi daouda,

I have faced this kind of problem before. And I came to know that I've override create() method & then called super() and in return value I called super. So because of calling super two times I got record created two times.

Here is my problematic code,

def create(self, cr, uid, vals, context=None):
    # My calculation & code
    res = super(class_name, self).create(cr, uid, vals, context)
    return super(class_name, self).create(cr, uid, vals, context)

By calling super two times record was created twice.

Instead that I did like this,

def create(self, cr, uid, vals, context=None):
    # My calculation & code
    res = super(class_name, self).create(cr, uid, vals, context)
    return res

I am not sure you have done like this or not? But it is my suggestion, it is one of the possibility which is why records are created two times.

Hope this is helpful to solve your problem.

Thanks.

อวตาร
ละทิ้ง