異常處理參考:https://stackoverflow.com/questions/31070640/valueerror-expected-singleton-odoo8
報錯: ValueError Expected singleton: *******
原因是,odoo幾個裝飾器的使用需要注意,當你后台方法用了@api.multi,那么,該方法下的數據,需要for循環遍歷一下,否則就會出現singleton 單例模式的錯誤!
@api.one
This decorator loops automatically on Records of RecordSet for you. Self is redefined as current record
@api.multi
Self will be the current RecordSet without iteration. It is the default behavior (multiple browsable objects). Methods which returns non premitive type data(list, dictionary, function) must be decorated with @api.multi
@api.model
This decorator will convert old API calls to decorated function to new API signature. It allows to be polite when migrating code. Self does not contain any record/recordset in methods which are decorated by this decorator.