【发布时间】:2021-04-26 22:41:06
【问题描述】:
我在 res.partner 中添加了一个新字段,然后在 POS 的客户视图中;但是在编辑或创建客户时;保存时出错。 这是我的代码,将字段从 xml 保存到数据库缺少什么? 谢谢。
odoo.define('My_module.My_module', function (require) {
"use strict";
var models = require('point_of_sale.models');
models.load_fields('res.partner', ['my_field']);
<templates id="point_of_sale.template" xml:space="preserve">
<t t-extend="ClientDetails">
<t t-jquery=".client-details-right" t-operation="append">
<div class="client-detail">
<span class="label">My Field</span>
<t t-if='partner.my_field'>
<span class='detail client'><t t-esc='partner.my_field' /></span>
</t>
<t t-if='!partner.my_field'>
<span class='detail client empty'>N/A</span>
</t>
</div>
</t>
</t>
<t t-extend="ClientDetailsEdit">
<t t-jquery=".client-details-right" t-operation="append">
<div class="client-detail">
<span class="label">My Field</span>
<input class='detail client' type="date" t-att-value='partner.my_field'></input>
</div>
</t>
</t>
</templates>
【问题讨论】:
标签: javascript python xml odoo pos