0
votes

Hi i added a button on my wizard form to open another wizard but i don't want to close existing one, the reason for an another wizard is just to pass some value after user filter and choose few data.

on my wizard form i added a button with below code

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

I believe the solution is to put in "nodestroy" equal to True, it works on OpenERP 6.0 & 7.0 but not on 6.1, any solution?

2

2 Answers

0
votes

Going from memory here but if you have the button method return None rather than a window action if will log a warning but leave the window in place. Pretty sure this works in 6.1

0
votes

To answer my own question, Rather than make existing windows stay open, better return as windows action to 1st windows from the 2nd popup windows. This is the best way i can find in 6.1

For example :

  • I have a osv memory popup with model A
  • I added a button to open another osv memory popup windows with model B
  • Then on model B i will return something to model A

The code for button on model A shld be :

def buttonA(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': 'b',
        'type': 'ir.actions.act_window',
        'nodestroy': True,
        'target': 'new',
        'domain': '[]',
        'context': context,
    }

Then the code for button on model B is simply to update data A which what it supposed to be, and return to model A with windows action

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