Human Resources mailing list archives

hr@odoo-community.org

Avatar

Re: [OCA/hr] [12.0][IMP] hr_holidays_leave_auto_approve: Auto-approve for everyone (#663)

by Alexey Pelykh <notifications@github.com> - 19/11/2019 11:37:10

@alexey-pelykh requested changes on this pull request.


In hr_holidays_leave_auto_approve/models/hr_leave.py:

> @@ -21,15 +21,17 @@ def create(self, values):
             HrLeave, self.with_context(
                 tracking_disable=tracking_disable)
             ).create(values)
-        if res.can_approve and res.holiday_status_id.auto_approve:
-            res.action_approve()
+        policy = res.holiday_status_id.auto_approve_policy
+        if (res.can_approve and policy == 'hr') or policy == 'all':

For further extensions, better extract this to a separate hook method, e.g. "apply_auto_approve_policy"


In hr_holidays_leave_auto_approve/views/hr_holidays_status.xml:

> @@ -7,6 +7,7 @@
         <field name="arch" type="xml">
             <xpath expr="//group[@name='validation']">
                 <field name="auto_approve"/>
+                <field name="auto_approve_all"/>

Don't forget to change here


In hr_holidays_leave_auto_approve/readme/CONFIGURE.rst:

>  belonging to a specific leave type, please follow the steps below.
 
 #. Go on the leave type configuration menu
 #. Select the leave type you wish to setup
-#. Mark the flag 'Auto Validate'.
+#. Mark the flag 'Auto Validate for HR' or 'Auto Validate for Everyone'.

And here


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.