-->

How to use the dot notation in a kanban view in Od

2019-07-21 20:22发布

问题:

I have a model customer and another model company. The model customer has a field named company_id, which is a Many2one pointing to company. Besides, company has a field of type Char named trade_name.

Now, I'm creating the kanban view of customer, using Qweb. What I want is to show the trade name of the company of each customer.

<t t-field="company_id.trade_name"/>

That line is not working, I get a blank space in the kanban view where the field should be. I also tried with t-esc, and writing <field...> as I'd do with a tree or form view, but they don't accept the dot notation.

I know it perfectly works in reports. What about kanban views? How can I manage such a simple task?

回答1:

In your case basically,

web_kanban module is used to manage all the classes related with the kanban view.

Which is used to display the element into the kanban card and you can easily drag and drop facility on it.

Kanban View is totally mixer of Tree and Form all to gather.

Kanban Tamplate :-

kanban view must define at least one tamplate Kanban-box which will be rendered once for each record.

so that hear record is the global object and you can access the every field with the help of record object.

Need to follow the below Way :

Add your field entry into the kanban card and then after you can access that field with the template tag of kanban view through global record object.

<div t-if="record.company_id.trade_name.raw_value">
   <t t-esc="record.company_id.trade_name.value"/>
</div>

I hope my answer may helpful for you :)