콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1481 화면

Hello,

I'm having a hard time calling an external from a Kanban view, so reaching some help here.

My need: I need to change the logic of presentation of "planned_hours" in Project's Task Kanban card (when hr_timesheet module is installed)

So I've done:

1. Created my new and to-be-called QWeb template "kanban_budget_hours" in a module called "carpentry_timesheet":


<template id="kanban_budget_hours">
    <t t-if="record.planned_hours.raw_value &gt; 0 or record.overtime">
        <t t-set="badge" t-value="'border-success'"/>
        <t t-set="badge" t-value="'border-warning'" t-if="record.progress.raw_value &gt; 0"/>
        <t t-set="badge" t-value="'border-danger'" t-if="record.remaining_hours.raw_value &lt; 0"/>
        <div t-attf-class="oe_kanban_align badge {{ badge }}"
            t-attf-title="Remaining hours. Initialy planned: {{ record.planned_hours.raw_value }}h">
            <field name="remaining_hours" digits="[10,0]" />h
        </div>
        
        <t t-set="badge" t-value="'border-danger'" />
        <t t-set="badge" t-value="'border-success'" t-if="record.performance.raw_value &gt; 0"/>
        <div t-if="record.performance.raw_value" t-attf-class="oe_kanban_align badge {{ badge }}" title="Performance">
            <t t-out="'+'" t-if="record.performance.raw_value &gt; 0"/>
            <field name="performance" digits="[2,0]" />%
        </div>
    </t>
</template>


2. Inherited view hr_timesheet.view_task_kanban_inherited_progress like this:


    <record id="view_task_kanban_inherited_progress" model="ir.ui.view">
        <field name="name">project.task.timesheet.kanban.inherited.progress.carpentry</field>
        <field name="model">project.task</field>
        <field name="inherit_id" ref="hr_timesheet.view_task_kanban_inherited_progress" />

        <field name="arch" type="xml">
            <t name="planned_hours" position="replace">
                <t t-call="carpentry_timesheet.kanban_budget_hours" />
            </t>
        </field>
    </record>



Updating the module (CLI -u carpentry_timesheet) works fine but loading the view in web browser gets me the following error:

OwlError: Missing template: "carpentry_timesheet.kanban_budget_hours"

While i can see in Odoo's settings my template correctly created (sorry I can't submit photo so i'm writing here the View content from View settings):

  • view_name: kanban_budget_hours
  • view_type: QWeb
  • model: none
  • active: true
  • inheritance mode: base
  • model data: kanban_budget_hours
  • external_id:  carpentry_timesheet.kanban_budget_hours

Any thoughs ?

Warm welcome

아바타
취소
작성자 베스트 답변

Just found the answer: it seems that any template called inside a Kanban view must be declared within the tag of the same Kanban view.

So there cannot be call to external template in Kanban. This is less convenient than for report.

Example:

<t t-name="kanban_sub_part">
    Some sub-part of Kanban view
</t>

<t t-name="kanban-box">
    ....
         <t t-call="kanban_sub_part" />
</t>

아바타
취소
관련 게시물 답글 화면 활동
2
6월 16
10492
4
7월 25
1902
1
7월 25
1141
1
4월 25
1073
0
3월 25
1031