class PartnerSales(models.Model):
_inherit = "res.partner"
cuid = fields.Integer(string="Get Current User ID", compute="_dp_cuid")
cspid = fields.Integer(string="Get Current Sale Person ID", related="user_id.id")
@api.depends("cuid")
@api.one
def _dp_cuid(self):
self.cuid = self.env.user.id
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_dham_customers_form" model="ir.ui.view">
<field name="name">KSK DN</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='email']" position="attributes">
<attribute name="attrs">
{'invisible': [('cspid','=', 'cuid')]}
</attribute>
</xpath>
</field>
</record>
Email field is not hidden. How to fix it?
Thanks in advance.