Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
13843 Lượt xem

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 !

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
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)
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 22
6237
0
thg 9 17
3881
4
thg 9 15
7036
2
thg 1 23
14652
1
thg 8 16
10560