Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
4227 Visualizações

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
jun. 17
9151
1
mar. 25
1264
0
nov. 24
1468
0
jun. 24
1542
1
jun. 24
2030