THIS IS MY CODE, but it does not work !
class crm_lead(format_address, osv.osv):
_name = "crm.lead"
_inherit ="crm.lead"
def _check_only_responsible(self, cr, uid, ids, field_name, arg, context=None):
""" Checks if user is responsible for this field
@return: boolean
"""
for req in self.browse(cr, uid, ids, context=context):
if req.user_id == uid:
return True
else:
return False
_columns = {
'inv': fields.function(_check_only_responsible, type="boolean", methode=True),
}
And in my view:
<record model="ir.ui.view" id="crm_case_kanban_view_leads_inherit">
<field name="name">CRM - Leads Kanban Inherit</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_kanban_view_leads"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_kanban_content']/div" position="replace">
<div>
<b><field name="name"/></b>
<t t-if="record.planned_revenue.raw_value">
- <i><t t-esc="record.planned_revenue.value" attrs="{'invisible': [('inv', "!=", True)]}" />
<field name="company_currency"/></i>
</t>
</div>
</xpath>
</field>
</record>
My question is: How hide planned_revenue field, if we are not user who has created this field? Can you help me #Please
Thanks for advance
thanks for reply, But Ben I have this error *Inv unknown field in the domain [["inv", "=", true]] when i apply your suggestion. ie:* I replace return True by res[req.id] = True and return false by res[req.id] = False, then I return res. Do you know where is the error?
You need to include inv in the view in order for this to work.
Thanks, Ivan, Now I have no error, what is left now to have the expected result