I’m providing the code and description: If the Customer Invoices fail to validate then in the tree view that entry should show a warning prefix icon for the “number” field.
invoice.py
warning_icon = fields.Function(fields.Char('Warning Icon'), 'get_warning_icon')
@fields.depends('e_invoice_complete')
def get_warning_icon(self, name=None):
if not self.e_invoice_complete:
return 'warning_icon'
return None
invoice.xml
<record model="ir.ui.icon" id="warning_icon">
<field name="name">warning</field>
<field name="path">icons/warning_icon.svg</field>
</record>
invoice_tree.xml
<tree>
<field name="number">
<prefix icon="warning_icon"/>
</field>
</tree>
Description: All I want to do is that I am inheriting ‘account_invoice\invoice_tree.xml’ and in my file “e_invoice_pa\invoice_tree.xml” I want to put a prefix for example in case of Customer Invoices fail to validate in the tree view it should have a prefix warning_icon to number field