Odoo 13 ошибок в поле добавления раздела и заметки после установки приложения - PullRequest
0 голосов
/ 11 марта 2020

Я создаю модуль настройки для Odoo 13, который наследует заказ на продажу на странице строки заказа.

Это моя модель

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

from odoo import models, fields


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

    application = fields.Char()

Это мой взгляд. 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, под продуктом, где «добавить раздел» и «добавить заметку» не будет работать.

1 Ответ

0 голосов
/ 11 марта 2020

Измените свою модель на _inherit = 'sale.order.line' . Вы пытаетесь добавить поле в неправильный объект.

Спасибо

...