Ir al contenido
Menú
Se marcó esta pregunta
4140 Vistas

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
jun 17
9086
1
mar 25
1115
0
nov 24
1362
0
jun 24
1426
1
jun 24
1892