如何解决在首页odoo中显示一个字段
我已经在odoo中创建了一个模块,其模型名为“产品”,字符串字段为“ formelab”,我想在产品表的价格下方显示此“ formelab”字段。
我想在PROD表上的“ $ 1.00”下显示“ ABCCCC”
这是views文件夹中的product_template.xml
``
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="formelab_ref_id_form" model="ir.ui.view">
<field name="name">access.product.view.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='type']" position="after">
<field name="formelab_ref"/>
</xpath>
</field>
</record>
</odoo>
and that's the product.py in the models folder
# -*- coding: utf-8 -*-
from odoo import api,fields,models
class product(models.Model):
_inherit = 'product.template'
formelab_ref = fields.Char("Formelab")
``
解决方法
您需要更改products_item模板。
以下代码在formelab_ref
跨度之后添加priceCurrency
值:
<template inherit_id="website_sale.products_item" id="daz">
<xpath expr="//span[@itemprop='priceCurrency']" position="after">
<span t-field="product.formelab_ref"/>
</xpath>
</template>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。