【问题标题】:OpenERP 6.1 - wizard should not close on button clickOpenERP 6.1 - 向导不应在按钮单击时关闭
【发布时间】:2014-07-01 01:19:40
【问题描述】:

您好,我在向导表单上添加了一个按钮来打开另一个向导,但我不想关闭现有的向导,另一个向导的原因只是在用户过滤后传递一些值并选择少量数据。

在我的向导表单上,我添加了一个带有以下代码的按钮

>   def action_process_pickings(self, cr, uid, ids, context=None):
>         if context is None: context = {}
>         context = dict(context, active_ids=ids, active_model=self._name)
>         
>         return {
>             'name':_("Picking to Process"),
>             'view_mode': 'form',
>             'view_id': False,
>             'view_type': 'form',
>             'res_model': 'packing.wizard',
>             'res_id': ids[0],
>             'type': 'ir.actions.act_window',
>             'nodestroy': True,
>             'target': 'new',
>             'domain': '[]',
>             'context': context,
>         }

我相信解决方案是将“nodestroy”设置为 True,它适用于 OpenERP 6.0 和 7.0,但不适用于 6.1,有什么解决方案吗?

【问题讨论】:

    标签: button popup openerp popupwindow


    【解决方案1】:

    从这里记忆,但如果您有按钮方法返回 None 而不是窗口操作,如果将记录警告但将窗口留在原处。很确定这在 6.1 中有效

    【讨论】:

      【解决方案2】:

      回答我自己的问题, 与其让现有窗口保持打开状态,不如从第二个弹出窗口作为窗口操作返回到第一个窗口。这是我在 6.1 中能找到的最好方法

      例如:

      • 我有一个模型 A 的 osv 内存弹出窗口
      • 我添加了一个按钮来打开另一个带有模型 B 的 osv 内存弹出窗口
      • 然后在模型 B 上我将返回一些东西给模型 A

      模型 A 上的按钮代码应为:

      def buttonA(self, cr, uid, ids, context=None): 如果上下文为无:上下文 = {} context = dict(context, active_ids=ids, active_model=self._name)

          return {
              'name':_("Picking to Process"),
              'view_mode': 'form',
              'view_id': False,
              'view_type': 'form',
              'res_model': 'b',
              'type': 'ir.actions.act_window',
              'nodestroy': True,
              'target': 'new',
              'domain': '[]',
              'context': context,
          }
      

      那么模型 B 上的按钮代码就是简单地更新数据 A 应该是什么,然后通过 windows 操作返回模型 A

         def buttonB(self, cr, uid, ids, context=None):
               if context is None: context = {}         
               self.pool.get('a').write(cr, uid, { [the value u want to update] })
               return {
                   'name':_("Picking to Process"),
                   'view_mode': 'form',
                   'view_id': False,
                   'view_type': 'form',
                   'res_model': 'a,
                   'res_id': context.get('active_ids')[0],
                   'type': 'ir.actions.act_window',
                   'nodestroy': True,
                   'target': 'new',
                   'domain': '[]',
                   'context': context,
               }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-18
        • 2014-09-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-14
        • 1970-01-01
        相关资源
        最近更新 更多