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 06:38:54

@alexey-pelykh commented on this pull request.


In hr_holidays_leave_auto_approve/models/hr_leave.py:

> @@ -21,15 +21,19 @@ 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()
+        if (res.can_approve and res.holiday_status_id.auto_approve) or (
+                res.holiday_status_id.auto_approve_all):
+            res.sudo(user=SUPERUSER_ID).action_approve()

Just sudo() is enough, superuser by default


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