Skip to content

validation response on the roster is being shown 3 times !! #4101

@Binyaber

Description

@Binyaber

Information about bug

validation response on the roster is being shown 3 times !! , we tried several validation in the hooks , all messages are shown 3 times .

we have :
Frappe Framework: v15.98.1 (HEAD)

ERPNext: v15.95.2 (HEAD)

Frappe HR: v15.56.0 (HEAD)

Image

Module

HR

Version

Frappe Framework: v15.98.1 (HEAD)

ERPNext: v15.95.2 (HEAD)

Frappe HR: v15.56.0 (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

this is one of the examples , whatever doc event we make , all shows 3 times !

Error: /api/method/hrms.api.roster.break_shift ValidationError
    at index-BhBupF_B.js:174:1754
    at Generator.next (<anonymous>)
    at o (index-BhBupF_B.js:2:668)
s0 @ index-BhBupF_B.js:14Understand this error
:8000/api/method/hrms.api.roster.break_shift:1  Failed to load resource: the server responded with a status of 417 (EXPECTATION FAILED)Understand this error
index-BhBupF_B.js:174 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 120, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 52, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 40, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 53, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1754, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, in wrapper
    return func(*args, **kwargs)
  File "apps/hrms/hrms/api/roster.py", line 151, in break_shift
    assignment.cancel()
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1102, in cancel
    return self._cancel()
  File "apps/frappe/frappe/model/document.py", line 1085, in _cancel
    return self.save()
  File "apps/frappe/frappe/model/document.py", line 378, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 431, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1182, in run_post_save_methods
    self.run_method("on_cancel")
  File "apps/frappe/frappe/model/document.py", line 1011, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1371, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1353, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 1008, in fn
    return method_object(*args, **kwargs)
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 39, in on_cancel
    self.validate_attendance()
  File "apps/hrms/hrms/hr/doctype/shift_assignment/shift_assignment.py", line 69, in validate_attendance
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 609, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 574, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 525, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Cannot cancel Shift Assignment: HR-SHA-26-02-00001 as it is linked to Attendance: HR-ATT-2026-00003

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions