我想将模块从odoo 10迁移到odoo 12,但它向我显示此错误
L'élément '<xpath expr="//div[@t-if='(acquirers or tokens) and website_sale_order.amount_total']/div/ul/t/li[1]/label/span[@t-field='acquirer.image_small']">' ne peut être localisé dans la vue parente
Contexte de l'erreur :
Vue `payment_inherit`
[view_id: 1843, xml_id: n/a, model: n/a, parent_id: 1593]
None" while parsing None:7, near
<data inherit_id="website_sale.payment">
<xpath expr="//div[@t-if='(acquirers or tokens) and website_sale_order.amount_total']" position="replace">
</xpath>
<xpath expr="//div[@t-if='(acquirers or tokens) and website_sale_order.amount_total']/div/ul/t/li[1]/label/span[@t-field='acquirer.image_small']" position="replace">
</xpath>
</data>
我检查了website_sale.payment,发现在odoo 12中的视图付款中不再存在t-field ='acquirer.image_small'。 来自插件:
<div id="payment_method" class="mt-3" t-if="(acquirers or tokens) and website_sale_order.amount_total">
<h3 class="mb24">Pay with </h3>
<t t-call="payment.payment_tokens_list">
<t t-set="mode" t-value="'payment'"/>
<t t-set="submit_txt">Pay Now</t>
<t t-set="icon_right" t-value="1"/>
<t t-set="icon_class" t-value="'fa-chevron-right'"/>
<t t-set="submit_class" t-value="'btn btn-primary'"/>
<t t-set="pms" t-value="tokens"/>
<t t-set="form_action" t-value="'/shop/payment/token'"/>
<t t-set="prepare_tx_url" t-value="'/shop/payment/transaction/'"/>
<t t-set="partner_id" t-value="partner"/>
<t t-set="back_button_icon_class" t-value="'fa-chevron-left'"/>
<t t-set="back_button_txt" t-value="'Return to Cart'"/>
<t t-set="back_button_class" t-value="'btn btn-secondary'"/>
<t t-set="back_button_link" t-value="'/shop/cart'"/>
</t>
</div>
如何解决此问题?我应该在视图中添加t-field ='acquirer.image_small还是使用其他内容。
答案 0 :(得分:0)
我发现
有点奇怪<xpath expr="//div[@t-if='(acquirers or tokens) and website_sale_order.amount_total']" position="replace"></xpath>
(删除整个DIV)和
<xpath expr="//div[@t-if='(acquirers or tokens) and website_sale_order.amount_total']/div/ul/t/li[1]/label/span[@t-field='acquirer.image_small']" position="replace"></xpath>
(删除DIV内的获取方图像)并存,因为第一个应该删除包含后者的DIV。您确定不只删除“付款方式”部分吗?
尝试注释最后一个xpath部分,并验证结果是否符合您的期望。您还可以同时注释xpath并查看预期结果。