coati-payroll 0.0.12__py3-none-any.whl → 0.0.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of coati-payroll might be problematic. Click here for more details.

Files changed (244) hide show
  1. coati_payroll/__init__.py +7 -17
  2. coati_payroll/app.py +2 -13
  3. coati_payroll/audit_helpers.py +2 -13
  4. coati_payroll/auth.py +2 -13
  5. coati_payroll/cli.py +17 -14
  6. coati_payroll/config.py +2 -13
  7. coati_payroll/demo_data.py +2 -13
  8. coati_payroll/enums.py +2 -13
  9. coati_payroll/forms.py +7 -13
  10. coati_payroll/formula_engine/__init__.py +14 -13
  11. coati_payroll/formula_engine/ast/__init__.py +16 -1
  12. coati_payroll/formula_engine/ast/ast_visitor.py +15 -17
  13. coati_payroll/formula_engine/ast/expression_evaluator.py +12 -14
  14. coati_payroll/formula_engine/ast/safe_operators.py +16 -15
  15. coati_payroll/formula_engine/ast/type_converter.py +17 -17
  16. coati_payroll/formula_engine/data_sources.py +3 -13
  17. coati_payroll/formula_engine/engine.py +12 -13
  18. coati_payroll/formula_engine/exceptions.py +13 -13
  19. coati_payroll/formula_engine/execution/__init__.py +15 -13
  20. coati_payroll/formula_engine/execution/execution_context.py +12 -13
  21. coati_payroll/formula_engine/execution/step_executor.py +12 -14
  22. coati_payroll/formula_engine/execution/variable_store.py +13 -13
  23. coati_payroll/formula_engine/novelty_codes.py +3 -13
  24. coati_payroll/formula_engine/results/__init__.py +14 -13
  25. coati_payroll/formula_engine/results/execution_result.py +47 -35
  26. coati_payroll/formula_engine/steps/__init__.py +14 -14
  27. coati_payroll/formula_engine/steps/assignment_step.py +12 -13
  28. coati_payroll/formula_engine/steps/base_step.py +13 -13
  29. coati_payroll/formula_engine/steps/calculation_step.py +12 -13
  30. coati_payroll/formula_engine/steps/conditional_step.py +12 -13
  31. coati_payroll/formula_engine/steps/step_factory.py +11 -13
  32. coati_payroll/formula_engine/steps/tax_lookup_step.py +12 -13
  33. coati_payroll/formula_engine/tables/__init__.py +14 -13
  34. coati_payroll/formula_engine/tables/bracket_calculator.py +12 -13
  35. coati_payroll/formula_engine/tables/table_lookup.py +12 -14
  36. coati_payroll/formula_engine/tables/tax_table.py +13 -13
  37. coati_payroll/formula_engine/validation/__init__.py +14 -13
  38. coati_payroll/formula_engine/validation/schema_validator.py +12 -14
  39. coati_payroll/formula_engine/validation/security_validator.py +12 -13
  40. coati_payroll/formula_engine/validation/tax_table_validator.py +12 -13
  41. coati_payroll/formula_engine_examples.py +2 -13
  42. coati_payroll/i18n.py +2 -13
  43. coati_payroll/initial_data.py +2 -13
  44. coati_payroll/interes_engine.py +2 -13
  45. coati_payroll/liquidacion_engine/__init__.py +2 -13
  46. coati_payroll/liquidacion_engine/engine.py +2 -13
  47. coati_payroll/locale_config.py +2 -13
  48. coati_payroll/migrations/20260125_032900_initial_migration.py +2 -14
  49. coati_payroll/migrations/__init__.py +2 -13
  50. coati_payroll/model.py +83 -82
  51. coati_payroll/nomina_engine/__init__.py +2 -13
  52. coati_payroll/nomina_engine/calculators/__init__.py +2 -13
  53. coati_payroll/nomina_engine/calculators/benefit_calculator.py +2 -13
  54. coati_payroll/nomina_engine/calculators/concept_calculator.py +2 -1
  55. coati_payroll/nomina_engine/calculators/deduction_calculator.py +2 -13
  56. coati_payroll/nomina_engine/calculators/exchange_rate_calculator.py +2 -13
  57. coati_payroll/nomina_engine/calculators/perception_calculator.py +2 -13
  58. coati_payroll/nomina_engine/calculators/salary_calculator.py +2 -13
  59. coati_payroll/nomina_engine/domain/__init__.py +2 -13
  60. coati_payroll/nomina_engine/domain/calculation_items.py +2 -13
  61. coati_payroll/nomina_engine/domain/employee_calculation.py +2 -13
  62. coati_payroll/nomina_engine/domain/payroll_context.py +2 -13
  63. coati_payroll/nomina_engine/engine.py +2 -13
  64. coati_payroll/nomina_engine/processors/__init__.py +2 -13
  65. coati_payroll/nomina_engine/processors/accounting_processor.py +2 -13
  66. coati_payroll/nomina_engine/processors/accumulation_processor.py +2 -13
  67. coati_payroll/nomina_engine/processors/loan_processor.py +2 -13
  68. coati_payroll/nomina_engine/processors/novelty_processor.py +2 -13
  69. coati_payroll/nomina_engine/processors/vacation_processor.py +2 -13
  70. coati_payroll/nomina_engine/repositories/__init__.py +2 -13
  71. coati_payroll/nomina_engine/repositories/acumulado_repository.py +2 -13
  72. coati_payroll/nomina_engine/repositories/base_repository.py +2 -13
  73. coati_payroll/nomina_engine/repositories/config_repository.py +2 -13
  74. coati_payroll/nomina_engine/repositories/employee_repository.py +2 -13
  75. coati_payroll/nomina_engine/repositories/exchange_rate_repository.py +2 -13
  76. coati_payroll/nomina_engine/repositories/novelty_repository.py +2 -13
  77. coati_payroll/nomina_engine/repositories/planilla_repository.py +2 -13
  78. coati_payroll/nomina_engine/results/__init__.py +2 -13
  79. coati_payroll/nomina_engine/results/error_result.py +2 -13
  80. coati_payroll/nomina_engine/results/payroll_result.py +2 -13
  81. coati_payroll/nomina_engine/results/validation_result.py +2 -13
  82. coati_payroll/nomina_engine/services/__init__.py +2 -13
  83. coati_payroll/nomina_engine/services/accounting_voucher_service.py +2 -13
  84. coati_payroll/nomina_engine/services/employee_processing_service.py +2 -13
  85. coati_payroll/nomina_engine/services/payroll_execution_service.py +2 -13
  86. coati_payroll/nomina_engine/validators/__init__.py +2 -13
  87. coati_payroll/nomina_engine/validators/base_validator.py +2 -13
  88. coati_payroll/nomina_engine/validators/currency_validator.py +2 -13
  89. coati_payroll/nomina_engine/validators/employee_validator.py +2 -13
  90. coati_payroll/nomina_engine/validators/period_validator.py +2 -13
  91. coati_payroll/nomina_engine/validators/planilla_validator.py +2 -13
  92. coati_payroll/queue/__init__.py +2 -13
  93. coati_payroll/queue/driver.py +2 -13
  94. coati_payroll/queue/drivers/__init__.py +2 -13
  95. coati_payroll/queue/drivers/dramatiq_driver.py +9 -16
  96. coati_payroll/queue/drivers/huey_driver.py +2 -13
  97. coati_payroll/queue/drivers/noop_driver.py +2 -13
  98. coati_payroll/queue/selector.py +2 -13
  99. coati_payroll/queue/tasks.py +13 -20
  100. coati_payroll/rate_limiting.py +2 -13
  101. coati_payroll/rbac.py +12 -19
  102. coati_payroll/report_engine.py +2 -13
  103. coati_payroll/report_export.py +2 -13
  104. coati_payroll/schema_validator.py +2 -13
  105. coati_payroll/security.py +2 -13
  106. coati_payroll/static/schema_editor.js +862 -0
  107. coati_payroll/static/styles.css +5 -0
  108. coati_payroll/system_reports.py +2 -13
  109. coati_payroll/templates/auth/login.html +5 -0
  110. coati_payroll/templates/base.html +5 -1
  111. coati_payroll/templates/index.html +5 -0
  112. coati_payroll/templates/macros.html +5 -0
  113. coati_payroll/templates/modules/calculation_rule/form.html +5 -0
  114. coati_payroll/templates/modules/calculation_rule/index.html +5 -0
  115. coati_payroll/templates/modules/calculation_rule/schema_editor.html +292 -974
  116. coati_payroll/templates/modules/carga_inicial_prestacion/form.html +5 -0
  117. coati_payroll/templates/modules/carga_inicial_prestacion/index.html +5 -0
  118. coati_payroll/templates/modules/carga_inicial_prestacion/reporte.html +5 -0
  119. coati_payroll/templates/modules/config_calculos/index.html +5 -0
  120. coati_payroll/templates/modules/configuracion/index.html +24 -27
  121. coati_payroll/templates/modules/currency/form.html +5 -0
  122. coati_payroll/templates/modules/currency/index.html +5 -0
  123. coati_payroll/templates/modules/custom_field/form.html +5 -0
  124. coati_payroll/templates/modules/custom_field/index.html +5 -0
  125. coati_payroll/templates/modules/deduccion/form.html +5 -0
  126. coati_payroll/templates/modules/deduccion/index.html +5 -0
  127. coati_payroll/templates/modules/employee/form.html +5 -0
  128. coati_payroll/templates/modules/employee/index.html +5 -0
  129. coati_payroll/templates/modules/empresa/form.html +5 -0
  130. coati_payroll/templates/modules/empresa/index.html +5 -0
  131. coati_payroll/templates/modules/exchange_rate/form.html +5 -0
  132. coati_payroll/templates/modules/exchange_rate/import.html +5 -0
  133. coati_payroll/templates/modules/exchange_rate/index.html +5 -0
  134. coati_payroll/templates/modules/liquidacion/index.html +5 -0
  135. coati_payroll/templates/modules/liquidacion/nueva.html +5 -0
  136. coati_payroll/templates/modules/liquidacion/ver.html +5 -0
  137. coati_payroll/templates/modules/payroll_concepts/audit_log.html +5 -0
  138. coati_payroll/templates/modules/percepcion/form.html +5 -0
  139. coati_payroll/templates/modules/percepcion/index.html +5 -0
  140. coati_payroll/templates/modules/planilla/config.html +5 -0
  141. coati_payroll/templates/modules/planilla/config_deducciones.html +5 -0
  142. coati_payroll/templates/modules/planilla/config_empleados.html +5 -0
  143. coati_payroll/templates/modules/planilla/config_percepciones.html +5 -0
  144. coati_payroll/templates/modules/planilla/config_prestaciones.html +5 -0
  145. coati_payroll/templates/modules/planilla/config_reglas.html +5 -0
  146. coati_payroll/templates/modules/planilla/ejecutar_nomina.html +5 -0
  147. coati_payroll/templates/modules/planilla/form.html +5 -0
  148. coati_payroll/templates/modules/planilla/index.html +5 -0
  149. coati_payroll/templates/modules/planilla/listar_nominas.html +5 -0
  150. coati_payroll/templates/modules/planilla/log_nomina.html +5 -0
  151. coati_payroll/templates/modules/planilla/novedades/form.html +5 -0
  152. coati_payroll/templates/modules/planilla/novedades/index.html +5 -0
  153. coati_payroll/templates/modules/planilla/ver_nomina.html +5 -0
  154. coati_payroll/templates/modules/planilla/ver_nomina_empleado.html +5 -0
  155. coati_payroll/templates/modules/plugins/index.html +5 -0
  156. coati_payroll/templates/modules/prestacion/form.html +5 -0
  157. coati_payroll/templates/modules/prestacion/index.html +5 -0
  158. coati_payroll/templates/modules/prestacion_management/dashboard.html +5 -0
  159. coati_payroll/templates/modules/prestacion_management/initial_balance_bulk.html +5 -0
  160. coati_payroll/templates/modules/prestamo/approve.html +5 -0
  161. coati_payroll/templates/modules/prestamo/condonacion.html +5 -0
  162. coati_payroll/templates/modules/prestamo/detail.html +5 -0
  163. coati_payroll/templates/modules/prestamo/form.html +5 -0
  164. coati_payroll/templates/modules/prestamo/index.html +5 -0
  165. coati_payroll/templates/modules/prestamo/pago_extraordinario.html +5 -0
  166. coati_payroll/templates/modules/prestamo/tabla_pago_pdf.html +5 -0
  167. coati_payroll/templates/modules/report/admin_index.html +5 -0
  168. coati_payroll/templates/modules/report/detail.html +5 -0
  169. coati_payroll/templates/modules/report/execute.html +5 -0
  170. coati_payroll/templates/modules/report/index.html +5 -0
  171. coati_payroll/templates/modules/report/permissions.html +5 -0
  172. coati_payroll/templates/modules/settings/index.html +5 -0
  173. coati_payroll/templates/modules/shared/concept_form.html +19 -12
  174. coati_payroll/templates/modules/shared/concept_index.html +39 -27
  175. coati_payroll/templates/modules/tipo_planilla/form.html +5 -0
  176. coati_payroll/templates/modules/tipo_planilla/index.html +5 -0
  177. coati_payroll/templates/modules/user/form.html +5 -0
  178. coati_payroll/templates/modules/user/index.html +5 -0
  179. coati_payroll/templates/modules/user/profile.html +5 -0
  180. coati_payroll/templates/modules/vacation/account_detail.html +5 -0
  181. coati_payroll/templates/modules/vacation/account_form.html +5 -0
  182. coati_payroll/templates/modules/vacation/account_index.html +5 -0
  183. coati_payroll/templates/modules/vacation/dashboard.html +5 -0
  184. coati_payroll/templates/modules/vacation/initial_balance_bulk.html +5 -0
  185. coati_payroll/templates/modules/vacation/initial_balance_form.html +5 -0
  186. coati_payroll/templates/modules/vacation/leave_request_detail.html +5 -0
  187. coati_payroll/templates/modules/vacation/leave_request_form.html +5 -0
  188. coati_payroll/templates/modules/vacation/leave_request_index.html +5 -0
  189. coati_payroll/templates/modules/vacation/policy_detail.html +5 -0
  190. coati_payroll/templates/modules/vacation/policy_form.html +5 -0
  191. coati_payroll/templates/modules/vacation/policy_index.html +5 -0
  192. coati_payroll/templates/modules/vacation/register_taken_form.html +5 -0
  193. coati_payroll/translations/en/LC_MESSAGES/messages.mo +0 -0
  194. coati_payroll/translations/en/LC_MESSAGES/messages.po +2963 -3561
  195. coati_payroll/vacation_service.py +2 -13
  196. coati_payroll/version.py +3 -14
  197. coati_payroll/vistas/__init__.py +2 -13
  198. coati_payroll/vistas/calculation_rule.py +14 -24
  199. coati_payroll/vistas/carga_inicial_prestacion.py +2 -13
  200. coati_payroll/vistas/config_calculos.py +2 -13
  201. coati_payroll/vistas/configuracion.py +29 -39
  202. coati_payroll/vistas/constants.py +2 -13
  203. coati_payroll/vistas/currency.py +2 -13
  204. coati_payroll/vistas/custom_field.py +2 -13
  205. coati_payroll/vistas/employee.py +2 -13
  206. coati_payroll/vistas/empresa.py +2 -13
  207. coati_payroll/vistas/exchange_rate.py +2 -13
  208. coati_payroll/vistas/liquidacion.py +2 -13
  209. coati_payroll/vistas/payroll_concepts.py +2 -13
  210. coati_payroll/vistas/planilla/__init__.py +2 -13
  211. coati_payroll/vistas/planilla/association_routes.py +8 -17
  212. coati_payroll/vistas/planilla/config_routes.py +2 -13
  213. coati_payroll/vistas/planilla/export_routes.py +28 -35
  214. coati_payroll/vistas/planilla/helpers/__init__.py +2 -13
  215. coati_payroll/vistas/planilla/helpers/association_helpers.py +2 -13
  216. coati_payroll/vistas/planilla/helpers/excel_helpers.py +2 -13
  217. coati_payroll/vistas/planilla/helpers/form_helpers.py +2 -13
  218. coati_payroll/vistas/planilla/nomina_routes.py +2 -13
  219. coati_payroll/vistas/planilla/novedad_routes.py +2 -13
  220. coati_payroll/vistas/planilla/routes.py +2 -13
  221. coati_payroll/vistas/planilla/services/__init__.py +2 -13
  222. coati_payroll/vistas/planilla/services/export_service.py +4 -15
  223. coati_payroll/vistas/planilla/services/nomina_service.py +2 -13
  224. coati_payroll/vistas/planilla/services/novedad_service.py +3 -16
  225. coati_payroll/vistas/planilla/services/planilla_service.py +2 -13
  226. coati_payroll/vistas/planilla/validators/__init__.py +2 -13
  227. coati_payroll/vistas/planilla/validators/planilla_validators.py +2 -13
  228. coati_payroll/vistas/prestacion.py +2 -13
  229. coati_payroll/vistas/prestamo.py +2 -13
  230. coati_payroll/vistas/report.py +2 -13
  231. coati_payroll/vistas/settings.py +2 -13
  232. coati_payroll/vistas/tipo_planilla.py +2 -13
  233. coati_payroll/vistas/user.py +2 -13
  234. coati_payroll/vistas/vacation.py +15 -13
  235. coati_payroll/wsgi_server.py +37 -0
  236. {coati_payroll-0.0.12.dist-info → coati_payroll-0.0.13.dist-info}/METADATA +11 -4
  237. coati_payroll-0.0.13.dist-info/RECORD +248 -0
  238. coati_payroll/translations/es/LC_MESSAGES/messages.mo +0 -0
  239. coati_payroll/translations/es/LC_MESSAGES/messages.po +0 -7374
  240. coati_payroll-0.0.12.dist-info/RECORD +0 -248
  241. {coati_payroll-0.0.12.dist-info → coati_payroll-0.0.13.dist-info}/LICENSE +0 -0
  242. {coati_payroll-0.0.12.dist-info → coati_payroll-0.0.13.dist-info}/WHEEL +0 -0
  243. {coati_payroll-0.0.12.dist-info → coati_payroll-0.0.13.dist-info}/entry_points.txt +0 -0
  244. {coati_payroll-0.0.12.dist-info → coati_payroll-0.0.13.dist-info}/top_level.txt +0 -0
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Vacation service for integration with payroll engine.
15
4
 
16
5
  This module provides the service layer for vacation accrual and usage
coati_payroll/version.py CHANGED
@@ -1,18 +1,7 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """
15
4
  Canonical version of coati_payroll.
16
5
  """
17
6
 
18
- __version__ = "0.0.12"
7
+ __version__ = "0.0.13"
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Vistas module for the payroll application."""
15
4
 
16
5
  from coati_payroll.vistas.user import user_bp
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Calculation rules CRUD routes."""
15
4
 
16
5
  from __future__ import annotations
@@ -91,14 +80,7 @@ def new():
91
80
  # Initialize with default schema structure
92
81
  # Note: The rule's reference currency is for calculation purposes.
93
82
  # The actual payroll currency is defined in TipoPlanilla.
94
- rule.esquema_json = {
95
- **DEFAULT_SCHEMA,
96
- "meta": {
97
- "name": form.nombre.data,
98
- "reference_currency": form.moneda_referencia.data or "",
99
- "description": form.descripcion.data or "",
100
- },
101
- }
83
+ rule.esquema_json = DEFAULT_SCHEMA
102
84
  rule.creado_por = current_user.usuario
103
85
 
104
86
  db.session.add(rule)
@@ -153,7 +135,9 @@ def edit(id: str):
153
135
  @require_write_access()
154
136
  def edit_schema(id: str):
155
137
  """Edit the JSON schema of a calculation rule."""
138
+
156
139
  rule = db.session.get(ReglaCalculo, id)
140
+
157
141
  if not rule:
158
142
  flash(_(ERROR_RULE_NOT_FOUND), "error")
159
143
  return redirect(url_for("calculation_rule.index"))
@@ -161,12 +145,18 @@ def edit_schema(id: str):
161
145
  # Get available data sources for the UI
162
146
  available_sources = get_available_sources_for_ui()
163
147
 
148
+ raw_schema = rule.esquema_json
149
+ if raw_schema:
150
+ current_schema = json.loads(json.dumps(dict(raw_schema)))
151
+ else:
152
+ current_schema = DEFAULT_SCHEMA
153
+
164
154
  return render_template(
165
155
  "modules/calculation_rule/schema_editor.html",
166
156
  rule=rule,
167
- schema_json=json.dumps(rule.esquema_json or {}, indent=2),
168
- example_schema=json.dumps(EXAMPLE_IR_NICARAGUA_SCHEMA, indent=2),
169
- available_sources=json.dumps(available_sources),
157
+ schema_data=current_schema,
158
+ example_schema_data=EXAMPLE_IR_NICARAGUA_SCHEMA,
159
+ available_sources_data=available_sources,
170
160
  )
171
161
 
172
162
 
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Initial benefit balance loading views."""
15
4
 
16
5
  from __future__ import annotations
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
 
15
4
  """Configuración de parámetros de cálculo."""
16
5
 
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Global configuration views."""
15
4
 
16
5
  from __future__ import annotations
@@ -22,7 +11,7 @@ from __future__ import annotations
22
11
  # <-------------------------------------------------------------------------> #
23
12
  # Third party libraries
24
13
  # <-------------------------------------------------------------------------> #
25
- from flask import Blueprint, flash, redirect, render_template, request, url_for
14
+ from flask import Blueprint, flash, redirect, render_template, url_for
26
15
 
27
16
  # <-------------------------------------------------------------------------> #
28
17
  # Local modules
@@ -43,15 +32,18 @@ configuracion_bp = Blueprint("configuracion", __name__, url_prefix="/configuraci
43
32
  def index():
44
33
  """Display global configuration page."""
45
34
  current_language = get_language_from_db()
46
-
47
- # Language names for display
48
35
  language_names = {"en": "English", "es": "Español"}
36
+ from coati_payroll.forms import ConfiguracionIdiomaForm
49
37
 
38
+ form = ConfiguracionIdiomaForm()
39
+ form.idioma.choices = [(lang, language_names[lang]) for lang in SUPPORTED_LANGUAGES]
40
+ form.idioma.data = current_language
50
41
  return render_template(
51
42
  "modules/configuracion/index.html",
52
43
  current_language=current_language,
53
44
  supported_languages=SUPPORTED_LANGUAGES,
54
45
  language_names=language_names,
46
+ form=form,
55
47
  )
56
48
 
57
49
 
@@ -59,29 +51,27 @@ def index():
59
51
  @require_write_access()
60
52
  def cambiar_idioma():
61
53
  """Change the application language."""
62
- new_language = request.form.get("idioma", "").strip()
54
+ from coati_payroll.forms import ConfiguracionIdiomaForm
63
55
 
64
- if not new_language:
65
- flash(_("Por favor seleccione un idioma."), "warning")
56
+ language_names = {"en": "English", "es": "Español"}
57
+ form = ConfiguracionIdiomaForm()
58
+ form.idioma.choices = [(lang, language_names[lang]) for lang in SUPPORTED_LANGUAGES]
59
+ if form.validate_on_submit():
60
+ new_language = form.idioma.data
61
+ try:
62
+ set_language_in_db(new_language)
63
+ flash(
64
+ _(
65
+ "Idioma actualizado a %(language)s.",
66
+ language=language_names[new_language],
67
+ ),
68
+ "success",
69
+ )
70
+ except Exception as e:
71
+ flash(_("Error al actualizar el idioma: %(error)s", error=str(e)), "danger")
66
72
  return redirect(url_for("configuracion.index"))
67
-
68
- if new_language not in SUPPORTED_LANGUAGES:
69
- flash(_("Idioma no soportado."), "danger")
73
+ else:
74
+ for field, errors in form.errors.items():
75
+ for error in errors:
76
+ flash(error, "danger")
70
77
  return redirect(url_for("configuracion.index"))
71
-
72
- try:
73
- set_language_in_db(new_language)
74
-
75
- # Message will be shown in the new language after redirect
76
- language_names = {"en": "English", "es": "Español"}
77
- flash(
78
- _(
79
- "Idioma actualizado a %(language)s.",
80
- language=language_names[new_language],
81
- ),
82
- "success",
83
- )
84
- except Exception as e:
85
- flash(_("Error al actualizar el idioma: %(error)s", error=str(e)), "danger")
86
-
87
- return redirect(url_for("configuracion.index"))
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Constants for the vistas module."""
15
4
 
16
5
  # Number of items per page for pagination
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Currency CRUD routes."""
15
4
 
16
5
  from __future__ import annotations
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Custom employee field CRUD routes."""
15
4
 
16
5
  from __future__ import annotations
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Employee CRUD routes."""
15
4
 
16
5
  from __future__ import annotations
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Empresa (Company) views module."""
15
4
 
16
5
  from __future__ import annotations
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Exchange Rate CRUD routes."""
15
4
 
16
5
  from __future__ import annotations
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
 
15
4
  """Liquidaciones module views."""
16
5
 
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Payroll concepts CRUD routes: Percepciones, Deducciones, Prestaciones.
15
4
 
16
5
  This module provides a unified, reusable backend for managing payroll concepts
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Views for managing Planilla (master payroll) and its associations.
15
4
 
16
5
  A Planilla is the central hub that connects:
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Routes for managing planilla associations."""
15
4
 
16
5
  from datetime import date
@@ -40,6 +29,8 @@ ROUTE_CONFIG_DEDUCCIONES = "planilla.config_deducciones"
40
29
  ROUTE_CONFIG_PRESTACIONES = "planilla.config_prestaciones"
41
30
  ROUTE_CONFIG_REGLAS = "planilla.config_reglas"
42
31
  ERROR_NOT_FOUND = "no encontrada"
32
+ LITERAL_CONFIG_EMPLEADOS = "planilla.config_empleados"
33
+ LITERAL_CONFIG_DEDUCCIONES = "planilla.config_deducciones"
43
34
 
44
35
 
45
36
  @planilla_bp.route("/<planilla_id>/empleado/add", methods=["POST"])
@@ -79,7 +70,7 @@ def add_empleado(planilla_id: str):
79
70
  db.session.add(association)
80
71
  db.session.commit()
81
72
  flash(_("Empleado agregado exitosamente."), "success")
82
- return redirect(url_for("planilla.config_empleados", planilla_id=planilla_id))
73
+ return redirect(url_for(LITERAL_CONFIG_EMPLEADOS, planilla_id=planilla_id))
83
74
 
84
75
 
85
76
  @planilla_bp.route("/<planilla_id>/empleado/<association_id>/remove", methods=["POST"])
@@ -90,7 +81,7 @@ def remove_empleado(planilla_id: str, association_id: str):
90
81
  db.session.delete(association)
91
82
  db.session.commit()
92
83
  flash(_("Empleado removido exitosamente."), "success")
93
- return redirect(url_for("planilla.config_empleados", planilla_id=planilla_id))
84
+ return redirect(url_for(LITERAL_CONFIG_EMPLEADOS, planilla_id=planilla_id))
94
85
 
95
86
 
96
87
  @planilla_bp.route("/<planilla_id>/percepcion/add", methods=["POST"])
@@ -155,7 +146,7 @@ def remove_deduccion(planilla_id: str, association_id: str):
155
146
  db.session.delete(association)
156
147
  db.session.commit()
157
148
  flash(_("Deducción removida exitosamente."), "success")
158
- return redirect(url_for("planilla.config_deducciones", planilla_id=planilla_id))
149
+ return redirect(url_for(LITERAL_CONFIG_DEDUCCIONES, planilla_id=planilla_id))
159
150
 
160
151
 
161
152
  @planilla_bp.route("/<planilla_id>/deduccion/<association_id>/update-priority", methods=["POST"])
@@ -171,7 +162,7 @@ def update_deduccion_priority(planilla_id: str, association_id: str):
171
162
  db.session.commit()
172
163
  flash(_("Prioridad actualizada."), "success")
173
164
 
174
- return redirect(url_for("planilla.config_deducciones", planilla_id=planilla_id))
165
+ return redirect(url_for(LITERAL_CONFIG_DEDUCCIONES, planilla_id=planilla_id))
175
166
 
176
167
 
177
168
  @planilla_bp.route("/<planilla_id>/prestacion/add", methods=["POST"])
@@ -1,16 +1,5 @@
1
- # Copyright 2025 BMO Soluciones, S.A.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A.
14
3
  """Configuration routes for planilla associations."""
15
4
 
16
5
  from flask import render_template