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

Hi, i am writing the create method of a sale order in a custom module. I want to get the order lines of this sale order in my method. How can i do that. I have heard about the "vals" parameters, but i dont know how to use it. Thanks !

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
def create (cr, uid, vals, context=None)
#vals or values returns dictionary containing all the fields, so you can use it like this to assign new values
vals['field_name_1'] = new_value_1
vals['field_name_2'] = new_value_2

#or assign to a variable

var_1 = vals['field_name_1']
var_2 = vals['field_name_2']
return super(class_name, self).create(cr, uid, vals, context=context)
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

def create(cr, uid, vals, context=None):
    if context is None:
        context = {}
    if vals.get('order_line'):
        #YOUR LOGIC#
return super(CLASS, self).create(cr, uid, vals, context=context)

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
vals for relationship fields (one2many) แก้ไขแล้ว
1
ธ.ค. 22
6241
0
ก.ย. 17
3882
How to access the vals dict. แก้ไขแล้ว
4
ก.ย. 15
7042
2
ม.ค. 23
14654
1
ส.ค. 16
10565