簡體   English   中英

Odoo 13 添加部分字段中的錯誤和安裝應用程序后的注意事項

[英]Odoo 13 bugs in add section field and note after installing the app

我正在為 Odoo 13 創建一個自定義模塊,該模塊繼承訂單行頁面上的銷售訂單。

這是我的模型

# -*- coding: utf-8 -*-

from odoo import models, fields


class application(models.Model):
    _inherit = 'sale.order'

    application = fields.Char()

這是我的 view.xml

<odoo>
    <record id="view_order_form" model="ir.ui.view">
        <field name="name">Application</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="before">
                <field name="application" string="Application"/>
            </xpath>
        </field>
    </record>

    <template id="application_document" inherit_id="sale.sale_order_portal_content">
        <xpath expr="//div[2]/section[1]/table//th[1]" position="before">
            <th class="text-left">Application</th>
        </xpath>
        <xpath expr="//div[2]/section[1]/table//td[1]" position="before">
            <td>
                <span t-field="line.application"/>
            </td>
        </xpath>
    </template>
</odoo>

這是我的 manifest.py

{
'name': "Application",

'summary': """
    Add a new field in sale order line - Application
    """,

'description': """
    This new field will determine the application of the said products in quotation
""",

'author': "Developer",
'website': "None",

# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/13.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Sales',
'version': '13.0.1.0.0',

# any module necessary for this one to work correctly
'depends': ['base', 'sale'],

# always loaded
'data': [
    # 'security/ir.model.access.csv',
    'views/application.xml',
],
# only loaded in demonstration mode
'demo': [
    'demo/demo.xml',
    ],
    'installable': True,
    'application': True,
    'auto_install': False
}

問題是,在我安裝了 cust 應用程序后,在“添加部分”和“添加注釋”的產品下將不起作用。

將您的模型更改為_inherit = 'sale.order.line' 。您正試圖在錯誤的對象中添加該字段。

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM