Method return value to call another form in OpenERP

我只是一个虾纸丫 提交于 2019-11-29 23:56:19

问题


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' }

Is there a return value that would open another form instead? For example, in the Product form, buttons can call a sales form or a wizard form.


回答1:


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 
        }



回答2:


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


来源:https://stackoverflow.com/questions/12634031/method-return-value-to-call-another-form-in-openerp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!