python 字典,元組,對象,數組取值方法

來源:互聯網
上載者:User

標籤:mod   處理   python   val   dict   log   關注   pool   under   

def create(self,cr,uid,vals,context=None):

if context is None:
context ={}
if vals.get(‘name‘,‘/‘)==‘/‘:
vals[‘name‘]=self.pool.get(‘ir.sequence‘).get(cr,uid,‘sale.origin‘) or ‘/‘
ctx=dict(context or {},mail_create_nolog=True)
#如果存在這個欄位 則不處理 反之 刪除本元素
flagline=vals
print 22222222222
# print vals
print vals.get(‘line_id‘)
linenum=len(vals.get(‘line_id‘))
new_line_id=[]
# for 迴圈遍曆出所有的資料,再將滿足條件資料放到一個新的數組裡,重新賦值給輸出變數,linenum固定長度
for i in range(linenum):
if ‘choice‘ in vals.get(‘line_id‘)[i][2] and vals.get(‘line_id‘)[i][2][‘choice‘] is True:
# if ‘choice‘ is True :
new_line_id.append(vals.get(‘line_id‘)[i])

print 11111111111111111
print new_line_id
vals[‘line_id‘]=new_line_id
print vals.get(‘line_id‘)

new_id=super(sale_origin,self).create(cr,uid,vals,context=ctx)

#########zxs beign 增加粉絲 這裡依賴於od-oa模組
res_model=self._name
obj=self.pool.get(‘od.oa.add.user‘)
obj.add_follower_ids(cr,uid,res_model,new_id)
return new_id

python 字典,元組,對象,數組取值方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.