Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
6791 Vistas

This is the confirm sale code :

    def action_button_confirm(self, cr, uid, ids, context=None):
    assert len(ids) == 1, 'This option should only be used for a single id at a time.'
    wf_service = netsvc.LocalService('workflow')
    wf_service.trg_validate(uid, 'sale.order', ids[0], 'order_confirm', cr)

    # redisplay the record as a sales order
    view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'view_order_form')
    view_id = view_ref and view_ref[1] or False,
    return {
        'type': 'ir.actions.act_window',
        'name': _('Sales Order'),
        'res_model': 'sale.order',
        'res_id': ids[0],
        'view_type': 'form',
        'view_mode': 'form',
        'view_id': view_id,
        'target': 'current',
        'nodestroy': True,
    }

It write "assert len(ids) == 1, 'This option should only be used for a single id at a time.'"

So how can I change it , then I can do it with many ids at a time. I try to delete this sentence, but it doesn't work. Should I change the "return" and "ids[0]"as well ?

Avatar
Descartar

if you change the return ids[0] to ids then it will give you trace-back, because it gives ids in list and in form view it will give you [oneid] thats y they pass ids[0]

Mejor respuesta

image description

Avatar
Descartar

Hi Sreedath Please can you help me with this I am having trouble implementing this code. Thank you

Autor Mejor respuesta

I try to write like this :

for id in context.get(('active_ids'), []):
        wf_service.trg_validate(uid, 'sale.order', id, 'order_confirm', cr)

but it also can't work as I want...

Is any doc about wf_service.trg_validate(),wf_service = netsvc.LocalService('workflow')? I find that if i write like this :

    def action_button_confirm(self, cr, uid, ids, context=None):
        wf_service = netsvc.LocalService('workflow')        
        return  True

It also can wok....

Avatar
Descartar

Hi CK were you able to fix the the problem with this? I also need something like this please kindly help.

Publicaciones relacionadas Respuestas Vistas Actividad
5
ago 15
5225
1
mar 15
5925
1
may 25
881
2
feb 25
9707
0
feb 20
3