Good day! How can I add a field to the payment's module here is my code, but I get an error:
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
Here is my XML code
<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>
Here is My Python code
from odoo import api,fields,models,_
class AccountPayment(models.Model):
_inherit = 'account.payment'
_inherit = 'dte_school'
term_number = fields.Many2one('dte_school')
You can inherit like this.
from odoo import api,fields,models,_
class AccountPayment(models.Model):
_inherit = ['account.payment', 'dte_school']
term_number = fields.Many2one('dte_school')