[FIX] hr: Hide employee chat button in modals

Currently, the "Chat" button appears in the form view when it is
displayed as a modal and on click sends to the app switcher
because js_class is not loaded on the dialog when employee
form view is opened through the one2many(dialog).
For ex: in online appointment when on click on 'available
emloyee' it will open the employee form view in dialog and there
is a chat icon but it does not work.

So in this commit, we fix this issue by hiding the "chat" button
when the view is displayed as a modal. make a button visible
based on action context and when form view is oped through the
click of one2many then do not display the chat icon on modal
dialog.

closes odoo/odoo#55345

Taskid: 2291340
Closes: #54381
X-original-commit: e2bac64411f80a3fcf2c5d5d60ad3eccf6517e56
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Nisha patel
2020-08-03 15:48:34 +00:00
parent 7ebe85f138
commit 7f3a8d9928
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="Employee's Name" required="True"/>
<a title="Chat" icon="fa-comments" href="#" class="ml8 o_employee_chat_btn" attrs="{'invisible': [('user_id','=', False)]}" role="button"><i class="fa fa-comments"/></a>
<a title="Chat" icon="fa-comments" href="#" class="ml8 o_employee_chat_btn" invisible="not context.get('chat_icon')" attrs="{'invisible': [('user_id','=', False)]}" role="button"><i class="fa fa-comments"/></a>
</h1>
<h2>
<field name="job_title" placeholder="Job Title" />
+2 -2
View File
@@ -77,7 +77,7 @@
<div class="oe_title">
<h1>
<field name="name" placeholder="Employee's Name" required="True"/>
<a title="Chat" icon="fa-comments" href="#" class="ml8 o_employee_chat_btn" attrs="{'invisible': [('user_id','=', False)]}" role="button"><i class="fa fa-comments"/></a>
<a title="Chat" icon="fa-comments" href="#" class="ml8 o_employee_chat_btn" invisible="not context.get('chat_icon')" attrs="{'invisible': [('user_id','=', False)]}" role="button"><i class="fa fa-comments"/></a>
</h1>
<h2>
<field name="job_title" placeholder="Job Position" />
@@ -294,7 +294,7 @@
<field name="res_model">hr.employee</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="context">{'chat_icon': True}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_employee_filter"/>
<field name="help" type="html">