Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
2376 Weergaven

in current view:

class A:

​x1 = fields.Char()

​y1 = fields.Char()


class B:

​x2 = fields.Char()

​y2 = fields.Char()



current view is class A, 

I want to put a button on A view, and click this button, the page change to class B, and current view's data passed to class B.

I don't want to make Many2one or One2many,

how to do it ?

Avatar
Annuleer
Auteur

Thanks so much..

Beste antwoord
In "Class A" define a function for your button:

def open_view_b(self):
​# prepare fields your going to pass in context
​ctx = {'default_x2': self.x1, 'default_y2': self.y2}
return {
​​'name': _('Some name'),
​​'view_mode': 'form',
​'res_model': 'model of b class',
​'type': 'ir.actions.act_window',
​'target': 'current', 
​'context': ctx,
​}

You can find more info in documentation: https://www.odoo.com/documentation/16.0/developer/reference/backend/actions.html#window-actions-ir-actions-act-window
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
5
aug. 24
45420
2
apr. 24
1982
3
jun. 23
4949
2
jun. 23
3950
3
mrt. 23
9680