This question has been flagged
3 Replies
5049 Views


@api.v7

def moves_xml(self,cr,uid,ids,context=None):

do some stuff with v7-syntax/api....

return {

'type': 'ir.actions.act_window',

'res_model': 'account.export',

'view_mode': 'form',

'view_type': 'form',

'res_id': account.id,

'views': [(False, 'form')],

'target': 'new',

}


How do I open the same window with the v8 api?

Avatar
Discard
Best Answer

You may try like this - 

@api.multi
def moves_xml(self,context=None):
    context = context or {}   
    partial = self.env['website.seo.wizard'].create({})
   return {
           'name':"Message",
          'view_mode': 'form',
          'view_id': False,
          'view_type': 'form',
          'res_model': 'website.seo.wizard',
          'res_id': partial.id,
          'type': 'ir.actions.act_window',
          'nodestroy': True,
          'target': 'new',
          'domain': '[]',
       }


Avatar
Discard
Best Answer

hello Anders


I have made some changes in your piece of code.Try to understand the hint/change.

hope this hint/change may help you or may solve your problem

@api.multi
def moves_xml(self):
view_id = self.env.ref('module_name.record_id_of_form').id
context = self._context.copy()
return {
'name':'form_name',
'view_type':'form',
'view_mode':'tree',
'views':[(view_id,'form')],
'res_model':'account.export',
'view_id':view_id,
'type':'ir.actions.act_window',
'res_id': account.id,
'target':'new',
}


Avatar
Discard
Author Best Answer

Thank you both!


@api.multi did the thing

I tried @api.one and others with no luck before i got back to v7-syntax.

Avatar
Discard