Frage

def create_forms(self,cr,uid,ids,context=None):
    mod_obj = self.pool.get('ir.model.data')
    res = mod_obj.get_object_reference(cr, uid, 'project_inherited', 'project_forms_form')
    frm_ids=[1,2,3,4,5]
    return {
               'name': 'Control Forms',
                'view_type': 'form',
                'view_mode': 'form',
                'view_id': [res and res[1] or False],
                'res_model': 'project.forms',
                'context': "{}",
                'type': 'ir.actions.act_window',
                'nodestroy': True,
                'res_id': frm_ids or False,
           }

But whenever i call this method it works fine form just one frm_ids but in above case it shows me following error-- List Object is not hashable,----so is there any way to return multiple forms in buttons click....?

War es hilfreich?

Lösung

Not that I am aware of as it goes against the OpenERP pattern. Your button returns an action to the client (a window action) and the client then requests the form from the server. You can think of this as analagous to sending an HTTP redirect to a browser. You can't send multiple redirects.

If you want to give the use the choice of a form or tree you could make sure those forms are both defined for the model and then have two buttons or just always send to the form and allow the user to switch to the tree view.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top