Hii,
I have a custom many2one field sale_id in helpdesk_ticket model
sale_id = fields.Many2one('sale.order', string='Sale Order')
I want to invisible sale_id if helpdesk team_id != 3
<xpath expr="//field[@name='tag_ids']" position="after">
<field name="sale_id" attrs="{'invisible': [('team_id.id', '!=', 3)]}"/> - Error
<field name="sale_id" attrs="{'invisible': [('team_id', '!=', 3)]}"/> -> Error
</xpath>
error log?
---Log---
Traceback (most recent call last):
File "/odoo/th/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/th/odoo/modules/loading.py", line 417, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/odoo/th/odoo/modules/loading.py", line 313, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/odoo/th/odoo/modules/loading.py", line 195, in load_module_graph
registry.init_models(cr, model_names, {'module': package.name})
File "/odoo/th/odoo/modules/registry.py", line 296, in init_models
model._auto_init()
File "/odoo/th/odoo/models.py", line 2412, in _auto_init
new = field.update_db(self, columns)
File "/odoo/th/odoo/fields.py", line 2097, in update_db
comodel = model.env[self.comodel_name]
File "/odoo/th/odoo/api.py", line 821, in __getitem__
return self.registry[model_name]._browse((), self)
File "/odoo/th/odoo/modules/registry.py", line 176, in __getitem__
return self.models[model_name]
KeyError: 'sale.order'
> /odoo/th/odoo/modules/registry.py(176)__getitem__()
-> return self.models[model_name]
(Pdb)
Did you add sale in dependency file
Hii Vishnu Vanner,
You are right. I forgot to add sale in dependency.
Hii Vishnu Vanner, Please change your reply so I mark it as answer.