Skip to content

Commit

Permalink
Merge 24c2258 into 55c5d2d
Browse files Browse the repository at this point in the history
  • Loading branch information
yweng8111 committed Oct 7, 2019
2 parents 55c5d2d + 24c2258 commit de68f94
Show file tree
Hide file tree
Showing 10 changed files with 684 additions and 1 deletion.
66 changes: 66 additions & 0 deletions l10n_de_holidays/README.rst
@@ -0,0 +1,66 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

===============================================
Hr Holidays Public Generator DE
===============================================

This module extends the hr.holidays.public.generator model
and implements the functionality needed to generate and copy
the public holidays in Germany.


Usage
=====

Go to "Leaves/Public Holidays/Generate Public Holidays"
* Choose "Year" for which the public holidays will be generated
* Choose "Germany" in the "Country" dropdown
* "State" field
** Choose "State" if you want the holidays only for specific state
** Leave "State" empty if you want all public holidays

* "From Template" field

Choose "From Template". This will be used as template and all
holidays with field "Date may change" = False (static holidays),
will be copied. All floating holidays ("Date may change" = True ),
will be calculated for the relevant "Year"

* press "Generate" button


Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/hr/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Yu Weng <yweng@elegosoft.com>
* Nikolina Todorova <nikolina.todorova@initos.com>

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

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
1 change: 1 addition & 0 deletions l10n_de_holidays/__init__.py
@@ -0,0 +1 @@
from . import wizards
17 changes: 17 additions & 0 deletions l10n_de_holidays/__manifest__.py
@@ -0,0 +1,17 @@
# Copyright 2018 elego Software Solutions GmbH - Yu Weng
# Copyright 2018 initOS GmbH - Nikolina Todorova
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": 'Holidays for Germany',
"version": '11.0.1.0.0',
"license": "AGPL-3",
"category": "Human Resources",
"website": "https://github.com/OCA/l10n-germany",
"depends": [
"hr_holidays_public",
"l10n_de_country_states",
],
"installable": True,
"auto_install": False,
}
130 changes: 130 additions & 0 deletions l10n_de_holidays/i18n/de.po
@@ -0,0 +1,130 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_de_holidays
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-07 09:48+0000\n"
"PO-Revision-Date: 2018-09-07 09:48+0000\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: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:171
#, python-format
msgid "All Saints' Day"
msgstr "Allerheiligen"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:68
#, python-format
msgid "Ascension Day"
msgstr "Christi Himmelfahrt"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:142
#, python-format
msgid "Assumption Day"
msgstr "Mariä Himmelfahrt"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:117
#, python-format
msgid "Boxing Day"
msgstr "2. Weihnachtsfeiertag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:113
#, python-format
msgid "Christmas Day"
msgstr "1. Weihnachtsfeiertag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:92
#, python-format
msgid "Corpus Christi"
msgstr "Fronleichnam"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:109
#, python-format
msgid "Day of German Unity"
msgstr "Tag der Deutschen Einheit"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:159
#, python-format
msgid "Day of Reformation"
msgstr "Reformationstag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:64
#, python-format
msgid "Easter Monday"
msgstr "Ostermontag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:59
#, python-format
msgid "Easter Sunday"
msgstr "Ostersonntag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:55
#, python-format
msgid "Good Friday"
msgstr "Karfreitag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:105
#, python-format
msgid "International Workers' Day"
msgstr "Tag der Arbeit"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:101
#, python-format
msgid "New Years's Day"
msgstr "Neujahr"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:179
#, python-format
msgid "Repentance Day"
msgstr "Buß- und Bettag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:132
#, python-format
msgid "Three Kings Day"
msgstr "Heilige Drei Könige"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:218
#, python-format
msgid "Warning"
msgstr "Warnung"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:73
#, python-format
msgid "Whit Monday"
msgstr "Pfingstmontag"

#. module: l10n_de_holidays
#: code:addons/l10n_de_holidays/wizard/hr_holidays_public_generator_de.py:218
#, python-format
msgid "You cannot copy the holidays to the same year."
msgstr "Sie können die Feiertage nicht für dasselbe Jahr kopieren."

#. module: l10n_de_holidays
#: model:ir.model,name:l10n_de_holidays.model_hr_holidays_public_generator
msgid "hr.holidays.public.generator"
msgstr "hr.holidays.public.generator"

5 changes: 5 additions & 0 deletions l10n_de_holidays/tests/__init__.py
@@ -0,0 +1,5 @@
# Copyright 2018 elego Software Solutions GmbH - Yu Weng
# Copyright 2018 initOS GmbH - Nikolina Todorova
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_hr_holidays_public_generator
28 changes: 28 additions & 0 deletions l10n_de_holidays/tests/common.py
@@ -0,0 +1,28 @@
# Copyright 2018 elego Software Solutions GmbH - Yu Weng
# Copyright 2018 initOS GmbH - Nikolina Todorova
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import common


class TestHrHolidaysPublicGenerator(common.TransactionCase):

def setUp(self):
super(TestHrHolidaysPublicGenerator, self).setUp()

# Usefull models
self.HrHolidaysPublicGenerator = \
self.env['hr.holidays.public.generator']
self.HrHolidaysPublicLine = self.env['hr.holidays.public.line']
self.HrHolidaysPublic = self.env['hr.holidays.public']
self.TestYear = 2018
self.CountryId = self.ref('base.de')

# Test Create Public Holidays for 2018
wizard_data = {
"year": self.TestYear,
"country_id": self.CountryId
}

self.hr_holidays_public_generator = \
self.HrHolidaysPublicGenerator.create(wizard_data)
121 changes: 121 additions & 0 deletions l10n_de_holidays/tests/test_hr_holidays_public_generator.py
@@ -0,0 +1,121 @@
# Copyright 2018 elego Software Solutions GmbH - Yu Weng
# Copyright 2018 initOS GmbH - Nikolina Todorova
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.l10n_de_holidays.tests.common import \
TestHrHolidaysPublicGenerator
from odoo.exceptions import UserError


class TestHrHolidaysPublicGenerator(TestHrHolidaysPublicGenerator):

def test_action_generate_de_holidays(self):
self.hr_holidays_public_generator.action_run()

hr_holiday_public = \
self.HrHolidaysPublic.search([
('year', '=', self.TestYear),
('country_id', '=', self.CountryId)
])
if not hr_holiday_public:
hr_holiday_public = None

self.assertIsNotNone(hr_holiday_public)

if hr_holiday_public:
line_ids = hr_holiday_public.line_ids
if not line_ids:
line_ids = None
self.assertIsNotNone(line_ids)

def test_action_copy_de_holidays(self):
self.hr_holidays_public_generator.action_generate_de_holidays()
template_id = \
self.HrHolidaysPublic.search([
('year', '=', self.TestYear),
('country_id', '=', self.CountryId)
])[0].id

# Test Create Public Holidays for 2019 from 2019
TestYear = 2019
wizard_data = {
"year": TestYear,
"country_id": self.CountryId,
"template_id": template_id
}

hr_holidays_public_generator_copy = \
self.HrHolidaysPublicGenerator.create(wizard_data)

hr_holidays_public_generator_copy.action_run()

hr_holiday_public = \
self.HrHolidaysPublic.search([
('year', '=', TestYear),
('country_id', '=', self.CountryId)
])
if not hr_holiday_public:
hr_holiday_public = None

self.assertIsNotNone(hr_holiday_public)

if hr_holiday_public:
line_ids = hr_holiday_public.line_ids
if not line_ids:
line_ids = None
self.assertIsNotNone(line_ids)

def test_copy_function_name_does_not_exists(self):
self.hr_holidays_public_generator.action_generate_de_holidays()
template_id = \
self.HrHolidaysPublic.search([
('year', '=', self.TestYear),
('country_id', '=', self.CountryId)
])[0].id

# Test Create Public Holidays for 2019 from 2019
# with not existing function for the CountryId
CountryId = self.ref('base.fr')
TestYear = 2019
wizard_data = {
"year": TestYear,
"country_id": CountryId,
"template_id": template_id
}
hr_holidays_public_generator_copy = \
self.HrHolidaysPublicGenerator.create(wizard_data)

with self.assertRaises(UserError):
hr_holidays_public_generator_copy.action_run()

def test_generate_function_name_does_not_exists(self):
# Test Generate Public Holidays for 2018
# with not existing function for the CountryId
CountryId = self.ref('base.fr')
wizard_data = {
"year": self.TestYear,
"country_id": CountryId
}
hr_holidays_public_generator_generate = \
self.HrHolidaysPublicGenerator.create(wizard_data)

with self.assertRaises(UserError):
hr_holidays_public_generator_generate.action_run()

def test_copy_to_same_year_error(self):
self.hr_holidays_public_generator.action_generate_de_holidays()
template_id = \
self.HrHolidaysPublic.search([
('year', '=', self.TestYear),
('country_id', '=', self.CountryId)
])[0].id
wizard_data = {
"year": self.TestYear,
"country_id": self.CountryId,
"template_id": template_id
}
hr_holidays_public_generator_copy = \
self.HrHolidaysPublicGenerator.create(wizard_data)

with self.assertRaises(UserError):
hr_holidays_public_generator_copy.action_run()
1 change: 1 addition & 0 deletions l10n_de_holidays/wizards/__init__.py
@@ -0,0 +1 @@
from . import hr_holidays_public_generator_de

0 comments on commit de68f94

Please sign in to comment.