1
votes

I have a computed filed in my model :

initiatives_count = fields.Integer(compute=count_init)

when I am trying to use this filed in the QWeb kanban view like this:

<table class="table table-bordered" t-if=" record.initiatives_count.value != 0 ">

it gives me that error:

Uncaught Error: QWeb2 - template['kanban-box']: Runtime Error: TypeError: Cannot read property 'value' of undefined

so any one have any idea where it goes wrong ????

1
it says coun instead of count? - dccdany
sorry I have edited my code but I have the same error - Islam Zedan
Have you restarted the odoo service and refreshed the module again? - dccdany
yes when I Use record.field.value for another it work fine - Islam Zedan
Maybe it is because its a function field. Try to add in the .py the parameter "store=True": fields.Integer(compute=count_init, store=True) - dccdany

1 Answers

2
votes

I have find where I have go wrong that error because I did not define the fields that I will use in the view before using it like this:

<record model="ir.ui.view" id="amad_kanban_view_perspective">
    <field name="name">perspective Kabana</field>
    <field name="model">perspective</field>
    <field name="priority">10</field>
    <field name="arch" type="xml">
        <kanban>
            <field name="name"/>
            <field name="initiatives_count"/>
            <field name="initiatives"/>
            <templates>
                <t t-name="kanban-box">
                </t>
            </templates>
        </kanban>
    </field>
</record>