【问题标题】:Load data in a custom module using xml file. Odoo 14使用 xml 文件在自定义模块中加载数据。奥多 14
【发布时间】:2021-02-16 13:31:35
【问题描述】:

我想在向导Register支付中添加另一种支付方式;所以我添加了这个数据;但什么也没发生。请问怎么了? 谢谢。

<?xml version="1.0" encoding="utf-8"?>
<odoo>  

      <record id="account_payment_method_other_in" model="account.payment.method">
           <field name="name">Other</field>
           <field name="code">other</field>
           <field name="payment_type">inbound</field>
       </record>
       <record id="account_payment_method_other_out" model="account.payment.method">
           <field name="name">Other</field>
           <field name="code">other</field>
           <field name="payment_type">outbound</field>
       </record>
</odoo>

'data': [
        'data/my_file.xml',]

【问题讨论】:

  • 您是否在清单中声明了它?

标签: javascript python xml odoo


【解决方案1】:

你应该把数据标签放在odoo之后

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="0">
        <record id="account_payment_method_other_in" model="account.payment.method">
            <field name="name">Other</field>
            <field name="code">other</field>
            <field name="payment_type">inbound</field>
        </record>
        <record id="account_payment_method_other_out" model="account.payment.method">
            <field name="name">Other</field>
            <field name="code">other</field>
            <field name="payment_type">outbound</field>
        </record>
    </data>
</odoo>

noupdate="0" 表示数据将在模块的任何升级时更新,noupdate="1" 表示它只会在初始安装时插入/更新

【讨论】:

    猜你喜欢
    • 2021-06-05
    • 1970-01-01
    • 2020-06-13
    • 1970-01-01
    • 1970-01-01
    • 2013-01-13
    • 2014-04-19
    • 2021-07-15
    • 1970-01-01
    相关资源
    最近更新 更多