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.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 5/9/16, 10:39 AM|
|Seen: 628 times|
|Last updated: 8/28/16, 12:28 AM|