跳至内容
菜单
此问题已终结
2 回复
13836 查看

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

形象
丢弃
相关帖文 回复 查看 活动
1
12月 22
6235
0
9月 17
3872
4
9月 15
7034
2
1月 23
14650
1
8月 16
10558