hi all, its my custom module, when trying to run Category view from menu, it is showing error below:
ValueError: Invalid field 'category_name' on model 'pos.category'
same error even when i removed line: _rec_name = 'category_name'
please help to solve the problem.
category.py
from odoo import api, fields, models
class PosCategory(models.Model):
_name = "pos.category"
_rec_name = "category_name"
_description = "Categories for POS"
category_name = fields.Char(string='Category Name', required=True)
group_id = fields.Many2one('pos.group', widget="many2one_tags", string='Related Group')
category.xml
<?xml version="1.0"?>
<odoo>
<record id="view_tree_category" model="ir.ui.view">
<field name="name">Category List</field>
<field name="model">pos.category</field>
<field name="arch" type="xml">
<tree>
<field name="id"/>
<field name="category_name"/>
<field name="group_id"/>
</tree>
</field>
</record>
<record id="view_form_category" model="ir.ui.view">
<field name="name">Category Form</field>
<field name="model">pos.category</field>
<field name="arch" type="xml">
<form>
<sheet>
<group name="group_top">
<field name="category_name"/>
<field name="group_id"/>
</group>
</sheet>
</form>
</field>
</record>
</odoo>