Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How do I return an act-window in v8?

By
Anders Wallenquist
on 9/4/15, 6:18 AM 777 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?

2
Webkul Support
On 9/4/15, 7:19 AM

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': '[]',
       }


2
Indrabhan Bhamare
On 9/4/15, 7:35 AM

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


1
Anders Wallenquist
On 9/4/15, 9:47 AM

Thank you both!


@api.multi did the thing

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/4/15, 6:18 AM
Seen: 777 times
Last updated: 9/4/15, 9:47 AM