我是 Python 和 openerp 的新手。当我想制作一个简单的批准按钮来更改状态时,我遇到了问题,只是为了更改状态。
错误消息:未找到处理程序。
这是我的脚本:
XML:
<button name="approve" states="draft" string="Approve" type="object"/>
Python:
...
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)
...