Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
21869 Zobrazení

I have some wizard opens when I click a button, this wizard insert some values in child model of the main model so I need to send some data from main model to the wizard
data includes current id

Avatar
Zrušit
Nejlepší odpověď

Mohamed,

Use context for this

Example

return {
    'type': 'ir.actions.act_window',
    'name': 'Name ',
    'view_mode': 'form',
    'target': 'new',
    'res_model': 'Your.Model',
'context': {'parent_obj': self.id}
}

Inside the function of wizard object

@api.one    
def your_function(self):
     print self._context['parent_obj']

Thanks


Avatar
Zrušit

You save my life :p

Nejlepší odpověď

What is your parent_obj? please tell me thanks. I need this. Please elaborate, explain it to me thanks


Avatar
Zrušit

dear law actually in python context is a key value pair, so in that case

'context': {'parent_obj': self.id}

'key':self.id

'parent_obj' is a key and self.id is value

hope this helps you

Related Posts Odpovědi Zobrazení Aktivita
1
pro 22
3139
3
lis 23
31825
4
čvc 25
4718
2
pro 23
17467
6
dub 18
21093