Skip to Content
Menu
This question has been flagged
3362 Views

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.

​​

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 17
8221
0
Nov 24
132
0
Jun 24
268
1
Jun 24
702
0
Oct 23
952