Odoo布尔图?

Yac*_*ino 5 python xml nvd3.js odoo

我想在odoo中显示一个图表.我有两个领域:

x轴上的日期.

y轴的布尔值.

odoo使用nvd3.js来显示这个图表,

这是view.xml:

<record model="ir.ui.view" id="id_view">
            <field name="name">test.base.graph.view16</field>
            <field name="model">module.base</field>
            <field name="type">graph</field>
            <field name="arch" type="xml">
                <graph string="test" type="bar" >
                     <field name="date" interval="day" type="row"/>
                     <field name="boolean" type="measure"/>                  
                </graph>
            </field>
</record>
Run Code Online (Sandbox Code Playgroud)

这段代码对我不起作用,它返回一个空图.任何人都对这个问题有所了解.

小智 1

将两个字段一一模拟为整数。

更清晰: 添加两个附加字段:

'date_sim': fields.integer("Date simulation"), 'bool_sim': fields.integer("Bool simulation")

对于前两个字段,只需添加两个由@api.onchange装饰的方法 ,并在它们的主体中用相应的值更新_sim字段。

最后,您应该在您的视图中使用新字段。