方法返回值以调用OpenERP中的另一个窗体

2024-05-23 14:04:43 发布

您现在位置:Python中文网/ 问答频道 /正文

当前,您可以将OpenERP的返回值设置为以下值,以获取要关闭的当前窗体:

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

是否有一个返回值将打开另一个窗体? 例如,在产品窗体中,按钮可以调用销售窗体或向导窗体。


Tags: actionsclosereturnir产品type窗体window
2条回答

有一个函数为您提供给定xml id的act_窗口

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

下面是一个示例函数。可能对您有帮助

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 
        }

相关问题 更多 >