Skip to content

Commit

Permalink
Merge #5954
Browse files Browse the repository at this point in the history
5954: Convert cost allocation basis units to translation token for predefined bases r=jmcameron a=jmcameron

Converts the 'units' field cost allocation basis items to be a translation token for predefined basis items so that they can be translated when possible.

Cleaned up/reorganized many of the cost allocation translation items into cost_center.json.  Deleted the old fee_center.json files (not needed after the reorganization).  Reworded some of the terms related to cost allocations.

Temporarily disabled the display of the  old cost distribution pages.  No code was deleted *yet*.

Closes #5926

Partially implements #5926: the cost allocation basis table is modified with the new data items but the formatting of the tabular display was not done yet.

*TESTING*
- Use bhima_test
- yarn; yarn build; yarn build:db
- Load the test data in server/models/migration/next/sample_cost_center_data.sql
- Try the functions under the Cost Center Management page and notice that the units for predefined basis items work properly (in English and French).
- Please review the French translations!

Co-authored-by: Jonathan Cameron <jmcameron@gmail.com>
  • Loading branch information
bors[bot] and jmcameron committed Oct 1, 2021
2 parents 7867626 + 2d9f5bf commit 50dfad2
Show file tree
Hide file tree
Showing 28 changed files with 144 additions and 167 deletions.
26 changes: 21 additions & 5 deletions client/src/i18n/en/cost_center.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
{
"COST_CENTER" : {
"TITLE" : "Cost Center",
"ALLOCATION_REGISTRY" : "Cost Center Allocation Registry",
"ALLOCATION_KEYS" : "Allocation Keys",
"TITLE" : "Cost Centers",
"ADD_ALLOCATION_KEYS" : "Add Allocation Keys",
"EDIT_ALLOCATION_KEYS" : "Edit Allocation Keys"
"ADD_COST_CENTER" : "Add a Cost Center",
"ALLOCATION_BASES":"Allocation Bases",
"ALLOCATION_BASIS": "Allocation basis",
"ALLOCATION_BASIS_TABLE": "Table of allocation bases",
"ALLOCATION_BY_COST_CENTERS" : "Allocations by cost center according to the allocation bases",
"ALLOCATION_KEYS" : "Allocation Bases",
"ALLOCATION_REGISTRY" : "Cost Center Allocation Registry",
"AUXILIARY": "Auxiliary Cost Center",
"DELETE": "Delete This Cost Center",
"DIRECT_COST": "Direct Cost",
"EDIT_ALLOCATION_BASIS": "Edit allocation basis",
"EDIT_ALLOCATION_KEYS" : "Edit Allocation Keys",
"EDIT_COST_CENTER" : "Update the Cost Center Information",
"PRINCIPAL": "Principal Cost Center",
"SELECT_ALLOCATION_BASIS": "Select allocation basis",
"STEP_DOWN_COST_ALLOCATION": "Step-down cost allocation"
},
"ALLOCATION_METHOD": "Allocation method",
"ALLOCATION_METHOD_FLAT": "Flat",
Expand All @@ -14,14 +27,17 @@
"ALLOCATION_BASIS": "Allocation basis",
"ALLOCATION_BASIS_AREA_USED": "Area used",
"ALLOCATION_BASIS_AREA_USED_DESCRIPTION": "Area used by the service",
"ALLOCATION_BASIS_AREA_USED_UNITS": "",
"ALLOCATION_BASIS_DIRECT_COST": "Direct cost",
"ALLOCATION_BASIS_DIRECT_COST_DESCRIPTION": "Direct cost of the service",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED": "Electricity consumed",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED_DESCRIPTION": "Electricity consumed by the service",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED_UNITS": "kWh",
"ALLOCATION_BASIS_NUM_COMPUTERS": "Num. computers",
"ALLOCATION_BASIS_NUM_COMPUTERS_DESCRIPTION": "Number of computers in the service",
"ALLOCATION_BASIS_NUM_EMPLOYEES": "Num. employees",
"ALLOCATION_BASIS_NUM_EMPLOYEES_DESCRIPTION": "Number of employees of the service",
"ALLOCATION_BASIS_NUM_LABOR_HOURS": "Num. labor hours",
"ALLOCATION_BASIS_NUM_LABOR_HOURS_DESCRIPTION": "Number of labor hours by the service"
"ALLOCATION_BASIS_NUM_LABOR_HOURS_DESCRIPTION": "Number of labor hours by the service",
"ALLOCATION_BASIS_NUM_LABOR_HOURS_UNITS": "hours"
}
20 changes: 0 additions & 20 deletions client/src/i18n/en/fee_center.json

This file was deleted.

21 changes: 0 additions & 21 deletions client/src/i18n/en/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,27 +283,6 @@
"AGE":"Age",
"ALGO_MONTHLY_CONSUMPTION": "Algorithm for calculating average monthly consumption",
"ALL": "All",
"ALLOCATION_METHOD": "Allocation method",
"ALLOCATION_METHOD_FLAT": "Flat",
"ALLOCATION_METHOD_PROPORTIONAL": "Proportional",
"ALLOCATION_METHOD_TOOLTIP": "The selected allocation method and quantity will be used in cost-center step-down analysis to divide the costs of this center into other centers.",
"ALLOCATION_BASES": "Allocation bases",
"ALLOCATION_BASIS": "Allocation basis",
"ALLOCATION_BASIS_AREA_USED": "Area used",
"ALLOCATION_BASIS_AREA_USED_DESCRIPTION": "Area used by the service",
"ALLOCATION_BASIS_DIRECT_COST": "Direct cost",
"ALLOCATION_BASIS_DIRECT_COST_DESCRIPTION": "Direct cost of the service",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED": "Electricity consumed",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED_DESCRIPTION": "Electricity consumed by the service",
"ALLOCATION_BASIS_NUM_COMPUTERS": "Num. computers",
"ALLOCATION_BASIS_NUM_COMPUTERS_DESCRIPTION": "Number of computers in the service",
"ALLOCATION_BASIS_NUM_EMPLOYEES": "Num. employees",
"ALLOCATION_BASIS_NUM_EMPLOYEES_DESCRIPTION": "Number of employees of the service",
"ALLOCATION_BASIS_NUM_LABOR_HOURS": "Num. labor hours",
"ALLOCATION_BASIS_NUM_LABOR_HOURS_DESCRIPTION": "Number of labor hours by the service",
"EDIT_ALLOCATION_BASIS": "Edit allocation basis",
"SELECT_ALLOCATION_BASIS": "Select allocation basis",
"STEP_DOWN_COST_ALLOCATION": "Step-down cost allocation",
"ALL_EMPLOYEES": "All Employees",
"ALL_GENDER": "All Genders",
"SEE_ALL" : "See all",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/en/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"TITLE": "Cost Center Report"
},
"COST_CENTER_STEPDOWN": {
"TITLE": "Allocation of Cost Centers",
"TITLE": "Step-Down Allocation of Cost Centers",
"DESCRIPTION": "Displays the cost allocations from the auxiliary centers to the main centers with the 'Step-Down' method"
},
"GENERATED": "Generated Report",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/en/tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"AGED_DEBTORS" : "Aged Debtors Report",
"AGGREGATED_STOCK_CONSUMPTION" : "Compute Aggregate Stock Consumption",
"ALLOCATION_AUX_FEES_CENTERS" : "Allocation of Auxiliary Cost Centers",
"ALLOCATION_KEYS": "Allocation Key Management",
"BALANCE" : "Balance",
"BALANCE_REPORT" : "Balance of Accounts",
"BALANCE_SHEET" : "Balance Sheet",
Expand Down Expand Up @@ -56,6 +55,7 @@
"DEPOTS_REGISTRY" : "Depots Registry",
"DISPLAY_METADATA": "Display Metadata",
"DISTRIBUTION_KEYS": "Allocation Keys",
"DISTRIBUTION_KEYS_MANAGEMENT": "Distribution Key Management",
"DITRIBUTION_AUX_FEES_CENTERS" : "Cost Center Allocation",
"DUPLICATE_LOTS" : "Find Duplicate Lots",
"EMPLOYEE" : "Employee",
Expand Down
26 changes: 21 additions & 5 deletions client/src/i18n/fr/cost_center.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
{
"COST_CENTER" : {
"TITLE" : "Centre de coût",
"ALLOCATION_REGISTRY" : "Registre des allocations aux centres de coût",
"ALLOCATION_KEYS" : "Clés de répartitions",
"TITLE" : "Centres de coût",
"ADD_ALLOCATION_KEYS" : "Ajouter les clés de répartition",
"EDIT_ALLOCATION_KEYS" : "Modifier les clés de répartition"
"ADD_COST_CENTER" : "Ajouter un centre de coût",
"ALLOCATION_BASES":"Les bases d'allocation",
"ALLOCATION_BASIS": "Base d'allocation",
"ALLOCATION_BASIS_TABLE": "Tableau des bases d'allocation'",
"ALLOCATION_BY_COST_CENTERS" : "Les allocations par centre de couts suivant les bases des repartitions",
"ALLOCATION_KEYS" : "Clés de répartitions",
"ALLOCATION_REGISTRY" : "Registre des allocations aux centres de coût",
"AUXILIARY": "Centre de coût Auxiliaire",
"DELETE": "Supprimer le Centre de coût",
"DIRECT_COST": "Cout direct",
"EDIT_ALLOCATION_BASIS": "Modifier le base d'allocation",
"EDIT_ALLOCATION_KEYS" : "Modifier les clés de répartition",
"EDIT_COST_CENTER" : "Mise à jour des informations du centre de coût",
"PRINCIPAL": "Centre de coût Principal",
"SELECT_ALLOCATION_BASIS": "Sélectionnez la base d'allocation",
"STEP_DOWN_COST_ALLOCATION": "Allocation séquentielle des coûts"
},
"ALLOCATION_METHOD": "Méthode d'allocation séquentielle des coûts",
"ALLOCATION_METHOD_FLAT": "Uniform",
Expand All @@ -14,14 +27,17 @@
"ALLOCATION_BASIS": "Base d'allocation",
"ALLOCATION_BASIS_AREA_USED": "Arie utilisée",
"ALLOCATION_BASIS_AREA_USED_DESCRIPTION": "Surface utilisée par le service",
"ALLOCATION_BASIS_AREA_USED_UNITS": "",
"ALLOCATION_BASIS_DIRECT_COST": "Coût direct",
"ALLOCATION_BASIS_DIRECT_COST_DESCRIPTION": "Coût direct du service",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED": "Électricité consommée",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED_DESCRIPTION": "Électricité consommée par le service",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED_UNITS": "kWh",
"ALLOCATION_BASIS_NUM_COMPUTERS": "Nº d'ordinateurs",
"ALLOCATION_BASIS_NUM_COMPUTERS_DESCRIPTION": "Nombre d'ordinateurs du service",
"ALLOCATION_BASIS_NUM_EMPLOYEES": "Nº d'employés",
"ALLOCATION_BASIS_NUM_EMPLOYEES_DESCRIPTION": "Nombre d'employés du service",
"ALLOCATION_BASIS_NUM_LABOR_HOURS": "Nº d'heures de travail",
"ALLOCATION_BASIS_NUM_LABOR_HOURS_DESCRIPTION": "Nombre d'heures de travail effectuées par le service"
"ALLOCATION_BASIS_NUM_LABOR_HOURS_DESCRIPTION": "Nombre d'heures de travail effectuées par le service",
"ALLOCATION_BASIS_NUM_LABOR_HOURS_UNITS": "heures"
}
20 changes: 0 additions & 20 deletions client/src/i18n/fr/fee_center.json

This file was deleted.

21 changes: 0 additions & 21 deletions client/src/i18n/fr/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,27 +283,6 @@
"AGE":"Age",
"ALGO_MONTHLY_CONSUMPTION": "Algorithme pour le calcul de la consommation moyenne mensuelle",
"ALL": "Tous",
"ALLOCATION_METHOD": "Méthode d'allocation séquentielle des coûts",
"ALLOCATION_METHOD_FLAT": "Uniform",
"ALLOCATION_METHOD_PROPORTIONAL": "Proportionnelle",
"ALLOCATION_METHOD_TOOLTIP": "La méthode d'allocation et la quantité sélectionnées seront utilisées dans l'analyse de réduction par centres de coûts pour diviser les coûts de ce centre en d'autres centres.",
"ALLOCATION_BASES": "Les bases d'allocation",
"ALLOCATION_BASIS": "Base d'allocation",
"ALLOCATION_BASIS_AREA_USED": "Arie utilisée",
"ALLOCATION_BASIS_AREA_USED_DESCRIPTION": "Surface utilisée par le service",
"ALLOCATION_BASIS_DIRECT_COST": "Coût direct",
"ALLOCATION_BASIS_DIRECT_COST_DESCRIPTION": "Coût direct du service",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED": "Électricité consommée",
"ALLOCATION_BASIS_ELECTRICITY_CONSUMED_DESCRIPTION": "Électricité consommée par le service",
"ALLOCATION_BASIS_NUM_COMPUTERS": "Nº d'ordinateurs",
"ALLOCATION_BASIS_NUM_COMPUTERS_DESCRIPTION": "Nombre d'ordinateurs du service",
"ALLOCATION_BASIS_NUM_EMPLOYEES": "Nº d'employés",
"ALLOCATION_BASIS_NUM_EMPLOYEES_DESCRIPTION": "Nombre d'employés du service",
"ALLOCATION_BASIS_NUM_LABOR_HOURS": "Nº d'heures de travail",
"ALLOCATION_BASIS_NUM_LABOR_HOURS_DESCRIPTION": "Nombre d'heures de travail effectuées par le service",
"EDIT_ALLOCATION_BASIS": "Modifier le base d'allocation",
"SELECT_ALLOCATION_BASIS": "Sélectionnez la base d'allocation",
"STEP_DOWN_COST_ALLOCATION": "Allocation séquentielle des coûts",
"ALL_EMPLOYEES": "Tous les employés",
"ALL_GENDER": "Tous les genres",
"SEE_ALL" : "Tout voir",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/fr/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"TITLE": "Rapports des centres de coût"
},
"COST_CENTER_STEPDOWN": {
"TITLE": "Allocation des centres de coût",
"TITLE": "Allocation des coûts par étapes",
"DESCRIPTION": "Affiche les allocations des couts des centres auxiliaires vers les centres principaux avec la methode de 'Step-Down'"
},
"GENERATED" : "Rapport généré",
Expand Down
2 changes: 1 addition & 1 deletion client/src/i18n/fr/tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"AGED_DEBTORS":"Balance âgée des Conventionnés",
"AGGREGATED_STOCK_CONSUMPTION" : "Consommation de stock agrégée",
"ALLOCATION_AUX_FEES_CENTERS" : "Allocation des centres de cout auxiliaires",
"ALLOCATION_KEYS": "Gestion des clés de répartition",
"BALANCE":"Balance",
"BALANCE_REPORT":"Balance des comptes",
"BALANCE_SHEET":"Bilan",
Expand Down Expand Up @@ -53,6 +52,7 @@
"DEPOTS_REGISTRY":"Registre des dépôts",
"DISPLAY_METADATA": "Afficher les métadonnées",
"DISTRIBUTION_KEYS": "Gestion des clés de répartitions",
"DISTRIBUTION_KEYS_MANAGEMENT": "Gestion des clés de répartition",
"DITRIBUTION_AUX_FEES_CENTERS" : "Répartitions des centres de coût auxiliaires",
"DUPLICATE_LOTS" : "Trouver des lots en double",
"EMPLOYEE":"Gestion des Employés",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="bhima-title">
<ol class="headercrumb">
<li class="static" translate>TREE.COST_CENTER_MANAGEMENT</li>
<li class="title" translate>TREE.ALLOCATION_KEYS</li>
<li class="title" translate>TREE.DISTRIBUTION_KEYS_MANAGEMENT</li>
</ol>

<div class="toolbar">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="modal-header">
<ol class="headercrumb">
<li class="static" translate> TREE.FINANCE </li>
<li class="title" translate> TREE.ALLOCATION_KEYS </li>
<li class="title" translate> TREE.DISTRIBUTION_KEYS_MANAGEMENT </li>
</ol>
<div>
<label class="badge badge-success"> {{ DistributionKeyModalCtrl.settings.auxiliary_label }} </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ol class="headercrumb">
<li class="static" translate> TREE.FINANCE </li>
<li class="static" translate> COST_CENTER.TITLE </li>
<li class="title" translate> COST_CENTER.ALLOCATION_KEYS </li>
<li class="title" translate> COST_CENTER.ALLOCATION_BASES </li>
</ol>

<div class="toolbar">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="modal-body">

<bh-cost-center-select
<bh-cost-center-select
cost-center-id="CCAllocationBasisModalCtrl.costCenterId"
on-select-callback="CCAllocationBasisModalCtrl.onSelectCostCenter(costCenter)"
disabled="!CCAllocationBasisModalCtrl.isCreateState"
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/cost_center/cost_center.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ul uib-dropdown-menu role="menu" class="dropdown-menu-right">
<li role="menuitem">
<a href data-method="edit" ng-click="CostCenterCtrl.openEditAllocationBasisModal()">
<i class="fa fa-table"></i> <span translate>FORM.LABELS.ALLOCATION_BASES</span>
<i class="fa fa-table"></i> <span translate>ALLOCATION_BASES</span>
</a>
</li>
</ul>
Expand Down
22 changes: 12 additions & 10 deletions client/src/modules/cost_center/cost_center.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ function CostCenterController(CostCenters, ModalService, Notify, uiGridConstants
},
{
field : 'allocation_method',
displayName : 'FORM.LABELS.ALLOCATION_METHOD',
headerToolTip : 'FORM.LABELS.ALLOCATION_METHOD_TOOLTIP',
displayName : 'ALLOCATION_METHOD',
headerToolTip : 'ALLOCATION_METHOD_TOOLTIP',
headerCellFilter : 'translate',
headerCellClass : 'allocationBasisColHeader',
visible : true,
cellTemplate : '/modules/cost_center/templates/allocationBasis.tmpl.html',
},
{
field : 'allocation_basis_name',
displayName : 'FORM.LABELS.ALLOCATION_BASIS',
displayName : 'ALLOCATION_BASIS',
headerCellFilter : 'translate',
headerCellClass : 'allocationBasisColHeader',
visible : true,
Expand Down Expand Up @@ -108,13 +108,15 @@ function CostCenterController(CostCenters, ModalService, Notify, uiGridConstants
.then((data) => {
data.forEach(fc => {
// Translate each cost center allocation basis name
fc.allocation_basis_name = fc.allocation_basis.is_predefined
? $translate.instant(`FORM.LABELS.${fc.allocation_basis.name}`)
: fc.allocation_basis.name;

if (fc.allocation_basis.units) {
// Note: Do not translate the units
fc.allocation_basis_name += ` (${fc.allocation_basis.units})`;
if (fc.allocation_basis.is_predefined) {
fc.allocation_basis_name = $translate.instant(fc.allocation_basis.name);
fc.allocation_basis_units = fc.allocation_basis.units ? $translate.instant(fc.allocation_basis.units) : '';
} else {
fc.allocation_basis_name = fc.allocation_basis.name;
fc.allocation_basis_units = fc.allocation_basis.units;
}
if (fc.allocation_basis_units) {
fc.allocation_basis_name += ` (${fc.allocation_basis_units})`;
}
});
vm.gridOptions.data = data;
Expand Down
28 changes: 14 additions & 14 deletions client/src/modules/cost_center/modals/cost_center.modal.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<form name="CostCenterForm" bh-submit="CostCenterModalCtrl.submit(CostCenterForm)" novalidate>
<div class="modal-header">
<ol class="headercrumb">
<li ng-if="CostCenterModalCtrl.isCreateState" class="title">
<span translate> COST_CENTER.ADD_COST_CENTER </span>
<label class="badge badge-warning" translate>FORM.LABELS.CREATE</label>
</li>
<li ng-if="!CostCenterModalCtrl.isCreateState" class="title">
<span translate> COST_CENTER.EDIT_COST_CENTER </span>
<label class="badge badge-warning" translate>FORM.LABELS.UPDATE</label>
</li>
</ol>
</div>
<ol class="headercrumb">
<li ng-if="CostCenterModalCtrl.isCreateState" class="title">
<span translate> COST_CENTER.ADD_COST_CENTER </span>
<label class="badge badge-warning" translate>FORM.LABELS.CREATE</label>
</li>
<li ng-if="!CostCenterModalCtrl.isCreateState" class="title">
<span translate> COST_CENTER.EDIT_COST_CENTER </span>
<label class="badge badge-warning" translate>FORM.LABELS.UPDATE</label>
</li>
</ol>
</div>

<div class="modal-body">
<div class="form-group" ng-class="{ 'has-error' : CostCenterForm.$submitted && CostCenterForm.label.$invalid }">
Expand Down Expand Up @@ -220,8 +220,8 @@
<!-- Step-down allocation basis -->
<hr>
<div class="radio">
<p><strong translate>FORM.LABELS.STEP_DOWN_COST_ALLOCATION</strong></p>
<label class="control-label" style="vertical-align: middle;" translate>FORM.LABELS.ALLOCATION_METHOD</label>:
<p><strong translate>COST_CENTER.STEP_DOWN_COST_ALLOCATION</strong></p>
<label class="control-label" style="vertical-align: middle;" translate>ALLOCATION_METHOD</label>:
<label class="radio-inline" ng-repeat="choice in CostCenterModalCtrl.allocationMethodOptions">
<input
type="radio"
Expand All @@ -236,7 +236,7 @@

<div class="form-group"
ng-class="{ 'has-error' : CostCenterForm.$submitted && CostCenterForm.allocation_basis.$invalid }">
<label class="control-label" translate>FORM.LABELS.SELECT_ALLOCATION_BASIS</label>
<label class="control-label" translate>COST_CENTER.SELECT_ALLOCATION_BASIS</label>
<select class="form-control"
name="allocation_basis"
ng-model="CostCenterModalCtrl.costCenter.allocation_basis.id"
Expand Down
Loading

0 comments on commit 50dfad2

Please sign in to comment.