-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by robinkeunen
- Loading branch information
Showing
19 changed files
with
1,892 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
================================= | ||
Resource Work Time From Contracts | ||
================================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-coopiteasy%2Faddons-lightgray.png?logo=github | ||
:target: https://github.com/coopiteasy/addons/tree/12.0/resource_work_time_from_contracts | ||
:alt: coopiteasy/addons | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
Take the contracts of an employee into account when computing work time per | ||
day. | ||
|
||
When this module is installed, the number of hours an employee is supposed to | ||
work is only computed from their contracts. Without contracts, the work time | ||
per day is 0, instead of using the default company’s working hours. | ||
|
||
The start and end dates of contracts are taken into account, but the status | ||
(state) of contracts are ignored. | ||
|
||
For this module to work properly, the company’s working hours should encompass | ||
all possible work days (including weekend days if there are contracts with | ||
weekend days), and each day should have working hours that correspond to the | ||
working hours used in all contracts. This is because the company’s working | ||
hours are used to compute leaves, and the number of hours per day is computed | ||
from it. | ||
|
||
For example, if the company working hours define 8 hours per day, from 8 to 12 | ||
and 13 to 17, all contracts’ working hours should be set from 8 to 12 and/or | ||
from 13 to 17 for the corresponding days. Half days are thus supported. | ||
|
||
If there are contracts with working hours that don’t match the company’s | ||
working hours, the number of days for leaves will be computed incorrectly. | ||
|
||
This module also makes the working hours (resource calendar) of an employee | ||
always equal to the company’s working hours, and hides its field on the | ||
employee form view. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/addons/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/coopiteasy/addons/issues/new?body=module:%20resource_work_time_from_contracts%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Coop IT Easy SC | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Coop IT Easy SC <https://coopiteasy.be>`_: | ||
|
||
* hugues de keyzer | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is part of the `coopiteasy/addons <https://github.com/coopiteasy/addons/tree/12.0/resource_work_time_from_contracts>`_ project on GitHub. | ||
|
||
You are welcome to contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2021 Coop IT Easy SC | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Resource Work Time From Contracts", | ||
"summary": ( | ||
"Take the contracts of an employee into account when computing work " | ||
"time per day" | ||
), | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Coop IT Easy SC", | ||
"website": "https://github.com/coopiteasy/addons", | ||
"category": "Human Resources", | ||
"depends": [ | ||
"hr_contract", | ||
], | ||
"data": [ | ||
"views/hr_employee.xml", | ||
"views/resource_resource.xml", | ||
], | ||
"demo": [], | ||
} |
54 changes: 54 additions & 0 deletions
54
resource_work_time_from_contracts/i18n/resource_work_time_from_contracts.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * resource_work_time_from_contracts | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.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: resource_work_time_from_contracts | ||
#: model:ir.model.fields,help:resource_work_time_from_contracts.field_hr_employee__resource_calendar_id | ||
#: model:ir.model.fields,help:resource_work_time_from_contracts.field_mrp_workcenter__resource_calendar_id | ||
#: model:ir.model.fields,help:resource_work_time_from_contracts.field_resource_calendar_leaves__calendar_id | ||
#: model:ir.model.fields,help:resource_work_time_from_contracts.field_resource_mixin__resource_calendar_id | ||
#: model:ir.model.fields,help:resource_work_time_from_contracts.field_resource_resource__calendar_id | ||
#: model:ir.model.fields,help:resource_work_time_from_contracts.field_resource_test__resource_calendar_id | ||
msgid "Define the schedule of resource" | ||
msgstr "" | ||
|
||
#. module: resource_work_time_from_contracts | ||
#: model:ir.model,name:resource_work_time_from_contracts.model_resource_calendar_leaves | ||
msgid "Resource Leaves Detail" | ||
msgstr "" | ||
|
||
#. module: resource_work_time_from_contracts | ||
#: model:ir.model,name:resource_work_time_from_contracts.model_resource_mixin | ||
msgid "Resource Mixin" | ||
msgstr "" | ||
|
||
#. module: resource_work_time_from_contracts | ||
#: model:ir.model,name:resource_work_time_from_contracts.model_resource_resource | ||
msgid "Resources" | ||
msgstr "" | ||
|
||
#. module: resource_work_time_from_contracts | ||
#: model:ir.model.fields,field_description:resource_work_time_from_contracts.field_hr_employee__resource_calendar_id | ||
#: model:ir.model.fields,field_description:resource_work_time_from_contracts.field_mrp_workcenter__resource_calendar_id | ||
#: model:ir.model.fields,field_description:resource_work_time_from_contracts.field_resource_calendar_leaves__calendar_id | ||
#: model:ir.model.fields,field_description:resource_work_time_from_contracts.field_resource_mixin__resource_calendar_id | ||
#: model:ir.model.fields,field_description:resource_work_time_from_contracts.field_resource_test__resource_calendar_id | ||
msgid "Working Hours" | ||
msgstr "" | ||
|
||
#. module: resource_work_time_from_contracts | ||
#: model:ir.model.fields,field_description:resource_work_time_from_contracts.field_resource_resource__calendar_id | ||
msgid "Working Time" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import resource_calendar_leaves | ||
from . import resource_mixin | ||
from . import resource_resource |
21 changes: 21 additions & 0 deletions
21
resource_work_time_from_contracts/models/resource_calendar_leaves.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2021 Coop IT Easy SC | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResourceCalendarLeaves(models.Model): | ||
|
||
_inherit = "resource.calendar.leaves" | ||
|
||
# force this field to be equal to the resource_calendar_id of the resource | ||
# (which should be equal to the one of the company). this ensures that all | ||
# leaves for all resources are defined in the same resource calendar, | ||
# which is needed to compute working hours while taking leaves into | ||
# account. | ||
calendar_id = fields.Many2one( | ||
"resource.calendar", | ||
related="resource_id.calendar_id", | ||
readonly=True, | ||
store=True, | ||
) |
Oops, something went wrong.