fix bug
This commit is contained in:
parent
e43eb5d8da
commit
f0a62ac66b
|
|
@ -142,6 +142,7 @@ class OverTimeController(http.Controller):
|
|||
|
||||
@http.route(['/rest_api/v2/overtimes'], type='http', auth='none', csrf=False, methods=['POST'])
|
||||
def create_overtime(self, **kw):
|
||||
s = None
|
||||
try:
|
||||
data = kw.get('lines', {})
|
||||
if data:
|
||||
|
|
@ -234,9 +235,13 @@ class OverTimeController(http.Controller):
|
|||
data={'overtimes': [value],})
|
||||
except (UserError, AccessError, ValidationError, Exception, Warning) as e:
|
||||
error = str(e)
|
||||
if s:
|
||||
s.unlink()
|
||||
return http_helper.response(code=400, message=str(error), success=False)
|
||||
except Exception as e:
|
||||
_logger.error(str(e))
|
||||
if s:
|
||||
s.unlink()
|
||||
message = validator.get_server_error(e, user)
|
||||
return http_helper.errcode(code=403, message=message)
|
||||
|
||||
|
|
@ -303,10 +308,13 @@ class OverTimeController(http.Controller):
|
|||
'account_id': body['account'],
|
||||
'journal_id': body['journal'],
|
||||
})
|
||||
s.benefits_discounts = False
|
||||
elif s.transfer_type == 'payroll' and body.get("rule") :
|
||||
vals.update({
|
||||
'benefits_discounts':int( body['rule']),
|
||||
})
|
||||
s.account_id = False
|
||||
s.journal_id = False
|
||||
s.write(vals)
|
||||
if s.state == 'hr_aaproval':
|
||||
s.onchange_transfer_type()
|
||||
|
|
|
|||
Loading…
Reference in New Issue