commit
c6e10141c0
|
|
@ -94,12 +94,13 @@ class PermissionController(http.Controller):
|
|||
message=_(
|
||||
"You Have issue in your employee profile. please check with one of your team admins"),
|
||||
success=False)
|
||||
permission = None
|
||||
try:
|
||||
permission_number = self.permission_number_decrement(
|
||||
employee, body['date_from'], body['date_to'])
|
||||
# permission_number = self.permission_number_decrement(
|
||||
# employee, body['date_from'], body['date_to'])
|
||||
permission = http.request.env['hr.personal.permission'].sudo().create(
|
||||
{'employee_id': employee.id, 'date_from': body['date_from'], 'date_to': body['date_to'],
|
||||
'early_exit': body['early_exit'], 'permission_number': permission_number,
|
||||
'early_exit': body['early_exit'],
|
||||
'date': body['date'],
|
||||
|
||||
})
|
||||
|
|
@ -124,6 +125,8 @@ class PermissionController(http.Controller):
|
|||
return http_helper.response(message="Permission Created Successfully", data={'permission': [data]})
|
||||
except Exception as e:
|
||||
http.request._cr.rollback()
|
||||
if permission:
|
||||
permission.unlink()
|
||||
_logger.error(str(e))
|
||||
message = validator.get_server_error(e, user)
|
||||
return http_helper.errcode(code=403, message=message)
|
||||
|
|
@ -152,6 +155,7 @@ class PermissionController(http.Controller):
|
|||
message=_(
|
||||
"You Have issue in your employee profile. please check with one of your team admins"),
|
||||
success=False)
|
||||
permission = None
|
||||
try:
|
||||
permission = http.request.env['hr.personal.permission'].search([
|
||||
('id', '=', id)])
|
||||
|
|
@ -161,6 +165,7 @@ class PermissionController(http.Controller):
|
|||
'early_exit': body['early_exit'],
|
||||
'date': body['date'],
|
||||
})
|
||||
permission.permission_number_decrement()
|
||||
if 'attachment' in body and body['attachment']:
|
||||
attach = http.request.env['ir.attachment'].create({
|
||||
'name': body['attachment'].filename,
|
||||
|
|
@ -176,6 +181,8 @@ class PermissionController(http.Controller):
|
|||
return http_helper.response(message="Permission Edited Successfully", data={'permission': [data]})
|
||||
except Exception as e:
|
||||
http.request._cr.rollback()
|
||||
if permission:
|
||||
permission.unlink()
|
||||
_logger.error(str(e))
|
||||
message = validator.get_server_error(e, user)
|
||||
return http_helper.errcode(code=403, message=message)
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ class Users(models.Model):
|
|||
def _compute_avatar(self):
|
||||
base = self.env["ir.config_parameter"].sudo().get_param("web.base.url")
|
||||
for u in self:
|
||||
u.avatar = werkzeug.urls.url_join(base, "rest_api/web/avatar/%d" % u.id)
|
||||
|
||||
# u.avatar = werkzeug.urls.url_join(base, "rest_api/web/avatar/%d" % u.id)
|
||||
u.avatar = werkzeug.urls.url_join(base, "api/content/res.users/%d/image_1920" % u.id)
|
||||
# //https://ensan25.preprod.exp-sa.com/api/content/res.users/2/image_1920
|
||||
# @api.multi
|
||||
def to_dict(self, single=False):
|
||||
res = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue