make changes in admin user check box
This commit is contained in:
parent
182e8503cc
commit
428bfbe99f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -23,9 +23,26 @@ class Lead(models.Model):
|
|||
client_folder = fields.Char(string='Client Folder')
|
||||
start_date = fields.Date(string='Start Date')
|
||||
close_date = fields.Date(string='Close Date')
|
||||
admin_user = fields.Boolean(compute='get_admin_login', default=False)
|
||||
|
||||
_sql_constraints = [
|
||||
('phone_uniq', 'unique(phone)', "Phone No already exists !"),
|
||||
('email_from_uniq', 'unique(email_from)', "Email ID already exists !"),
|
||||
]
|
||||
|
||||
def get_admin_login(self):
|
||||
self_login = self.search([('id', '=', self.id)])
|
||||
group_list = self.env.ref('base.group_erp_manager')
|
||||
print('1111', self_login)
|
||||
print('2222', group_list)
|
||||
for record in self_login:
|
||||
print('333333333', record.user_id.id, self.env.context.get('uid'),
|
||||
self.env.context.get('uid') in group_list.users.ids)
|
||||
if (record.user_id.id == self.env.context.get('uid')) or (
|
||||
self.env.context.get('uid') in group_list.users.ids):
|
||||
print('44444444444', record.user_id.id, self.env.context.get('uid'), self.env.context.get('uid') in group_list.users.ids)
|
||||
record.admin_user = True
|
||||
else:
|
||||
print('55555555555555555')
|
||||
record.admin_user = False
|
||||
|
||||
|
|
|
@ -32,10 +32,6 @@
|
|||
}"
|
||||
/>
|
||||
</xpath>
|
||||
<!--<xpath expr="//field[@name='user_id']" position="replace">
|
||||
<field name="user_id" domain="[('share', '=', False)]" string="111111111111"
|
||||
context="{'default_sales_team_id': team_id}" widget="many2one_avatar_user"/>
|
||||
</xpath>-->
|
||||
<xpath expr="//group[@name='Misc']" position="after">
|
||||
<group colspan="2" col="4">
|
||||
<field name="lead_no"/>
|
||||
|
@ -53,13 +49,16 @@
|
|||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='user_id']" position="replace">
|
||||
<field name="user_id" attrs="{'readonly':True}"/>
|
||||
<field name="admin_user" />
|
||||
<field name="user_id" domain="[('share', '=', False)]" attrs="{'readonly':[('admin_user','=',False)]}"
|
||||
context="{'default_sales_team_id': team_id}" widget="many2one_avatar_user"/>
|
||||
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_salesperson_readonly_custom" model="ir.ui.view">
|
||||
<!-- <record id="view_salesperson_readonly_custom" model="ir.ui.view">
|
||||
<field name="name">crm.lead.cor.inherit2</field>
|
||||
<field name="model">crm.lead</field>
|
||||
<field name="inherit_id" ref="cor_custom.crm_lead_form_cor_custom"/>
|
||||
|
@ -70,5 +69,5 @@
|
|||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
-->
|
||||
</odoo>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue