admin管理员组文章数量:1389768
I'm new in odoo, and I want to create widget to show stage_target in CRM module. When I run my code I got error
I want to make stage target like this image in CRM module
This is my js code :
import { Field } from "@web/views/fields/field";
import { registry } from "@web/core/registry";
class StageTargetWidget extends Field {
get stages() {
const stageTargets = this.props.record.data[this.props.name];
return stageTargets ? stageTargets.records : [];
}
}
StageTargetWidget.template = "widget_crm.StageTargetWidget";
StageTargetWidget.props = ["*"];
registry.category("fields").add("stage_target_widget", StageTargetWidget);
This is my XML template code:
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="widget_crm.StageTargetWidget">
<div class="stage-targets">
<t t-foreach="stages" t-as="stage" t-key="stage.resId">
<div class="stage-item">
<strong t-esc="stage.data.stage_id[1]"/>
<span t-esc="stage.data.due_date"/>
</div>
</t>
</div>
</t>
</templates>
And this is my crm lead XML code:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="crm_lead_view_form_inherit" model="ir.ui.view">
<field name="name">crm.lead.view.form.inherit</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<!-- Add a custom header with 5 columns -->
<xpath expr="//header" position="after">
<field name="stage_target_ids" widget="stage_target_widget" />
</xpath>
</field>
</record>
</odoo>
本文标签: python 3xCaused by TypeError Cannot read properties of undefined (reading 39name39)Stack Overflow
版权声明:本文标题:python 3.x - Caused by: TypeError: Cannot read properties of undefined (reading 'name') - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744719253a2621596.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论