Skip to Content
Menu
This question has been flagged
2 Replies
5925 Views

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
Discard

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]

Best Answer

image description

Avatar
Discard

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

Author Best Answer

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
Discard

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

Related Posts Replies Views Activity
5
Aug 15
4570
1
Mar 15
4959
0
Feb 20
1
4
Jul 18
16742
2
Jan 16
7720