How to use the dot notation in a kanban view in Odoo?

爱⌒轻易说出口 提交于 2019-12-11 03:29:51

问题


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 :)



来源:https://stackoverflow.com/questions/30594204/how-to-use-the-dot-notation-in-a-kanban-view-in-odoo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!