私はPythonとopenerpの初心者です。ステータスを変更するためだけに、状態を変更するための単純な承認ボタンを作成したいときに問題があります。
エラー メッセージ :ハンドラが見つかりません。
これは私のスクリプトです:
XML:
<button name="approve" states="draft" string="Approve" type="object"/>
パイソン:
...
class student(osv.osv):
_name = "sim.student"
_description = "Data Siswa"
def approve(self, cr, uid, ids, context=None):
"""
confirm one or more order line, update order status and create new cashmove
"""
#cashmove_ref = self.pool.get('lunch.cashmove')
orders_ref = self.pool.get('sim.student')
for order_line in orders_ref.browse(cr, uid, ids, context=context):
if order_line.status != 'confirmed':
#cashmove_ref.create(cr, uid, values, context=context)
order_line.write({'status': 'confirmed'}, context=context)
return order_line.create(cr, uid, ids, context=context)
...