コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4221 ビュー

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.

​​

アバター
破棄
関連投稿 返信 ビュー 活動
1
6月 17
9150
1
3月 25
1263
0
11月 24
1464
0
6月 24
1541
1
6月 24
2028