This question has been flagged
2990 Views

Hello,

I imported all the purchase of my company. Now, I try to create a wizard who can confirm theim but also take the shipping, the invoicing and the payment. And, it works for the fisrt and the second. But, I can't lauch the payement subflow, I don't see how lauch it and give the information (method payement).

class purchase_order_confirm(osv.osv_memory):
    _name = "purchase.order.confirm"

    def makePo(self, cr, uid, data, context):
        wf_service = netsvc.LocalService("workflow")
        pp = pprint.PrettyPrinter(indent=2)
        pp.pprint(context.get('active_model',''))
        for id in context['active_ids']:
            wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_confirm', cr)
            wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_approve', cr)
            idLivraison = self.pool.get('purchase.order').browse(cr, uid, id).picking_ids[0].id
            wf_service.trg_validate(uid, 'stock.picking', idLivraison, 'button_done', cr)
            idFacture = self.pool.get('purchase.order').browse(cr, uid, id).invoice_ids[0].id
            wf_service.trg_validate(uid, 'account.invoice', idFacture, 'invoice_open', cr)
            wf_service.trg_validate(uid, 'account.invoice', idFacture, 'confirm_paid()', cr)
            pdb.set_trace()
            idPaiement = self.pool.get('account.voucher').browse(cr, uid, id).invoice_ids[0].payment_ids[0].id
        return {}
purchase_order_confirm()
Avatar
Discard