Skip to content

Commit

Permalink
Feature RM#84194:Expense: Re-add ‘Complete my...’ menu entries
Browse files Browse the repository at this point in the history
  • Loading branch information
vva-axelor committed Feb 18, 2025
1 parent 5169fb2 commit 866ac1a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 9 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,18 @@ public void editExpense(ActionRequest request, ActionResponse response) {
response.setView(
ActionView.define(I18n.get("Expense"))
.model(Expense.class.getName())
.add("form", "expense-form")
.add("form", "complete-my-expense-form")
.context("_payCompany", Beans.get(UserHrService.class).getPayCompany(user))
.context("_isEmployeeReadOnly", true)
.map());
} else if (expenseList.size() == 1) {
response.setView(
ActionView.define(I18n.get("Expense"))
.model(Expense.class.getName())
.add("form", "expense-form")
.add("form", "complete-my-expense-form")
.param("forceEdit", "true")
.context("_showRecord", String.valueOf(expenseList.get(0).getId()))
.context("_isEmployeeReadOnly", true)
.map());
} else {
response.setView(
Expand Down Expand Up @@ -190,10 +192,11 @@ public void editExpenseSelected(ActionRequest request, ActionResponse response)
response.setView(
ActionView.define(I18n.get("Expense"))
.model(Expense.class.getName())
.add("form", "expense-form")
.add("form", "complete-my-expense-form")
.param("forceEdit", "true")
.domain("self.id = " + expenseId)
.context("_showRecord", expenseId)
.context("_isEmployeeReadOnly", true)
.map());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
"conf-expense-type";"Expense Manager"
"kilometric-allow-param-all";"Employee Manager"
"top-menu-hr-my-expense";"Expense Manager|Expense User|Expense Read"
"edit-expense";"Expense Manager|Expense User|Expense Read"
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@
"top-menu-hr-my-expense";"Admin"
"top-menu-hr-my-leave-request";"Admin"
"top-menu-hr-my-extra-hours";"Admin"
"edit-expense";"Admin"
1 change: 1 addition & 0 deletions axelor-human-resource/src/main/resources/i18n/messages.csv
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"Company fixed phone",,,
"Company's credit card",,,
"Complete",,,
"Complete my expense",,,
"Completed",,,
"Compute amounts",,,
"Compute distance with web service",,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"Company fixed phone",,,
"Company's credit card",,,
"Complete",,,
"Complete my expense",,,
"Completed",,,
"Compute amounts",,,
"Compute distance with web service",,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"Company fixed phone","N° de téléphone de la société",,
"Company's credit card","CB de la société",,
"Complete",,,
"Complete my expense","Compléter ma note de frais",,
"Completed",,,
"Compute amounts","Calculer les montants",,
"Compute distance with web service","Calculer la distance avec un service web",,
Expand Down
9 changes: 8 additions & 1 deletion axelor-human-resource/src/main/resources/views/Expense.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@
</panel>
</form>

<form name="complete-my-expense-form" title="Expense" model="com.axelor.apps.hr.db.Expense"
width="large" onNew="action-expense-group-form-onNew" onLoad="action-expense-group-form-onLoad"
onSave="action-expense-method-validate-and-compute" canDelete="ventilated == false"
canNew="false">
<panel-include view="expense-form"/>
</form>

<action-group name="action-expense-group-form-onNew">
<action name="action-expense-record-default"/>
<action name="action-expense-attrs-hide-button-readonly-field"/>
Expand Down Expand Up @@ -396,7 +403,7 @@
<attribute name="readonly" for="company" expr="eval: statusSelect &gt; 2"
if="__user__.employee?.hrManager"/>
<attribute name="readonly" for="employee"
expr="eval: statusSelect &gt; 2 || (!__user__.employee?.hrManager &amp;&amp; __repo__(Employee).all().filter('self.managerUser.id = ?', __user__.id).count() == 0)"/>
expr="eval: statusSelect &gt; 2 || (!__user__.employee?.hrManager &amp;&amp; __repo__(Employee).all().filter('self.managerUser.id = ?', __user__.id).count() == 0) || _isEmployeeReadOnly"/>
</action-attrs>

<action-attrs name="action-expense-attrs-expense-company-cb">
Expand Down
9 changes: 6 additions & 3 deletions axelor-human-resource/src/main/resources/views/Menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@
<context name="to_justify_leave_reason" expr="eval: false"/>
</action-view>

<menuitem name="all-expense" parent="my-hr-root" title="Expenses" action="expense.all"
order="300" if="__config__.app.isApp('expense')" icon="credit-card-fill"
<menuitem name="edit-expense" parent="my-hr-root" title="Complete my expense"
action="edit.expense" order="300" if="__config__.app.isApp('expense')" icon="credit-card-fill"
icon-background="#84429f"/>

<menuitem name="all-expense" parent="my-hr-root" title="Expenses" action="expense.all"
order="310" if="__config__.app.isApp('expense')" icon="list-task" icon-background="#84429f"/>

<action-view name="expense.all" model="com.axelor.apps.hr.db.Expense"
title="My Expenses">
<view name="expense-grid" type="grid"/>
Expand All @@ -49,7 +52,7 @@
</action-view>

<menuitem name="my-hr-root-expense-declaration" parent="my-hr-root"
title="Expenses declaration" action="my.hr.root.expense.declaration" order="310"
title="Expenses declaration" action="my.hr.root.expense.declaration" order="320"
if="__config__.app.isApp('expense') &amp;&amp; __config__.app.getApp('expense')?.enableExpenseDeclaration"
icon="credit-card-fill" icon-background="#84429f"/>

Expand Down

0 comments on commit 866ac1a

Please sign in to comment.