当我点击“采购申请单”模块中的“确认申请单”按钮时出现此错误
File "C:\Program Files\OpenERP 7.0-20130321-002353\Server\server\openerp\addons\purchase_requisition\purchase_requisition.py", line 215, in wkf_confirm_order AttributeError: 'purchase.order' object has no attribute 'signal_purchase_cancel'
'purchase_requisition.py'中的错误代码如下:
class purchase_order(osv.osv):
_inherit = "purchase.order"
_columns = {
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition')
}
def wkf_confirm_order(self, cr, uid, ids, context=None ):
res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context=context)
proc_obj = self.pool.get('procurement.order')
for po in self.browse(cr, uid, ids, context=context):
if po.requisition_id and (po.requisition_id.exclusive=='exclusive'):
for order in po.requisition_id.purchase_ids:
if order.id != po.id:
proc_ids = proc_obj.search(cr, uid, [('purchase_id', '=', order.id)])
if proc_ids and po.state=='confirmed':
proc_obj.write(cr, uid, proc_ids, {'purchase_id': po.id})
self.signal_purchase_cancel(cr, uid, [order.id])
po.requisition_id.tender_done(context=context)
return res
purchase_order()
我没有开发这个模块,所以可能是造成这个错误的原因?
非常感谢任何帮助,提前谢谢!
答案 0 :(得分:1)
我认为你没有最新的代码。
在我的本地代码是这样的:
class purchase_order(osv.osv):
_inherit = "purchase.order"
_columns = {
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition')
}
def wkf_confirm_order(self, cr, uid, ids, context=None):
res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context=context)
proc_obj = self.pool.get('procurement.order')
for po in self.browse(cr, uid, ids, context=context):
if po.requisition_id and (po.requisition_id.exclusive=='exclusive'):
for order in po.requisition_id.purchase_ids:
if order.id<>po.id:
proc_ids = proc_obj.search(cr, uid, [('purchase_id', '=', order.id)])
if proc_ids and po.state=='confirmed':
proc_obj.write(cr, uid, proc_ids, {'purchase_id': po.id})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr)
po.requisition_id.tender_done(context=context)
return res