跳至內容
選單
此問題已被標幟
4047 瀏覽次數

I made a action button in my module (check ip using ipwhois). Now i need to integrate this module in website. It is easy to show fields, but i don't know how make this button. It is shown on webpage, but function is not callable.

As i understand: clicking on button must call python function, reload page and write a new value in field "result_check".

in views.xml

<record id="sale_form_view" model="ir.ui.view">
  <field name="name">sale.form</field>
  <field name="model">product.template</field>
  <field name="inherit_id" ref="website_sale.product_template_form_view"/>
  <field name="arch" type="xml">
  <field name="categ_id" position="after">
  <button name="make_request" type="object" string="Make check" />
  <field name="result_check" />
  </field>
  </field>
</record>


in template.xml

<templateid="add_fields_product"inherit_id="website_sale.product">
<xpathexpr="//div[@id='product_details']"position="before"> 
<div>
     <a role="button" href="#">  <span>Make check</span>  </a> 
   <p itemprop="name" t-field="product.result_check">Result</p> 
</div> 
</xpath>
</template>
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
6月 20
2650
1
11月 24
1112
0
3月 22
1809
2
5月 24
8822
2
8月 25
2543