如何将字段添加到 Odoo 14 中的另一个模块

How to add a field to another module in Odoo 14

美好的一天! 我怎样才能在支付模块中添加一个字段这是我的代码,但我得到一个错误:

odoo.exceptions.ValidationError: Error while validating view:

Field "term_number" does not exist in model "account.payment"

View name: account.payment
Error context:
 view: ir.ui.view(1133,)
 xmlid: view_account_payment_form
 view.model: account.payment
 view.parent: ir.ui.view(562,)
 file: c:\program files\odoo 14\server\odoo\addons\doc_dte_school\views\payment.xml

这是我的 XML 代码

<record id="view_account_payment_form" model="ir.ui.view">
    <field name="name">account.payment</field>
    <field name="model">account.payment</field>
    <field name="inherit_id" ref="account.view_account_payment_form"/>
    <field name="arch" type="xml">
        <field name="amount" position="after">
            <field name="term_number"/>
        </field>
    </field>
</record>

这是我的 Python 代码

from odoo import api,fields,models,_

    class AccountPayment(models.Model):
        _inherit = 'account.payment'
        _inherit = 'dte_school'
        
        term_number = fields.Many2one('dte_school')

你可以这样继承。

from odoo import api,fields,models,_

class AccountPayment(models.Model):
    _inherit = ['account.payment', 'dte_school']
        
    term_number = fields.Many2one('dte_school')