Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in views/LeaveRequest.xml wrt HR Manager #13879

Open
EvertHoff opened this issue Jan 26, 2025 · 1 comment
Open

Possible bug in views/LeaveRequest.xml wrt HR Manager #13879

EvertHoff opened this issue Jan 26, 2025 · 1 comment

Comments

@EvertHoff
Copy link

EvertHoff commented Jan 26, 2025

In axelor-human-resource/src/main/resources/views/LeaveRequest.xml there is this snippet:

  <action-attrs name="action-leave-request-attrs-leave-reason-domain">
    <attribute name="domain" for="leaveReason"
      expr="eval: &quot;self.leaveReasonTypeSelect = 2&quot;"/>
    <attribute name="domain" for="leaveReason"
      expr="eval: &quot;self.leaveReasonTypeSelect = 2 OR self IN (SELECT leaveReason FROM LeaveLine leaveLine WHERE leaveLine.employee.id = ${__this__.employee.id})&quot;"
      if="employee != null"/>
    <attribute name="domain" for="leaveReason"
      expr="eval: &quot;(self.leaveReasonTypeSelect = 2 OR self IN (SELECT leaveReason FROM LeaveLine leaveLine WHERE leaveLine.employee.id = ${__this__.employee.id})) AND (self.selectedByMgtOnly = false) &quot;"
      if="employee != null &amp;&amp; !__user__.employee?.hrManager"/>
  </action-attrs>

If the user is an HR Manager, then the third attribute will fall away. Thus self.selectedByMgtOnly is never considered, because the first two attributes don't contain it.

I am guessing that the intent is for an HR Manager to be able to select leave reasons where self.selectedByMgtOnly is true, but this won't happen.

I don't see any automated tests for this logic. If there are, please point me to them.

There might be a bug in the logic here or maybe I just don't understand it. If my understanding is wrong, please explain the intent to me.

Thanks,
Evert

@EvertHoff
Copy link
Author

EvertHoff commented Jan 26, 2025

Also, please clarify:

If there are multiple "attribute" tags inside an "action-attrs" tag, are they combined with AND logic or OR logic?

Or, does each "attribute" override the previous ones if its "if" condition is true?

Thanks,
Evert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant