0

当我单击“采购申请”模块中的“确认申请”按钮时出现此错误

 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()

我没有开发这个模块,那么这个错误的原因可能是什么?

任何帮助将不胜感激,在此先感谢!

4

1 回答 1

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
于 2013-04-05T05:32:21.960 回答