summaryrefslogtreecommitdiff
path: root/addons/mail_bot_hr
diff options
context:
space:
mode:
authordmonzonis <mod@odoo.com>2020-04-10 10:27:49 +0000
committerdmonzonis <mod@odoo.com>2020-04-10 11:15:19 +0000
commit328f6dbc984312049e94413fe9a46284cffcb3cb (patch)
tree07cecf3005d61ad627a6e97d7152253501924497 /addons/mail_bot_hr
parentf0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8 (diff)
[ADD] mail_bot_hr: Bridge module to remove mail_bot dependency from hr
In v12, the hr module did not have a hard dependency on mail_bot, so the users could uninstall it if they did not want/need its functionality. In v13, mail_bot was added as a dependency to include the notification widget and the odoobot state in the user forms modified by the hr module. However, this also brings potentially unwanted functionality to anyone who installs an hr related application. This commit removes the dependency on mail_bot by adding the mail_bot_hr bridge module, which provides integration between mail_bot and hr if both modules are installed.
Diffstat (limited to 'addons/mail_bot_hr')
-rw-r--r--addons/mail_bot_hr/__manifest__.py16
-rw-r--r--addons/mail_bot_hr/views/res_users_views.xml28
2 files changed, 44 insertions, 0 deletions
diff --git a/addons/mail_bot_hr/__manifest__.py b/addons/mail_bot_hr/__manifest__.py
new file mode 100644
index 00000000000..714717a08f5
--- /dev/null
+++ b/addons/mail_bot_hr/__manifest__.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+{
+ 'name': "mail_bot_hr",
+ 'summary': """Bridge module between hr and mailbot.""",
+ 'description': """This module adds the OdooBot state and notifications in the user form modified by hr.""",
+ 'website': "https://www.odoo.com/page/discuss",
+ 'category': 'Productivity/Discuss',
+ 'version': '1.0',
+ 'depends': ['mail_bot', 'hr'],
+ 'application': False,
+ 'installable': True,
+ 'auto_install': True,
+ 'data': [
+ 'views/res_users_views.xml',
+ ],
+}
diff --git a/addons/mail_bot_hr/views/res_users_views.xml b/addons/mail_bot_hr/views/res_users_views.xml
new file mode 100644
index 00000000000..ee0e374f57b
--- /dev/null
+++ b/addons/mail_bot_hr/views/res_users_views.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<odoo>
+ <data>
+ <record id="res_users_view_form_simple_modif" model="ir.ui.view">
+ <field name="name">res.users.preferences.form.simplified.inherit</field>
+ <field name="model">res.users</field>
+ <field name="inherit_id" ref="hr.res_users_view_form_simple_modif" />
+ <field name="mode">primary</field>
+ <field name="arch" type="xml">
+ <widget name="notification_alert" position="replace" />
+ </field>
+ </record>
+
+ <record id="res_users_view_form_profile" model="ir.ui.view">
+ <field name="name">res.users.preferences.form.inherit</field>
+ <field name="model">res.users</field>
+ <field name="inherit_id" ref="hr.res_users_view_form_profile" />
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='odoobot_state']" position="attributes">
+ <attribute name="attrs">{'readonly': [('can_edit', '=', False)]}</attribute>
+ </xpath>
+ <sheet position="before">
+ <widget name="notification_alert" class="mb-0" />
+ </sheet>
+ </field>
+ </record>
+ </data>
+</odoo>