Method return value to call another form in OpenERP

前端 未结 2 1498
孤街浪徒
孤街浪徒 2021-01-03 09:38

Currently, you can set to return value of an OpenERP to the following, to get the current form to be closed:

return {\'type\':\'ir.actions.act_window_close\         


        
相关标签:
2条回答
  • 2021-01-03 10:21

    There is a function that gives you the act_window for a given xml_id.

    def open_popup(self, cr, uid, ids, context=None):
        if move.parent_production_id:
            win_obj = self.pool.get('ir.actions.act_window')
            res = win_obj.for_xml_id(cr, uid, 'module_name', 'id_specified_for_the_view', context)
            return res
    
    0 讨论(0)
  • 2021-01-03 10:23

    Following is an example function.Maybe helpful for you

    def open_popup(self, cr, uid, ids, context=None):
        mod_obj = self.pool.get('ir.model.data')
        if move.parent_production_id:
            res = mod_obj.get_object_reference(cr, uid, 'module_name', 'id_specified_for_the_view')
            return {
                'name': 'Provide your popup window name',
                'view_type': 'form',
                'view_mode': 'form',
                'view_id': [res and res[1] or False],
                'res_model': 'your.popup.model.name',
                'context': "{}",
                'type': 'ir.actions.act_window',
                'nodestroy': True,
                'target': 'new',
                'res_id': record_id  or False,##please replace record_id and provide the id of the record to be opened 
            }
    
    0 讨论(0)
提交回复
热议问题