Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2508 มุมมอง

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 ?

อวตาร
ละทิ้ง
ผู้เขียน

Thanks so much..

คำตอบที่ดีที่สุด
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
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Select multiple elements with XPath แก้ไขแล้ว
5
ส.ค. 24
45771
2
เม.ย. 24
2162
3
มิ.ย. 23
5181
2
มิ.ย. 23
4200
3
มี.ค. 23
9840