odoo仓库单据产品过滤写法

def onchange_picking_type_id(self, cr, uid,ids, picking_type_id, context=None):
if picking_type_id in (12,13,18,17):
domain={}
domain['product_id']=[('product_id','in',[])]
sql="select t0.id from product_product t0 LEFT JOIN product_template t1 on t0.product_tmpl_id=t1.id where t1.categ_id=4"
cr.execute(sql)
dict=cr.dictfetchall()
valu=[]
for i in range(len(dict)):
dict2=dict[i]
valu.append(dict2['id']) domain['product_id']=[('id','in',valu)]
else:
domain={} return {'domain':domain}
<field name="picking_type_id" invisible="1" on_change="onchange_picking_type_id(picking_type_id)"/>

字符串排序bom标号:思路如下

aa='1.2.6'
bb='1.3.5.6'
cc='1.3.6.9.5'
dd='5.6'
list1=[aa.split('.'),bb.split('.'),cc.split('.'),dd.split('.')]
sorted(list1) [['', '', ''], ['', '', '', ''], ['', '', '', '', ''], ['', '']] list1=[['', '', ''], ['',''],['', '', '', ''], ['', '', '', '', ''], ['', '']]
for index,item in enumerate(sorted(list1)):
print index,item
上一篇:android绘画折线图一


下一篇:端口报错listen eaddrinuse:::xxx