【问题标题】:Method return value to call another form in OpenERP在 OpenERP 中调用另一个表单的方法返回值
【发布时间】:2013-09-05 05:18:51
【问题描述】:

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

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

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

【问题讨论】:

    标签: python openerp


    【解决方案1】:

    以下是一个示例函数。也许对你有帮助

    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】:

      有一个函数可以为您提供给定 xml_id 的 act_window。

      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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-10-01
        • 2021-07-07
        • 2020-04-18
        • 1970-01-01
        • 1970-01-01
        • 2021-08-16
        • 2016-08-07
        • 1970-01-01
        相关资源
        最近更新 更多