diff --git a/hr_contract_rate/README.rst b/hr_contract_rate/README.rst new file mode 100644 index 00000000000..de22f8d7f5b --- /dev/null +++ b/hr_contract_rate/README.rst @@ -0,0 +1,99 @@ +================ +HR Contract Rate +================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:633c9cebd405948bd6e70d276863b2046c939088fbb41a52061bd92a61e3da44 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github + :target: https://github.com/OCA/hr/tree/16.0/hr_contract_rate + :alt: OCA/hr +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_contract_rate + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to specify a contractual rate of Employee using various +time periods: + +* Hour +* Day +* Week +* Month +* Quarter +* Year + +It's possible to specify number of hours/days/weeks per month for wage +calculation for the contract. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Since hourly, daily, and weekly rates are not tranformable to monthly wage with +precision, ``wage`` is being set to zero in these cases. An extra ``approximate_wage`` +field is added to store approximately computed average monthly wage. It's also +important to review payroll calculation rules. + +This module is based on different approach than ``hr_contract_hourly_rate`` use. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* CorporateHub + +Contributors +~~~~~~~~~~~~ + +* `CorporateHub `__ + + * Alexey Pelykh + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/hr `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_contract_rate/__init__.py b/hr_contract_rate/__init__.py new file mode 100644 index 00000000000..eae2840ab05 --- /dev/null +++ b/hr_contract_rate/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models +from .hooks import pre_init_hook, post_init_hook diff --git a/hr_contract_rate/__manifest__.py b/hr_contract_rate/__manifest__.py new file mode 100644 index 00000000000..55d3289d6f7 --- /dev/null +++ b/hr_contract_rate/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# Copyright 2020 CorporateHub (https://corporatehub.eu) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "HR Contract Rate", + "version": "16.0.1.0.0", + "category": "Human Resources", + "website": "https://github.com/OCA/hr", + "author": "CorporateHub, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "application": False, + "summary": "Employee's contract rate and period", + "pre_init_hook": "pre_init_hook", + "post_init_hook": "post_init_hook", + "depends": ["hr_contract"], + "data": ["views/hr_contract.xml"], + "mantainers": ["nimarosa"], +} diff --git a/hr_contract_rate/hooks.py b/hr_contract_rate/hooks.py new file mode 100644 index 00000000000..40953c115d2 --- /dev/null +++ b/hr_contract_rate/hooks.py @@ -0,0 +1,30 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import SUPERUSER_ID, api + + +def pre_init_hook(cr): + cr.execute( + """ + ALTER TABLE hr_contract + ADD amount numeric; + COMMENT + ON COLUMN hr_contract.amount + IS 'Amount'; + ALTER TABLE hr_contract + ADD amount_period varchar; + COMMENT + ON COLUMN hr_contract.amount_period + IS 'Period of Amount'; + UPDATE hr_contract + SET amount = wage, amount_period = 'month'; + """ + ) + + +def post_init_hook(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + contracts = env["hr.contract"].search([]) + contracts._inverse_wage() + contracts._compute_wage() diff --git a/hr_contract_rate/i18n/es.po b/hr_contract_rate/i18n/es.po new file mode 100644 index 00000000000..a6c7659afe3 --- /dev/null +++ b/hr_contract_rate/i18n/es.po @@ -0,0 +1,148 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_contract_rate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-16 23:55+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Amount" +msgstr "Importe" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__day +msgid "Day" +msgstr "Día" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__display_name +msgid "Display Name" +msgstr "Nombre a Mostrar" + +#. module: hr_contract_rate +#: model:ir.model,name:hr_contract_rate.model_hr_contract +msgid "Employee Contract" +msgstr "Contrato de Empleado" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount +msgid "Employee's contract amount per period" +msgstr "Importe del contrato del trabajador por período" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Employee's monthly gross wage (approximate)" +msgstr "Salario bruto mensual del trabajador (aproximado)" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__wage +msgid "Employee's monthly gross wage." +msgstr "Salario bruto mensual del trabajador." + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__hour +msgid "Hour" +msgstr "Hora" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "How many work days there is in an average month" +msgstr "Cuántos días laborables hay en un mes medio" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "How many work hours there is in an average month" +msgstr "Cuántas horas de trabajo hay en un mes medio" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "How many work weeks there is in an average month" +msgstr "Cuántas semanas de trabajo hay en un mes medio" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__id +msgid "ID" +msgstr "ID" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__is_wage_accurate +msgid "Is Wage Accurate" +msgstr "El Salario es Exacto" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__month +msgid "Month" +msgstr "Mes" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of Amount" +msgstr "Período de Importe" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of employee's contract amount" +msgstr "Periodo de duración del contrato del empleado" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__quarter +msgid "Quarter" +msgstr "Trimestre" + +#. module: hr_contract_rate +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Salary and Advantages" +msgstr "Salario y Ventajas" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__wage +msgid "Wage" +msgstr "Salario" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Wage (approximate)" +msgstr "Salario (aproximado)" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__week +msgid "Week" +msgstr "Semana" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "Work days (per month)" +msgstr "Días laborables (por mes)" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "Work hours (per month)" +msgstr "Horas de trabajo (por mes)" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "Work weeks (per month)" +msgstr "Semanas de trabajo (por mes)" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__year +msgid "Year" +msgstr "Año" diff --git a/hr_contract_rate/i18n/es_AR.po b/hr_contract_rate/i18n/es_AR.po new file mode 100644 index 00000000000..86990f82401 --- /dev/null +++ b/hr_contract_rate/i18n/es_AR.po @@ -0,0 +1,148 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_contract_rate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-04-02 22:27+0000\n" +"Last-Translator: Nicolas Rodriguez Sande \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Amount" +msgstr "Importe" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__day +msgid "Day" +msgstr "Dia" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__display_name +msgid "Display Name" +msgstr "Nombre para mostrar" + +#. module: hr_contract_rate +#: model:ir.model,name:hr_contract_rate.model_hr_contract +msgid "Employee Contract" +msgstr "Contrato del Empleado" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount +msgid "Employee's contract amount per period" +msgstr "Importe del contrato por periodo" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Employee's monthly gross wage (approximate)" +msgstr "Sueldo Bruto (aproximado)" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__wage +msgid "Employee's monthly gross wage." +msgstr "Sueldo bruto." + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__hour +msgid "Hour" +msgstr "Hora" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "How many work days there is in an average month" +msgstr "Cuantos dias hay en un mes promedio" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "How many work hours there is in an average month" +msgstr "Horas en un mes promedio" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "How many work weeks there is in an average month" +msgstr "Semanas en un mes promedio" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__id +msgid "ID" +msgstr "ID" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__is_wage_accurate +msgid "Is Wage Accurate" +msgstr "Es importe fijo" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__month +msgid "Month" +msgstr "Mes" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of Amount" +msgstr "Periodo del importe" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of employee's contract amount" +msgstr "Importe del periodo" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__quarter +msgid "Quarter" +msgstr "Cuatrimestre" + +#. module: hr_contract_rate +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Salary and Advantages" +msgstr "Sueldo y Ventajas" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__wage +msgid "Wage" +msgstr "Sueldo" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Wage (approximate)" +msgstr "Sueldo (aproximado)" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__week +msgid "Week" +msgstr "Semana" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "Work days (per month)" +msgstr "Dias laborables (por mes)" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "Work hours (per month)" +msgstr "Horas laborables (por mes)" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "Work weeks (per month)" +msgstr "Semanas laborables (por mes)" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__year +msgid "Year" +msgstr "Año" diff --git a/hr_contract_rate/i18n/fr_FR.po b/hr_contract_rate/i18n/fr_FR.po new file mode 100644 index 00000000000..aebaf676efe --- /dev/null +++ b/hr_contract_rate/i18n/fr_FR.po @@ -0,0 +1,151 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_contract_rate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-19 15:46+0000\n" +"Last-Translator: Sandrine (ACSONE) \n" +"Language-Team: none\n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Amount" +msgstr "Salaire" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__day +msgid "Day" +msgstr "Jour" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__display_name +msgid "Display Name" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model,name:hr_contract_rate.model_hr_contract +msgid "Employee Contract" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount +msgid "Employee's contract amount per period" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Employee's monthly gross wage (approximate)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__wage +msgid "Employee's monthly gross wage." +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__hour +msgid "Hour" +msgstr "Heure" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "How many work days there is in an average month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "How many work hours there is in an average month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "How many work weeks there is in an average month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__id +msgid "ID" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__is_wage_accurate +msgid "Is Wage Accurate" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract____last_update +msgid "Last Modified on" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__month +msgid "Month" +msgstr "Mois" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of Amount" +msgstr "Périodicité" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of employee's contract amount" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__quarter +msgid "Quarter" +msgstr "Trimestre" + +#. module: hr_contract_rate +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Salary and Advantages" +msgstr "Salaire et avantages" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__wage +msgid "Wage" +msgstr "Salaire" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Wage (approximate)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__week +msgid "Week" +msgstr "Semaine" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "Work days (per month)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "Work hours (per month)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "Work weeks (per month)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__year +msgid "Year" +msgstr "Année" + +#~ msgid "Contract" +#~ msgstr "Contrat" diff --git a/hr_contract_rate/i18n/hr_contract_rate.pot b/hr_contract_rate/i18n/hr_contract_rate.pot new file mode 100644 index 00000000000..4ff7bc94b6c --- /dev/null +++ b/hr_contract_rate/i18n/hr_contract_rate.pot @@ -0,0 +1,145 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_contract_rate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Amount" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__day +msgid "Day" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__display_name +msgid "Display Name" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model,name:hr_contract_rate.model_hr_contract +msgid "Employee Contract" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount +msgid "Employee's contract amount per period" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Employee's monthly gross wage (approximate)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__wage +msgid "Employee's monthly gross wage." +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__hour +msgid "Hour" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "How many work days there is in an average month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "How many work hours there is in an average month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "How many work weeks there is in an average month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__id +msgid "ID" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__is_wage_accurate +msgid "Is Wage Accurate" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract____last_update +msgid "Last Modified on" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__month +msgid "Month" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of Amount" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of employee's contract amount" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__quarter +msgid "Quarter" +msgstr "" + +#. module: hr_contract_rate +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Salary and Advantages" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__wage +msgid "Wage" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Wage (approximate)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__week +msgid "Week" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "Work days (per month)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "Work hours (per month)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "Work weeks (per month)" +msgstr "" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__year +msgid "Year" +msgstr "" diff --git a/hr_contract_rate/i18n/it.po b/hr_contract_rate/i18n/it.po new file mode 100644 index 00000000000..d71280e3b90 --- /dev/null +++ b/hr_contract_rate/i18n/it.po @@ -0,0 +1,148 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_contract_rate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-05-30 09:09+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Amount" +msgstr "Valore" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__day +msgid "Day" +msgstr "Giorno" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: hr_contract_rate +#: model:ir.model,name:hr_contract_rate.model_hr_contract +msgid "Employee Contract" +msgstr "Contratto dipendente" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount +msgid "Employee's contract amount per period" +msgstr "Valore contratto dipendente per periodo" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Employee's monthly gross wage (approximate)" +msgstr "Retribuzione lorda mensile dipendente (approssimata)" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__wage +msgid "Employee's monthly gross wage." +msgstr "Retribuzione lorda mensile dipendente." + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__hour +msgid "Hour" +msgstr "Ora" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "How many work days there is in an average month" +msgstr "Numero medio di giorni lavorativi in un mese" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "How many work hours there is in an average month" +msgstr "Numero medio ore di lavoro in un mese" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "How many work weeks there is in an average month" +msgstr "Numero medio di settimane di lavoro in un mese" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__id +msgid "ID" +msgstr "ID" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__is_wage_accurate +msgid "Is Wage Accurate" +msgstr "La retribuzione è precisa" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__month +msgid "Month" +msgstr "Mese" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of Amount" +msgstr "Periodo del valore" + +#. module: hr_contract_rate +#: model:ir.model.fields,help:hr_contract_rate.field_hr_contract__amount_period +msgid "Period of employee's contract amount" +msgstr "Periodo del valore contratto dipendente" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__quarter +msgid "Quarter" +msgstr "Trimestre" + +#. module: hr_contract_rate +#: model_terms:ir.ui.view,arch_db:hr_contract_rate.hr_contract_view_form +msgid "Salary and Advantages" +msgstr "Stipendio e benefit" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__wage +msgid "Wage" +msgstr "Paga" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__approximate_wage +msgid "Wage (approximate)" +msgstr "Paga (approssimata)" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__week +msgid "Week" +msgstr "Settimana" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_days_per_month +msgid "Work days (per month)" +msgstr "Giorni lavorativi (per mese)" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_hours_per_month +msgid "Work hours (per month)" +msgstr "Ore lavorative (per mese)" + +#. module: hr_contract_rate +#: model:ir.model.fields,field_description:hr_contract_rate.field_hr_contract__work_weeks_per_month +msgid "Work weeks (per month)" +msgstr "Settimane lavorative (per mese)" + +#. module: hr_contract_rate +#: model:ir.model.fields.selection,name:hr_contract_rate.selection__hr_contract__amount_period__year +msgid "Year" +msgstr "Anno" diff --git a/hr_contract_rate/models/__init__.py b/hr_contract_rate/models/__init__.py new file mode 100644 index 00000000000..0824362dde5 --- /dev/null +++ b/hr_contract_rate/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import hr_contract diff --git a/hr_contract_rate/models/hr_contract.py b/hr_contract_rate/models/hr_contract.py new file mode 100644 index 00000000000..36ae909a585 --- /dev/null +++ b/hr_contract_rate/models/hr_contract.py @@ -0,0 +1,122 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class HrContract(models.Model): + _inherit = "hr.contract" + + wage = fields.Monetary( + compute="_compute_wage", + inverse="_inverse_wage", + store=True, + required=False, + ) + approximate_wage = fields.Monetary( + string="Wage (approximate)", + compute="_compute_wage", + store=True, + help="Employee's monthly gross wage (approximate)", + ) + is_wage_accurate = fields.Boolean( + compute="_compute_wage", + store=True, + ) + work_hours_per_month = fields.Float( + string="Work hours (per month)", + default=lambda self: self._default_work_hours_per_month(), + help="How many work hours there is in an average month", + ) + work_days_per_month = fields.Float( + string="Work days (per month)", + default=lambda self: self._default_work_days_per_month(), + help="How many work days there is in an average month", + ) + work_weeks_per_month = fields.Float( + string="Work weeks (per month)", + default=lambda self: self._default_work_weeks_per_month(), + help="How many work weeks there is in an average month", + ) + amount = fields.Monetary( + tracking=True, + help="Employee's contract amount per period", + ) + amount_period = fields.Selection( + string="Period of Amount", + selection=[ + ("hour", "Hour"), + ("day", "Day"), + ("week", "Week"), + ("month", "Month"), + ("quarter", "Quarter"), + ("year", "Year"), + ], + default="month", + tracking=True, + help="Period of employee's contract amount", + ) + + @api.model + def _default_work_hours_per_month(self): + """Hook for extensions""" + return 2080.0 / 12.0 + + @api.model + def _default_work_days_per_month(self): + """Hook for extensions""" + return self._default_work_hours_per_month() / 8.0 + + @api.model + def _default_work_weeks_per_month(self): + """Hook for extensions""" + return self._default_work_days_per_month() / 5.0 + + def _get_wage_from_amount(self): + """Hook for extensions""" + self.ensure_one() + if self.amount_period == "hour": + is_wage_accurate = False + wage = self.amount * self.work_hours_per_month + elif self.amount_period == "day": + is_wage_accurate = False + wage = self.amount * self.work_days_per_month + elif self.amount_period == "week": + is_wage_accurate = False + wage = self.amount * self.work_weeks_per_month + elif self.amount_period == "month": + is_wage_accurate = True + wage = self.amount + elif self.amount_period == "quarter": + is_wage_accurate = True + wage = self.amount / 3.0 + elif self.amount_period == "year": + is_wage_accurate = True + wage = self.amount / 12.0 + return wage, is_wage_accurate + + @api.depends( + "amount", + "amount_period", + "work_hours_per_month", + "work_days_per_month", + "work_weeks_per_month", + ) + def _compute_wage(self): + for contract in self: + wage, is_wage_accurate = contract._get_wage_from_amount() + contract.is_wage_accurate = is_wage_accurate + contract.approximate_wage = 0 if is_wage_accurate else wage + contract.wage = wage if is_wage_accurate else 0 + + def _inverse_wage(self): + if self.env.context.get("hr_contract_inverse_wage_skip"): + return + + # NOTE: In order to maintain compatibility with other tests also + # support setting monthly amount by setting wage directly. + for contract in self: + if contract.amount != contract.wage: + contract.amount = contract.wage + if contract.amount_period != "month": + contract.amount_period = "month" diff --git a/hr_contract_rate/readme/CONTRIBUTORS.rst b/hr_contract_rate/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..724bc1d03a2 --- /dev/null +++ b/hr_contract_rate/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `CorporateHub `__ + + * Alexey Pelykh diff --git a/hr_contract_rate/readme/DESCRIPTION.rst b/hr_contract_rate/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..5600a0ba5c6 --- /dev/null +++ b/hr_contract_rate/readme/DESCRIPTION.rst @@ -0,0 +1,12 @@ +This module allows to specify a contractual rate of Employee using various +time periods: + +* Hour +* Day +* Week +* Month +* Quarter +* Year + +It's possible to specify number of hours/days/weeks per month for wage +calculation for the contract. diff --git a/hr_contract_rate/readme/USAGE.rst b/hr_contract_rate/readme/USAGE.rst new file mode 100644 index 00000000000..f9f55492994 --- /dev/null +++ b/hr_contract_rate/readme/USAGE.rst @@ -0,0 +1,6 @@ +Since hourly, daily, and weekly rates are not tranformable to monthly wage with +precision, ``wage`` is being set to zero in these cases. An extra ``approximate_wage`` +field is added to store approximately computed average monthly wage. It's also +important to review payroll calculation rules. + +This module is based on different approach than ``hr_contract_hourly_rate`` use. diff --git a/hr_contract_rate/static/description/icon.png b/hr_contract_rate/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/hr_contract_rate/static/description/icon.png differ diff --git a/hr_contract_rate/static/description/index.html b/hr_contract_rate/static/description/index.html new file mode 100644 index 00000000000..1352f13811a --- /dev/null +++ b/hr_contract_rate/static/description/index.html @@ -0,0 +1,446 @@ + + + + + +HR Contract Rate + + + +
+

HR Contract Rate

+ + +

Beta License: AGPL-3 OCA/hr Translate me on Weblate Try me on Runboat

+

This module allows to specify a contractual rate of Employee using various +time periods:

+
    +
  • Hour
  • +
  • Day
  • +
  • Week
  • +
  • Month
  • +
  • Quarter
  • +
  • Year
  • +
+

It’s possible to specify number of hours/days/weeks per month for wage +calculation for the contract.

+

Table of contents

+ +
+

Usage

+

Since hourly, daily, and weekly rates are not tranformable to monthly wage with +precision, wage is being set to zero in these cases. An extra approximate_wage +field is added to store approximately computed average monthly wage. It’s also +important to review payroll calculation rules.

+

This module is based on different approach than hr_contract_hourly_rate use.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • CorporateHub
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/hr project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/hr_contract_rate/tests/__init__.py b/hr_contract_rate/tests/__init__.py new file mode 100644 index 00000000000..ae09e46231f --- /dev/null +++ b/hr_contract_rate/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import test_hr_contract_rate diff --git a/hr_contract_rate/tests/test_hr_contract_rate.py b/hr_contract_rate/tests/test_hr_contract_rate.py new file mode 100644 index 00000000000..bbc9fd3f367 --- /dev/null +++ b/hr_contract_rate/tests/test_hr_contract_rate.py @@ -0,0 +1,132 @@ +# Copyright 2020 Brainbean Apps (https://brainbeanapps.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields +from odoo.tests import common + + +class TestHrContractRate(common.TransactionCase): + def setUp(self): + super().setUp() + + self.today = fields.Date.today() + self.now = fields.Datetime.now() + self.HrEmployee = self.env["hr.employee"] + self.HrContract = self.env["hr.contract"] + + def test_compatibility(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "wage": 5000.0, + } + ) + + self.assertEqual(contract.amount, 5000.0) + self.assertEqual(contract.amount_period, "month") + + def test_hourly(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "amount": 50.0, + "amount_period": "hour", + } + ) + + self.assertEqual(contract.wage, 0.0) + self.assertEqual(contract.approximate_wage, 8666.67) + self.assertFalse(contract.is_wage_accurate) + + def test_daily(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "amount": 400.0, + "amount_period": "day", + } + ) + + self.assertEqual(contract.wage, 0.0) + self.assertEqual(contract.approximate_wage, 8666.67) + self.assertFalse(contract.is_wage_accurate) + + def test_weekly(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "amount": 2000.0, + "amount_period": "week", + } + ) + + self.assertEqual(contract.wage, 0.0) + self.assertEqual(contract.approximate_wage, 8666.67) + self.assertFalse(contract.is_wage_accurate) + + def test_monthly(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "amount": 5000.0, + "amount_period": "month", + } + ) + + self.assertEqual(contract.wage, 5000.0) + self.assertEqual(contract.approximate_wage, 0.0) + self.assertTrue(contract.is_wage_accurate) + + def test_quarterly(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "amount": 15000.0, + "amount_period": "quarter", + } + ) + + self.assertEqual(contract.wage, 5000.0) + self.assertEqual(contract.approximate_wage, 0.0) + self.assertTrue(contract.is_wage_accurate) + + def test_annual(self): + employee = self.HrEmployee.create({"name": "Employee"}) + contract = self.HrContract.create( + { + "name": "Contract", + "employee_id": employee.id, + "date_start": self.today, + "date_end": self.today, + "amount": 60000.0, + "amount_period": "year", + } + ) + + self.assertEqual(contract.wage, 5000.0) + self.assertEqual(contract.approximate_wage, 0.0) + self.assertTrue(contract.is_wage_accurate) diff --git a/hr_contract_rate/views/hr_contract.xml b/hr_contract_rate/views/hr_contract.xml new file mode 100644 index 00000000000..37f56d1391c --- /dev/null +++ b/hr_contract_rate/views/hr_contract.xml @@ -0,0 +1,34 @@ + + + + + hr.contract.view.form + hr.contract + + + + Salary and Advantages + + + + 1 + 1 + + + + + + 1 + + +
/
+ +
+
+
+
diff --git a/setup/hr_contract_rate/odoo/addons/hr_contract_rate b/setup/hr_contract_rate/odoo/addons/hr_contract_rate new file mode 120000 index 00000000000..3b68b2c550f --- /dev/null +++ b/setup/hr_contract_rate/odoo/addons/hr_contract_rate @@ -0,0 +1 @@ +../../../../hr_contract_rate \ No newline at end of file diff --git a/setup/hr_contract_rate/setup.py b/setup/hr_contract_rate/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/hr_contract_rate/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)