xml - How to display an icon in Odoo ListView? -


i want show warning icon in odoo tree view if score <= avg

    <field name="score"/>     <field name="avg"/> 

your python code (add field score_lt_avg model has score , avg fields):

@api.multi @api.depends('score', 'avg') def _compute_score_lt_avg(self):     record in self:         record.score_lt_avg = (record.score <= record.avg)  score_lt_avg = fields.boolean(     compute='_compute_acore_lt_avg',     string='score equal to/lower average', ) 

your xml code (you must add score, avg , score_lt_avg form view, not tree view, otherwise computed field not work):

<field name="score"/> <field name="avg"/> <field name="score_lt_avg" invisible="1"/> <span class="fa fa-exclamation-triangle" attrs="{'invisible': [('score_lt_avg', '=', false)]}"/> 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -