Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7816 มุมมอง
@api.model
    def update_shoes_order(self,):

            datas = safe_eval(self.datas)
            domain = [('quatation_id', '=', self.id)]
            shoes = self.env['shoes.order'].search(domain, limit=1)

            vals = {
                'partner_id': self.partner_id.id,
                'user_id': self.user_id.id,
                'amount_total': datas['amount_total'],
            }

            for line in datas['lines']:
                line = line and line[2]
                vals = {
                    u'product_id': line.get('product_id'),
                    u'amount_total': line.get('price'),
} shoes.service_ids.write(vals)

In shoes.order i have service ids lines. the goal is to update those line from pos.quotation. but with this code, it only overwrites existing lines with new one. how can i add additional line rather than overwrite? 

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

i do return super it's called by write method that calls update_shoes_order method. the problem is wtih for loop

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

You have to return with  "Super" with class name and function name to add additional functionality with existing terms as shown in below code:-

return super(class_name, self).function_name() 

Hope this will help you.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Expected singleton แก้ไขแล้ว
9
มี.ค. 20
42062
2
ต.ค. 18
3984
1
ต.ค. 17
4226
2
มี.ค. 15
6748
1
มี.ค. 15
4666