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

i hava a python function like this

def get_data(selfparams):
        json_string = [{"SKU""A4110","Unit""PC"}]
        return json_string

and xml view
<record id="view_report_product_qweb" model="ir.ui.view">
      <field name="name">report.view.qweb</field>
      <field name="model">view.product</field>
      <field name="mode">primary</field>
      <field name="arch" type="xml">
        <qweb>
        json_string
        </qweb>
      </field>
    </record>

how i get data from function to xml view
アバター
破棄

That ain't working like that.

You need to parse your json and get data then attribute it to fields. In this case each element of the list has a reference to only one product and each key in the dict represents a field in product model.

so it will be : for product X, these are the following info you're getting : sku, unit..

Then in views, you can display all these fields in a list view so that you can see the values.

Hope this helps.

著作者

I know how to use tree view in Odoo but i want display data in webdatarook tool

and webdatarook run on JS so i need push data to inside script tag like this

<QWeb>

<script>

var data = json_string

</script>

</QWeb>

著作者

this is tool i use to display excel view

https://www.webdatarocks.com/

関連投稿 返信 ビュー 活動
2
4月 23
8357
2
4月 20
6062
0
1月 25
1015
0
8月 24
1506
1
12月 23
2388