Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4244 Lượt xem

I have create a button by python code as below and return a table data which is pandas dataframe formate;

class Validate(models.Model):
_name = 'validate.number'

@api.multi
def create_table(self):
    self.ensure_one()
    table = pd.DataFrame([[3,4,5], [4,3,1], [6,5,3], [16,5,8]])
    table.columns = ['A','B','C']

    return table

and then I create a button on xml as below

<button name="create_table" type="object" string="Create Table"  class="oe_highlight"  />

What I want is when I click the this button the table which is created by function "create_table" can be displayed on webside. So how shall I code on xml or/and modify .py file?

In additions, sometimes the created table by function "create_table" has 3 columns and sometimes 4, 5 or other columns and names of columns are also different.

​​

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 17
9155
1
thg 3 25
1268
0
thg 11 24
1470
0
thg 6 24
1545
1
thg 6 24
2033