I am trying to create a small addon which would add a field to the product.template class and display it on the product form after the 'barcode' field. Here are the relevant portions of the files.
__init__.py
from . import controllers
from . import models
from . import product
__manifest__.py
'depends': ['base','product'],
'data': [
'views/views.xml'
'views/templates.xml',
],
models.py
from odoo import models, fields, api
class ProductTemplateInherited(models.Model):
_inherit = 'product.template'
odsp_id = fields.Char(string='ODSP ID')
views.xml
<odoo>
<data>
<!--- Inherit the product template form view -->
<record id="product_template_only_form_view_custom" model="ir.ui.view">
<field name="name">product.template.custom.form.inherited</field>
<field name="model">product.template</field>
<field name="inherited_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='barcode']" position="after">
<field name="odsp_id"/>
</xpath>
</field>
</record>
</data>
</odoo>
When I try to install the addon, the traceback error report says that field 'odoo_id' does not exist. What steps am I missing here?