Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to add track_visibility = 'onchange' for many fields, particularly existing fields in the product model.
These fields are written with V7 API, but I am using Odoo 8.
I know that I can override the entire field definition, like:
'name': fields.char('Name', required=True, translate=True, select=True, track_visibility='onchange'),
But this seems quite sloppy.
What if the field definition changes in an update? My minor tracking modification could break the module's functionality.
Trying to just add tracking (like below) will cause the field Name, etc. to be undefined, because it overwrites, rather than inheriting.
# Overrides instead of inheriting
Is there a way to do this more cleanly? Either in V7 or V8 API.
In the big comment atop class Field in fields.py, I noticed "For instance, the second class below only adds a tooltip on the field...." I wanted to see the lead names, aka subject lines, in the lead notifications, and I was successful like this:
from openerp import models, fields
_inherit = 'crm.lead'
name = fields.Char(track_visibility='onchange')
You do need the overhead of getting the datatype correct for the field.
Then the track_visibility attribute can be changed free of further overhead.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/9/16, 10:39 AM|
|Seen: 2923 times|
|Last updated: 2/28/17, 7:54 AM|