OCA/hr-expense

Request validation after submit to manager

fgi-osw opened this issue · 2 comments

module: hr_expense_tier_validation
version: 14.0
Is there a way to trigger the approval after the employee has submitted the expense report to the manager, in order to improve the ux and flag the expense as already submitted while waiting for validations?

Indeed, it's quite puzzling to the employee to get 2 validation actions at its initial state Draft:

  • Submit to manager (standard one), primary action but locked due to the tier validation.
  • Request Validation (added by the module)

The case is a 2 steps validation by managers with a strict control on the users allowed to approve. The module fits this perfectly.

Steps to reproduce
Here is how I tried to do it:

  • Configure a tier approval with a domain on expense report [["state","=","submit"]]
  • Create an expense report

Current behavior
The approval is triggered at the Draft state, and the button Request Validation already shows up next to Submit to Manager.

Expected behavior
To trigger this action in state submit, after the employee has triggered Submit to Manager

Thanks a lot in advance for your insight!

Hello @fgi-osw ,

if you want to trigger tier validation after submit to manager you should hook state_from, state_to in this function
https://github.com/OCA/hr-expense/blob/14.0/hr_expense_tier_validation/models/hr_expense_sheet.py#L10
or use this pr #109

For me, you can move manager to first tier validation and ignore submit to manager by tier validation server action https://github.com/OCA/server-ux/tree/14.0/base_tier_validation_server_action

Nice! thanks!