Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
18849 มุมมอง
    def create(self, cr, uid, vals, context=None):
    id = super(sale_order, self).create(cr, uid, vals, context)
            order_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('order_id', '=', id)], context=context)
    for i in self.browse(cr,uid,order_line_ids, context=context):
                    self.pool.get('sale.order.section').create(cr, uid,(0,0,{'order_line':i.id}))
    return id

I get the error TypeError: pop() takes at most 1 argument (2 given) when i want to create the sale order. It comes from the line :

                        self.pool.get('sale.order.section').create(cr, uid,(0,0,{'order_line':i.id}))

Where is the problem ?

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

That's ok thanks a lot !!

I edit my answer . if it works thankyou to mark this question as resolved.

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

Hi ,

try to divise your code in clear lines.

try with this code :

   section_pool=self.pool.get('sale.order.section') 
   order_line_pool=self.pool.get('sale.order.line') 
   for order_line_id in order_line_ids
       order_line =order_line_pool.browse(cr,uid,order_line_id)
       section = {         
                  'order_line':order_line.id,
                  'name' : order_line.name,
                  'number' : 0,                               
                   #others fields
                   }
        section_pool.create(cr, uid, section )

Thanks.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
vals for relationship fields (one2many) แก้ไขแล้ว
1
ธ.ค. 22
6278
2
เม.ย. 20
4187
0
ก.พ. 19
3377
0
ธ.ค. 17
4081
1
พ.ย. 17
4389