Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6896 Lượt xem

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 ?

Ảnh đại diện
Huỷ bỏ

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]

Câu trả lời hay nhất

image description

Ảnh đại diện
Huỷ bỏ

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

Tác giả Câu trả lời hay nhất

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....

Ảnh đại diện
Huỷ bỏ

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
5
thg 8 15
5329
1
thg 3 15
6004
1
thg 5 25
1045
2
thg 2 25
9854
0
thg 2 20
3