I'm writing a model that needs to create a record in product.template model when installed. this is the xml file
<?xml version="1.0" encoding="utf-8"?> <odoo> <data> <record id="adding_ticket_product" model="product.template"> <field name="name">Airline Ticket</field> <field name="type">service</field> <field name="sale_ok">True</field> <field name="purchase_ok">True</field> <field name="sale_line_warn">no-message</field> </record> </data> </odoo>
and this is call for it in the __manifest__.py file:
data: [
'views/product_product.xml',
]
but when ever I try to upgrade my model with the xml file I got the following error:
Odoo Server Error
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3686, in create
raise ValueError("Invalid field %r on model %r" % (key, self._name))
ValueError: Invalid field 'sale_line_warn' on model 'product.template'
During handling of the above exception, another exception occurred:
odoo.tools.convert.ParseError: "Invalid field 'sale_line_warn' on model 'product.template'" while parsing /usr/lib/python3/dist-packages/odoo/c_addons/airlines_system/views/ticket_product.xml:2, near
<odoo>
<data>
<record model="product.template" id="adding_ticket_product">
<field name="name">Airline Ticket</field>
<field name="type">service</field>
<!-- <field name="sale_ok">True</field> -->
<!-- <field name="purchase_ok">True</field> -->
<!-- <field name="categ_id">5</field> -->
<field name="sale_line_warn">no-message</field>
<!-- <field name="sale_line_warn">1</field> -->
</record>
</data>
</odoo>
and I made sure that sale_line_warn (a selection field) does have the "no-message" option, because it is the default value.
Any idea how to fix this ? Thanks in Advance