From c0296ab2a89954786fa907eaf2b4b00bc4c914b5 Mon Sep 17 00:00:00 2001
From: Leszek Manicki
Date: Mon, 6 May 2019 11:40:59 +0200
Subject: [PATCH] Initial commit
---
COPYING | 661 ++++++
itis_hr_attendance_extend/__init__.py | 22 +
itis_hr_attendance_extend/__openerp__.py | 45 +
itis_hr_attendance_extend/data/cron.xml | 80 +
itis_hr_attendance_extend/data/data.xml | 28 +
itis_hr_attendance_extend/i18n/de.po | 624 +++++
itis_hr_attendance_extend/i18n/en_US.po | 530 +++++
itis_hr_attendance_extend/models/__init__.py | 25 +
.../models/hr_attendance.py | 200 ++
.../models/hr_holiday.py | 177 ++
.../models/hr_payroll.py | 104 +
.../models/hr_timesheet_sheet.py | 466 ++++
.../models/itis_holiday.py | 115 +
itis_hr_attendance_extend/security/groups.xml | 10 +
.../security/ir.model.access.csv | 7 +
.../static/src/css/traffic_light.css | 59 +
.../static/src/js/hr_extend.js | 261 +++
.../static/src/xml/templates.xml | 116 +
itis_hr_attendance_extend/tests/__init__.py | 1 +
.../tests/test_hr_attendance_extend.py | 21 +
.../views/hr_holiday_view.xml | 21 +
.../views/hr_timesheet_sheet_view.xml | 519 +++++
.../views/itis_holiday_view.xml | 50 +
itis_hr_attendance_extend/views/templates.xml | 13 +
itis_hr_attendance_extend/wizard/__init__.py | 22 +
.../wizard/hr_timesheet_overview_export.py | 104 +
.../wizard/hr_timesheet_overview_export.xml | 44 +
.../wizard/sign_in_task.py | 60 +
.../wizard/sign_in_task_view.xml | 25 +
itis_hr_extend/__init__.py | 22 +
itis_hr_extend/__openerp__.py | 53 +
itis_hr_extend/data/cron.xml | 68 +
itis_hr_extend/data/data.xml | 126 +
itis_hr_extend/i18n/de.po | 2024 +++++++++++++++++
itis_hr_extend/i18n/en_US.po | 2023 ++++++++++++++++
itis_hr_extend/models/__init__.py | 28 +
itis_hr_extend/models/employee_meeting.py | 44 +
.../models/employee_payroll_report.py | 77 +
itis_hr_extend/models/employee_report.py | 70 +
itis_hr_extend/models/fte_report.py | 52 +
itis_hr_extend/models/hr_employee.py | 1157 ++++++++++
itis_hr_extend/models/hr_holiday.py | 662 ++++++
itis_hr_extend/models/hr_leave.py | 406 ++++
itis_hr_extend/models/mail_message.py | 27 +
itis_hr_extend/security/groups.xml | 28 +
itis_hr_extend/security/ir.model.access.csv | 32 +
itis_hr_extend/static/data.xml | 59 +
.../views/employee_meeting_view.xml | 52 +
.../views/employee_payroll_report_view.xml | 41 +
itis_hr_extend/views/employee_report_view.xml | 39 +
itis_hr_extend/views/fte_report_view.xml | 81 +
itis_hr_extend/views/hr_employee_view.xml | 782 +++++++
itis_hr_extend/views/hr_holiday_view.xml | 96 +
itis_hr_extend/wizard/__init__.py | 26 +
itis_hr_extend/wizard/emp_data_wizard.py | 167 ++
.../wizard/emp_data_wizard_view.xml | 49 +
itis_hr_extend/wizard/emp_payroll_wizard.py | 327 +++
.../wizard/emp_payroll_wizard_view.xml | 83 +
itis_hr_extend/wizard/fte_wizard.py | 108 +
itis_hr_extend/wizard/fte_wizard_view.xml | 35 +
itis_hr_extend/wizard/ot_change.py | 101 +
itis_hr_extend/wizard/ot_change_view.xml | 45 +
itis_hr_leave_extend/__init__.py | 22 +
itis_hr_leave_extend/__openerp__.py | 37 +
itis_hr_leave_extend/i18n/de.po | 208 ++
itis_hr_leave_extend/i18n/en_US.po | 835 +++++++
itis_hr_leave_extend/models/__init__.py | 21 +
itis_hr_leave_extend/models/hr_holiday.py | 333 +++
.../security/ir.model.access.csv | 3 +
itis_hr_leave_extend/tests/__init__.py | 1 +
.../tests/test_hr_leave_extend.py | 168 ++
.../views/hr_setting_view.xml | 30 +
itis_hr_leave_extend/wizard/__init__.py | 22 +
itis_hr_leave_extend/wizard/hr_setting.py | 55 +
itis_hr_leave_extend/wizard/hr_sick_leave.py | 278 +++
itis_hr_leave_extend/wizard/hr_sick_leave.xml | 45 +
itis_hr_notifications/__init__.py | 3 +
itis_hr_notifications/__openerp__.py | 26 +
.../data/email_templates.xml | 112 +
itis_hr_notifications/data/ir_cron.xml | 55 +
itis_hr_notifications/hr_view.xml | 59 +
itis_hr_notifications/i18n/de.po | 328 +++
itis_hr_notifications/i18n/en_US.po | 332 +++
itis_hr_notifications/models.py | 324 +++
.../security/ir.model.access.csv | 2 +
itis_ldap_config/__init__.py | 21 +
itis_ldap_config/__openerp__.py | 38 +
itis_ldap_config/data/cron.xml | 16 +
itis_ldap_config/i18n/de.po | 80 +
itis_ldap_config/models/__init__.py | 24 +
itis_ldap_config/models/hr_timesheet.py | 19 +
itis_ldap_config/models/ldap_record.py | 103 +
itis_ldap_config/models/res_users.py | 17 +
itis_ldap_config/security/ir.model.access.csv | 2 +
itis_ldap_config/views/ldap_view.xml | 29 +
itis_payroll_export/__init__.py | 21 +
itis_payroll_export/__openerp__.py | 27 +
itis_payroll_export/hr_setting.py | 53 +
itis_payroll_export/hr_setting_view.xml | 25 +
itis_payroll_export/i18n/de.po | 100 +
itis_payroll_export/i18n/en_US.po | 111 +
.../security/ir.model.access.csv | 2 +
itis_payroll_export/wizard/__init__.py | 21 +
itis_payroll_export/wizard/__init__.pyc | Bin 0 -> 269 bytes
itis_payroll_export/wizard/payroll_export.py | 116 +
itis_payroll_export/wizard/payroll_export.pyc | Bin 0 -> 4429 bytes
itis_payroll_export/wizard/payroll_export.xml | 46 +
107 files changed, 17570 insertions(+)
create mode 100644 COPYING
create mode 100644 itis_hr_attendance_extend/__init__.py
create mode 100644 itis_hr_attendance_extend/__openerp__.py
create mode 100644 itis_hr_attendance_extend/data/cron.xml
create mode 100644 itis_hr_attendance_extend/data/data.xml
create mode 100644 itis_hr_attendance_extend/i18n/de.po
create mode 100644 itis_hr_attendance_extend/i18n/en_US.po
create mode 100644 itis_hr_attendance_extend/models/__init__.py
create mode 100644 itis_hr_attendance_extend/models/hr_attendance.py
create mode 100644 itis_hr_attendance_extend/models/hr_holiday.py
create mode 100644 itis_hr_attendance_extend/models/hr_payroll.py
create mode 100644 itis_hr_attendance_extend/models/hr_timesheet_sheet.py
create mode 100644 itis_hr_attendance_extend/models/itis_holiday.py
create mode 100644 itis_hr_attendance_extend/security/groups.xml
create mode 100644 itis_hr_attendance_extend/security/ir.model.access.csv
create mode 100644 itis_hr_attendance_extend/static/src/css/traffic_light.css
create mode 100644 itis_hr_attendance_extend/static/src/js/hr_extend.js
create mode 100644 itis_hr_attendance_extend/static/src/xml/templates.xml
create mode 100644 itis_hr_attendance_extend/tests/__init__.py
create mode 100644 itis_hr_attendance_extend/tests/test_hr_attendance_extend.py
create mode 100644 itis_hr_attendance_extend/views/hr_holiday_view.xml
create mode 100644 itis_hr_attendance_extend/views/hr_timesheet_sheet_view.xml
create mode 100644 itis_hr_attendance_extend/views/itis_holiday_view.xml
create mode 100644 itis_hr_attendance_extend/views/templates.xml
create mode 100644 itis_hr_attendance_extend/wizard/__init__.py
create mode 100644 itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.py
create mode 100644 itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.xml
create mode 100644 itis_hr_attendance_extend/wizard/sign_in_task.py
create mode 100644 itis_hr_attendance_extend/wizard/sign_in_task_view.xml
create mode 100644 itis_hr_extend/__init__.py
create mode 100644 itis_hr_extend/__openerp__.py
create mode 100644 itis_hr_extend/data/cron.xml
create mode 100755 itis_hr_extend/data/data.xml
create mode 100644 itis_hr_extend/i18n/de.po
create mode 100644 itis_hr_extend/i18n/en_US.po
create mode 100644 itis_hr_extend/models/__init__.py
create mode 100644 itis_hr_extend/models/employee_meeting.py
create mode 100644 itis_hr_extend/models/employee_payroll_report.py
create mode 100644 itis_hr_extend/models/employee_report.py
create mode 100644 itis_hr_extend/models/fte_report.py
create mode 100644 itis_hr_extend/models/hr_employee.py
create mode 100644 itis_hr_extend/models/hr_holiday.py
create mode 100644 itis_hr_extend/models/hr_leave.py
create mode 100644 itis_hr_extend/models/mail_message.py
create mode 100644 itis_hr_extend/security/groups.xml
create mode 100644 itis_hr_extend/security/ir.model.access.csv
create mode 100644 itis_hr_extend/static/data.xml
create mode 100644 itis_hr_extend/views/employee_meeting_view.xml
create mode 100644 itis_hr_extend/views/employee_payroll_report_view.xml
create mode 100644 itis_hr_extend/views/employee_report_view.xml
create mode 100644 itis_hr_extend/views/fte_report_view.xml
create mode 100644 itis_hr_extend/views/hr_employee_view.xml
create mode 100644 itis_hr_extend/views/hr_holiday_view.xml
create mode 100644 itis_hr_extend/wizard/__init__.py
create mode 100755 itis_hr_extend/wizard/emp_data_wizard.py
create mode 100755 itis_hr_extend/wizard/emp_data_wizard_view.xml
create mode 100644 itis_hr_extend/wizard/emp_payroll_wizard.py
create mode 100644 itis_hr_extend/wizard/emp_payroll_wizard_view.xml
create mode 100644 itis_hr_extend/wizard/fte_wizard.py
create mode 100644 itis_hr_extend/wizard/fte_wizard_view.xml
create mode 100644 itis_hr_extend/wizard/ot_change.py
create mode 100644 itis_hr_extend/wizard/ot_change_view.xml
create mode 100644 itis_hr_leave_extend/__init__.py
create mode 100644 itis_hr_leave_extend/__openerp__.py
create mode 100644 itis_hr_leave_extend/i18n/de.po
create mode 100644 itis_hr_leave_extend/i18n/en_US.po
create mode 100644 itis_hr_leave_extend/models/__init__.py
create mode 100644 itis_hr_leave_extend/models/hr_holiday.py
create mode 100644 itis_hr_leave_extend/security/ir.model.access.csv
create mode 100644 itis_hr_leave_extend/tests/__init__.py
create mode 100644 itis_hr_leave_extend/tests/test_hr_leave_extend.py
create mode 100644 itis_hr_leave_extend/views/hr_setting_view.xml
create mode 100644 itis_hr_leave_extend/wizard/__init__.py
create mode 100644 itis_hr_leave_extend/wizard/hr_setting.py
create mode 100644 itis_hr_leave_extend/wizard/hr_sick_leave.py
create mode 100644 itis_hr_leave_extend/wizard/hr_sick_leave.xml
create mode 100644 itis_hr_notifications/__init__.py
create mode 100644 itis_hr_notifications/__openerp__.py
create mode 100644 itis_hr_notifications/data/email_templates.xml
create mode 100644 itis_hr_notifications/data/ir_cron.xml
create mode 100644 itis_hr_notifications/hr_view.xml
create mode 100644 itis_hr_notifications/i18n/de.po
create mode 100644 itis_hr_notifications/i18n/en_US.po
create mode 100644 itis_hr_notifications/models.py
create mode 100644 itis_hr_notifications/security/ir.model.access.csv
create mode 100644 itis_ldap_config/__init__.py
create mode 100644 itis_ldap_config/__openerp__.py
create mode 100644 itis_ldap_config/data/cron.xml
create mode 100644 itis_ldap_config/i18n/de.po
create mode 100644 itis_ldap_config/models/__init__.py
create mode 100644 itis_ldap_config/models/hr_timesheet.py
create mode 100644 itis_ldap_config/models/ldap_record.py
create mode 100644 itis_ldap_config/models/res_users.py
create mode 100644 itis_ldap_config/security/ir.model.access.csv
create mode 100644 itis_ldap_config/views/ldap_view.xml
create mode 100644 itis_payroll_export/__init__.py
create mode 100644 itis_payroll_export/__openerp__.py
create mode 100644 itis_payroll_export/hr_setting.py
create mode 100644 itis_payroll_export/hr_setting_view.xml
create mode 100644 itis_payroll_export/i18n/de.po
create mode 100644 itis_payroll_export/i18n/en_US.po
create mode 100644 itis_payroll_export/security/ir.model.access.csv
create mode 100644 itis_payroll_export/wizard/__init__.py
create mode 100644 itis_payroll_export/wizard/__init__.pyc
create mode 100644 itis_payroll_export/wizard/payroll_export.py
create mode 100644 itis_payroll_export/wizard/payroll_export.pyc
create mode 100644 itis_payroll_export/wizard/payroll_export.xml
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..be3f7b2
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/itis_hr_attendance_extend/__init__.py b/itis_hr_attendance_extend/__init__.py
new file mode 100644
index 0000000..7433469
--- /dev/null
+++ b/itis_hr_attendance_extend/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import wizard
+from . import models
diff --git a/itis_hr_attendance_extend/__openerp__.py b/itis_hr_attendance_extend/__openerp__.py
new file mode 100644
index 0000000..d8e9a70
--- /dev/null
+++ b/itis_hr_attendance_extend/__openerp__.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+{
+ 'name': "ITIS HR Attendance Extend",
+ 'summary': """ Module will extend HR Attendance""",
+ 'description': """
+ Module to extend HR Attendance
+ """,
+ 'author': "IT IS AG",
+ 'website': "http://www.itis-odoo.de",
+ 'category': 'base',
+ 'version': '1.0.55.0',
+ 'depends': ['hr_attendance', 'hr_timesheet', 'hr_timesheet_sheet'],
+ 'data': [
+ 'security/groups.xml',
+ 'views/hr_timesheet_sheet_view.xml',
+ 'views/itis_holiday_view.xml',
+ 'views/templates.xml',
+ 'views/hr_holiday_view.xml',
+ 'wizard/sign_in_task_view.xml',
+ 'wizard/hr_timesheet_overview_export.xml',
+ 'security/ir.model.access.csv',
+ 'data/cron.xml',
+ 'data/data.xml',
+ ],
+ 'qweb': ['static/src/xml/templates.xml'],
+ 'css': [],
+ 'demo': [],
diff --git a/itis_hr_attendance_extend/data/cron.xml b/itis_hr_attendance_extend/data/cron.xml
new file mode 100644
index 0000000..62f55f5
--- /dev/null
+++ b/itis_hr_attendance_extend/data/cron.xml
@@ -0,0 +1,80 @@
+
+
+
+ ITIS Timesheets Monat abschließen
+ close_timesheet
+ months
+ 1
+
+
+ -1
+ hr_timesheet_sheet.sheet
+
+
+
+
+ ITIS Setting Cost Center for Existing Records
+ set_cost_center_existing_rec
+ days
+ 1
+
+
+ -1
+ hr.analytic.timesheet
+
+
+
+
+ ITIS Get Monthly Timesheet Overview
+ get_monthly_timesheet_overview
+ months
+ 1
+
+
+ -1
+ hr.analytic.timesheet
+
+
+
+
+
+ ITIS Create Daily Timesheet
+ create_daily_timesheet
+ days
+ 1
+
+
+ -1
+ hr_timesheet_sheet.sheet
+
+
+
+
+
+ ITIS Create Missing Date Timesheet
+ create_missingdate_timesheet
+ months
+ 1
+
+
+ -1
+ hr_timesheet_sheet.sheet
+
+
+
+
+
+ ITIS Employee Sign Out
+ automatic_sign_out
+ days
+ 1
+
+
+ -1
+ hr_timesheet_sheet.sheet
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_attendance_extend/data/data.xml b/itis_hr_attendance_extend/data/data.xml
new file mode 100644
index 0000000..dc38994
--- /dev/null
+++ b/itis_hr_attendance_extend/data/data.xml
@@ -0,0 +1,28 @@
+
+
+
+ Holiday
+ True
+ True
+
+
+
+ Monthly Timesheet Overview
+
+
+ ${(user.email or '') | safe}
+ ${(user.email or '') | safe}
+ Monthly Timesheet Overview Report
+ Sehr geehrte Kollegen,
+
+
anbei erhalten Sie den aktuellen Report zur Kostenstellenübersicht nach Mitarbeiter.
+
+
Mit freundlichen Grüßen
+
Ihr HR-Team
+ ]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_attendance_extend/i18n/de.po b/itis_hr_attendance_extend/i18n/de.po
new file mode 100644
index 0000000..d9f2b4f
--- /dev/null
+++ b/itis_hr_attendance_extend/i18n/de.po
@@ -0,0 +1,624 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * itis_hr_attendance_extend
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-09-19 13:19+0000\n"
+"PO-Revision-Date: 2017-09-19 15:22+0100\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: itis_hr_attendance_extend
+#: model:email.template,body_html:itis_hr_attendance_extend.email_template_monthly_timesheet_overview
+msgid ""
+"\n"
+"\t\t\t
Sehr geehrte Kollegen,
\n"
+"\t\t\t \n"
+"\t\t\t
anbei erhalten Sie den aktuellen Report zur Kostenstellenübersicht "
+"nach Mitarbeiter.\n"
+"\t\t\t
+
+
+
+
+
+
+
+
+
+
+ hr.analytic.timesheet.tree.itis
+ hr.analytic.timesheet
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr.timesheet.sheet.tree.simplified.itis
+ hr_timesheet_sheet.sheet
+
+
+
+
+
+ false
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ hr_timesheet_sheet.sheet.filter,inherit
+ hr_timesheet_sheet.sheet
+
+
+
+
+
+
+ [('date_from', '>=',self)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr.timesheet.sheet.form.editable.itis.new
+ hr_timesheet_sheet.sheet
+
+
+
+
+
+
+ Create Timesheet
+ ir.actions.act_window
+ hr_timesheet_sheet.sheet
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
+
+ form
+
+
+
+
+
+
+
+
+ account.analytic.account.invoice.form.inherit.itis
+ account.analytic.account
+
+
+
+
+
+
+
+
+
+
+
+
+ timesheet.activity.overview.tree
+ hr.analytic.timesheet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr.analytic.timesheet.overview.search
+ hr.analytic.timesheet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Timesheet Activities Overview
+ ir.actions.act_window
+ hr.analytic.timesheet
+ form
+ tree
+ {"search_default_today":1}
+
+
+
+
+
+
+
+
+
+ timesheet.activity.overview.tree.manager
+ hr.analytic.timesheet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ code
+ ir.actions.server
+
+ action = model.open_analytic_timesheet_tree()
+ True
+ Timesheet Activities Manager
+
+
+
+
+
+
+
+ emp.service.description.form
+ service.description
+
+
+
+
+
+
+ emp.service.description.tree
+ service.description
+
+
+
+
+
+
+
+
+ Employee Service Description
+ ir.actions.act_window
+ service.description
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/itis_hr_attendance_extend/views/itis_holiday_view.xml b/itis_hr_attendance_extend/views/itis_holiday_view.xml
new file mode 100644
index 0000000..8aee9d5
--- /dev/null
+++ b/itis_hr_attendance_extend/views/itis_holiday_view.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+ itis_holiday_form_view
+ itis.holiday
+
+
+
+
+
+ itis_holiday_tree_view
+ itis.holiday
+
+
+
+
+
+
+
+
+ Holiday
+ itis.holiday
+
+
+
+
+
+
+
+ Holidays
+ ir.actions.act_window
+ itis.holiday
+ form
+ calendar,tree,form
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_attendance_extend/views/templates.xml b/itis_hr_attendance_extend/views/templates.xml
new file mode 100644
index 0000000..33e1c6d
--- /dev/null
+++ b/itis_hr_attendance_extend/views/templates.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/itis_hr_attendance_extend/wizard/__init__.py b/itis_hr_attendance_extend/wizard/__init__.py
new file mode 100644
index 0000000..7a5b865
--- /dev/null
+++ b/itis_hr_attendance_extend/wizard/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import sign_in_task
+from . import hr_timesheet_overview_export
diff --git a/itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.py b/itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.py
new file mode 100644
index 0000000..4c6db9c
--- /dev/null
+++ b/itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.py
@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+
+from openerp import models, fields, api, _
+from openerp.exceptions import Warning
+import csv
+from datetime import datetime
+import base64
+import os
+
+class timesheet_overview_export(models.TransientModel):
+
+ _name = 'timesheet.overview.export'
+
+ name = fields.Binary('Timesheet CSV')
+ file_name = fields.Char('File')
+
+ def export_csv_subfunction(self,analytic_timesheet_records,active_domain):
+ data_list = []
+ csv_header = ['Personalnummer','Mitarbeitername', "Mitarbeiter Vorname",'Dept. Cost Center','Cost Center', "Dauer(metrisch)",'Description']
+ time_csv = datetime.now().strftime('%Y-%m-%d_%H%M%S') + '.csv'
+ csv_path = "/tmp/" + time_csv
+ for timesheet_overview_brw in analytic_timesheet_records:
+ emp_name, emp_first_name,emp_personal_no = '','',''
+ if timesheet_overview_brw.sheet_id:
+ emp_name = timesheet_overview_brw.sheet_id.employee_id.second_name
+ emp_first_name = timesheet_overview_brw.sheet_id.employee_id.surname
+ emp_personal_no = timesheet_overview_brw.sheet_id.employee_id.identification_id
+ vals = {
+ 'Personalnummer': (emp_personal_no or '').encode('utf-8'),
+ 'Dept. Cost Center': (timesheet_overview_brw.dept_account_id.account_code or '').encode('utf-8'),
+ 'Description': (timesheet_overview_brw.emp_comment or '').encode('utf-8'),
+ "Cost Center": (timesheet_overview_brw.account_id.account_code or '').encode('utf-8'),
+ 'Mitarbeitername': (emp_name or '').encode('utf-8'),
+ 'Mitarbeiter Vorname': (emp_first_name or '').encode('utf-8'),
+ 'Dauer(metrisch)': ("%.2f" % timesheet_overview_brw.unit_amount).replace('.',':'),
+ # 'Dauer(metrisch)': timesheet_overview_brw.unit_amount,
+ }
+ data_list.append(vals)
+
+ with open(csv_path, 'wb') as csvfile:
+ if active_domain:
+ w = csv.DictWriter(csvfile, fieldnames=['Filter'])
+ w.writeheader()
+ w.writerows([{'Filter':active_domain},{'Filter':' '}])
+ w = csv.DictWriter(csvfile, fieldnames=csv_header, delimiter=';')
+ w.writeheader()
+ w.writerows(data_list)
+ csvfile.close()
+
+ data = ''
+ with open(csv_path, 'rb') as csvfile:
+ data = csvfile.read()
+ data = data.encode('base64')
+ csvfile.close()
+ context = self._context.copy()
+ context.update({'default_name': data, 'default_file_name': 'timesheet_overview_export' + time_csv})
+ os.remove(csv_path)
+ return context
+
+
+ @api.multi
+ def export_csv(self):
+ """
+ This function is use to export the timesheet overview records selected base on the filters
+ """
+ analytic_timesheet,active_domain = self.env['hr.analytic.timesheet'],False
+ if self._context and 'active_model' in self._context and self._context['active_model'] == 'hr.analytic.timesheet':
+ context = self._context.copy()
+ active_domain = context.get('active_domain','')
+ if active_domain:
+ analytic_timesheet_records = analytic_timesheet.search(eval(str(active_domain)),order='account_id')
+ else:
+ analytic_timesheet_records = analytic_timesheet.browse(self._context['active_ids'])
+ # print"analytic_timesheet_records----",analytic_timesheet_records
+ context = self.export_csv_subfunction(analytic_timesheet_records,active_domain)
+
+ return {
+ 'name': _('Exported Timsheet Overview'),
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'timesheet.overview.export',
+ 'type': 'ir.actions.act_window',
+ 'context': context,
+ 'target':'new',
+ }
diff --git a/itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.xml b/itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.xml
new file mode 100644
index 0000000..c5d0cf4
--- /dev/null
+++ b/itis_hr_attendance_extend/wizard/hr_timesheet_overview_export.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ timesheet.overview.export.form.view
+ timesheet.overview.export
+
+
+
+
+
+
+ Timesheet Overview Export
+ ir.actions.act_window
+ timesheet.overview.export
+ form
+ form
+ new
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_attendance_extend/wizard/sign_in_task.py b/itis_hr_attendance_extend/wizard/sign_in_task.py
new file mode 100644
index 0000000..415c922
--- /dev/null
+++ b/itis_hr_attendance_extend/wizard/sign_in_task.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _, osv
+
+class SignInTask(models.TransientModel):
+
+ _name = "sign.in.task"
+
+ analytic_account_id = fields.Many2one("account.analytic.account", "Analytic Account")
+ service_desc_id = fields.Many2one('service.description',string="Service Desc")
+ emp_comment = fields.Text("Comment")
+
+ @api.multi
+ def set_task(self):
+ return True
+
+ @api.multi
+ def do_entry_timesheet(self):
+ timesheet_id = False
+ if self.analytic_account_id.id:
+ timesheet_obj = self.pool.get('hr.analytic.timesheet')
+ cr = self.env.cr
+ uid = self.env.uid
+ emp_obj = self.env['hr.employee']
+ hour = 0.0
+ res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
+
+ if not res['product_uom_id']:
+ raise osv.except_osv(_('User Error!'), _('Please define cost unit for this employee.'))
+ up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour,False, res['product_uom_id'])['value']
+ res['name'] = "From Time Tracker"
+ res['account_id'] = self.analytic_account_id.id
+ res['unit_amount'] = hour
+ res['service_desc_id'] = self.service_desc_id.id
+ res['emp_comment'] = self.emp_comment
+ emp_journal = emp_obj.search([('user_id', '=', self.env.uid)]).journal_id
+ res['journal_id'] = emp_journal and emp_journal.id or False
+ res.update(up)
+ up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
+ res.update(up)
+ timesheet_id = timesheet_obj.create(cr, uid, res)
+ return timesheet_id
diff --git a/itis_hr_attendance_extend/wizard/sign_in_task_view.xml b/itis_hr_attendance_extend/wizard/sign_in_task_view.xml
new file mode 100644
index 0000000..52dae12
--- /dev/null
+++ b/itis_hr_attendance_extend/wizard/sign_in_task_view.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ sign_in_task_form_view
+ sign.in.task
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/__init__.py b/itis_hr_extend/__init__.py
new file mode 100644
index 0000000..1028adc
--- /dev/null
+++ b/itis_hr_extend/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import models
+from . import wizard
diff --git a/itis_hr_extend/__openerp__.py b/itis_hr_extend/__openerp__.py
new file mode 100644
index 0000000..931d53a
--- /dev/null
+++ b/itis_hr_extend/__openerp__.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+{
+ 'name': "ITIS HR Extend",
+ 'summary': """ Module will extend Human Ressources""",
+ 'description': """
+ Module to extend the functionalities of the HR module.
+ Employee new fields and views
+ Timesheet extensions
+ Day Off Workflow
+ Reporting
+ """,
+ 'author': "IT IS AG",
+ 'website': "http://www.itis-odoo.de",
+ 'category': 'base',
+ 'version': '1.0.55.0',
+ 'depends': ['hr','hr_contract', 'hr_holidays', 'hr_payroll', 'resource'],
+ 'data': [
+ 'security/groups.xml',
+ 'static/data.xml',
+ 'views/employee_meeting_view.xml',
+ 'views/hr_employee_view.xml',
+ 'views/hr_holiday_view.xml',
+ 'views/fte_report_view.xml',
+ 'views/employee_report_view.xml',
+ 'views/employee_payroll_report_view.xml',
+ 'wizard/ot_change_view.xml',
+ 'wizard/fte_wizard_view.xml',
+ 'wizard/emp_payroll_wizard_view.xml',
+ 'wizard/emp_data_wizard_view.xml',
+ 'security/ir.model.access.csv',
+ 'data/cron.xml',
+ 'data/data.xml',
+ ],
+ 'css': [],
+ 'demo': [],
diff --git a/itis_hr_extend/data/cron.xml b/itis_hr_extend/data/cron.xml
new file mode 100644
index 0000000..293ea5a
--- /dev/null
+++ b/itis_hr_extend/data/cron.xml
@@ -0,0 +1,68 @@
+
+
+
+
+ ITIS Get Monthly Employee Data
+ get_monthly_employee_data
+ months
+ 1
+
+
+ -1
+ hr.employee
+
+
+
+
+
+ ITIS June Year Change
+ june_year_change_calc_days
+ months
+ 12
+
+
+ -1
+ hr.employee
+
+
+
+
+
+ ITIS Jahreswechsel Urlaubsberechnung
+ year_change_calc_days
+ months
+ 12
+
+
+ -1
+ hr.employee
+
+
+
+
+
+ ITIS Verfall Resturlaub
+ delete_last_year_leave_days
+ months
+ 12
+
+
+ -1
+ hr.employee
+
+
+
+
+
+ ITIS New overtime field update
+ update_new_overtime_field
+ days
+ 1
+
+
+ -1
+ hr.employee
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/data/data.xml b/itis_hr_extend/data/data.xml
new file mode 100755
index 0000000..cc74ae2
--- /dev/null
+++ b/itis_hr_extend/data/data.xml
@@ -0,0 +1,126 @@
+
+
+
+
+ Monthly Employee Data
+
+
+ ${(user.email or '') | safe}
+ ${(user.email or '') | safe}
+ Monthly Employee Data Report
+ Sehr geehrte Kollegen,
+
+
anbei erhalten Sie den aktuellen Report zur Kostenstellenübersicht nach Mitarbeiter.
+
+
Mit freundlichen Grüßen
+
Ihr HR-Team
+ ]]>
+
+
+
+
+ Urlaub im Status Entwurf abgebrochen
+
+
+ tictac@wikimedia.de
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe},${( object.employee_id.parent_id.work_email)|safe},Personal@wikimedia.de
+
+
+ Dein geplanter Urlaubsantrag (aus 2018) im Status Entwurf/Your planned holiday
+
+ wir informieren dich darüber, dass dein geplanter Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels
+ vom Status “Zu Bestätigen” (Entwurf) in den Status “Abgebrochen” geändert wurde.
+
+ Solltest du weitere Fragen haben, wende dich an das Team Personal.
+
+ Viele Grüße
+
+ Dein TicTac Team
+
----------------
+ Dear ${object.employee_id.surname},
+
+ we kindly inform you that your planned holiday from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from Status ”To Submit” (Draft)
+ into Status “Refused” due to year change.
+
+ For any questions please contact Team Personal.
+
+ Best Regards
+
+ Your TicTac Team
+ ]]>
+
+
+
+ Urlaub im Status zu genehmigen genehmigt
+
+
+ tictac@wikimedia.de
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe},${( object.employee_id.parent_id.work_email)|safe},Personal@wikimedia.de
+
+
+ Dein beantragter Urlaubsantrag (aus 2018) wurde genehmigt/Your requested holiday
+
+ wir informieren dich darüber, dass dein offener Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels
+ vom Status “Zu genehmigen” in den Status “Genehmigt” geändert wurde und der Urlaub damit freigegeben ist.
+
+ Viele Grüße
+
+ Dein TicTac Team
+
---------
+ Dear ${object.employee_id.surname},
+
we kindly inform you that your pending holiday request from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed
+ from “To Approve” in Status “Approved” due to year change.
+
+ For any questions please contact Team Personal.
+
+ Best Regards
+
+ Your TicTac Team
+
+ ]]>
+
+
+
+ Remaining Leave end Notification
+
+
+ tictac@wikimedia.de
+ ${( object.work_email or object.user_id != False and object.user_id.email )|safe},${( object.parent_id.work_email)|safe},Personal@wikimedia.de
+
+
+ Benachrichtung über deinen Resturlaub/Information about your carried over holiday
+
+ du hast ${ctx['remaining_leaves']} Tage Resturlaub aus dem Vorjahr ins neue Jahr übertragen.
+
+ Der Resturlaub muss bis 31. März genommen worden sein, ansonsten verfällt dieser zum 01. April.
+
+ Solltest du weitere Fragen haben, wende dich an das Team Personal.
+
+ Viele Grüße
+
+ Dein TicTac Team
+
-------------------
+ Dear ${object.surname},
+
+ we kindly inform you have transferred ${ctx['remaining_leaves']} days rest leave from the previous year into the new year.
+
+ These carried over days must have been taken until March 31st, otherwise it expires on the 1st of April.
+
+ For any questions please contact Team Personal.
+
+ Best Regards
+
+ Your TicTac Team
+ ]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/i18n/de.po b/itis_hr_extend/i18n/de.po
new file mode 100644
index 0000000..1230e8d
--- /dev/null
+++ b/itis_hr_extend/i18n/de.po
@@ -0,0 +1,2024 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * itis_hr_extend
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0-20170622\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-12-21 09:48+0000\n"
+"PO-Revision-Date: 2018-12-21 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: itis_hr_extend
+#: model:email.template,body_html:itis_hr_extend.email_template_monthly_employee_data
+msgid "\n"
+"
Sehr geehrte Kollegen,
\n"
+" \n"
+"
anbei erhalten Sie den aktuellen Report zur Kostenstellenübersicht nach Mitarbeiter.\n"
+"
\n"
+"
Mit freundlichen Grüßen
\n"
+"
Ihr HR-Team
\n"
+" \n"
+" "
+msgstr "\n"
+"
Sehr geehrte Kollegen,
\n"
+" \n"
+"
anbei erhalten Sie den aktuellen Report zur Kostenstellenübersicht nach Mitarbeiter.\n"
+"
wir informieren dich darüber, dass dein geplanter Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu Bestätigen” (Entwurf) in den Status “Abgebrochen” geändert wurde.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
----------------
Dear ${object.employee_id.surname},
we kindly inform you that your planned holiday from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from Status ”To Submit” (Draft) into Status “Refused” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+msgstr "Liebe/r ${object.employee_id.surname},
wir informieren dich darüber, dass dein geplanter Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu Bestätigen” (Entwurf) in den Status “Abgebrochen” geändert wurde.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
----------------
Dear ${object.employee_id.surname},
we kindly inform you that your planned holiday from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from Status ”To Submit” (Draft) into Status “Refused” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+
+#. module: itis_hr_extend
+#: model:email.template,body_html:itis_hr_extend.email_template_toapprove_leave_approve
+msgid "Liebe/r ${object.employee_id.surname},
wir informieren dich darüber, dass dein offener Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu genehmigen” in den Status “Genehmigt” geändert wurde und der Urlaub damit freigegeben ist.
Viele Grüße Dein TicTac Team ---------
Dear ${object.employee_id.surname},
we kindly inform you that your pending holiday request from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from “To Approve” in Status “Approved” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team
"
+msgstr "Liebe/r ${object.employee_id.surname},
wir informieren dich darüber, dass dein offener Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu genehmigen” in den Status “Genehmigt” geändert wurde und der Urlaub damit freigegeben ist.
Viele Grüße Dein TicTac Team ---------
Dear ${object.employee_id.surname},
we kindly inform you that your pending holiday request from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from “To Approve” in Status “Approved” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team
du hast ${ctx['remaining_leaves']} Tage Resturlaub aus dem Vorjahr ins neue Jahr übertragen. Der Resturlaub muss bis 31. März genommen worden sein, ansonsten verfällt dieser zum 01. April.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
------------------- Dear ${object.surname},
we kindly inform you have transferred ${ctx['remaining_leaves']} days rest leave from the previous year into the new year. These carried over days must have been taken until March 31st, otherwise it expires on the 1st of April.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+msgstr "Liebe/r ${object.surname},
du hast ${ctx['remaining_leaves']} Tage Resturlaub aus dem Vorjahr ins neue Jahr übertragen. Der Resturlaub muss bis 31. März genommen worden sein, ansonsten verfällt dieser zum 01. April.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
------------------- Dear ${object.surname},
we kindly inform you have transferred ${ctx['remaining_leaves']} days rest leave from the previous year into the new year. These carried over days must have been taken until March 31st, otherwise it expires on the 1st of April.
wir informieren dich darüber, dass dein geplanter Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu Bestätigen” (Entwurf) in den Status “Abgebrochen” geändert wurde.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
----------------
Dear ${object.employee_id.surname},
we kindly inform you that your planned holiday from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from Status ”To Submit” (Draft) into Status “Refused” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+msgstr "Liebe/r ${object.employee_id.surname},
wir informieren dich darüber, dass dein geplanter Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu Bestätigen” (Entwurf) in den Status “Abgebrochen” geändert wurde.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
----------------
Dear ${object.employee_id.surname},
we kindly inform you that your planned holiday from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from Status ”To Submit” (Draft) into Status “Refused” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+
+#. module: itis_hr_extend
+#: model:email.template,body_html:itis_hr_extend.email_template_toapprove_leave_approve
+msgid "Liebe/r ${object.employee_id.surname},
wir informieren dich darüber, dass dein offener Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu genehmigen” in den Status “Genehmigt” geändert wurde und der Urlaub damit freigegeben ist.
Viele Grüße Dein TicTac Team ---------
Dear ${object.employee_id.surname},
we kindly inform you that your pending holiday request from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from “To Approve” in Status “Approved” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team
"
+msgstr "Liebe/r ${object.employee_id.surname},
wir informieren dich darüber, dass dein offener Urlaubsantrag für den ${ctx['date_from']} bis zum ${ctx['date_to']} automatisch aufgrund des Jahreswechsels vom Status “Zu genehmigen” in den Status “Genehmigt” geändert wurde und der Urlaub damit freigegeben ist.
Viele Grüße Dein TicTac Team ---------
Dear ${object.employee_id.surname},
we kindly inform you that your pending holiday request from ${ctx['date_from']} until ${ctx['date_to']} was automatically changed from “To Approve” in Status “Approved” due to year change.
For any questions please contact Team Personal. Best Regards Your TicTac Team
du hast ${ctx['remaining_leaves']} Tage Resturlaub aus dem Vorjahr ins neue Jahr übertragen. Der Resturlaub muss bis 31. März genommen worden sein, ansonsten verfällt dieser zum 01. April.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
------------------- Dear ${object.surname},
we kindly inform you have transferred ${ctx['remaining_leaves']} days rest leave from the previous year into the new year. These carried over days must have been taken until March 31st, otherwise it expires on the 1st of April.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+msgstr "Liebe/r ${object.surname},
du hast ${ctx['remaining_leaves']} Tage Resturlaub aus dem Vorjahr ins neue Jahr übertragen. Der Resturlaub muss bis 31. März genommen worden sein, ansonsten verfällt dieser zum 01. April.
Solltest du weitere Fragen haben, wende dich an das Team Personal. Viele Grüße Dein TicTac Team
------------------- Dear ${object.surname},
we kindly inform you have transferred ${ctx['remaining_leaves']} days rest leave from the previous year into the new year. These carried over days must have been taken until March 31st, otherwise it expires on the 1st of April.
For any questions please contact Team Personal. Best Regards Your TicTac Team"
+
+#. module: itis_hr_extend
+#: field:hr.holidays,ljournal_ids:0
+msgid "Ljournal ids"
+msgstr "Ljournal ids"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,type:0
+msgid "Manuell"
+msgstr "Manual"
+
+#. module: itis_hr_extend
+#: selection:create.emp.payroll,month:0
+msgid "March"
+msgstr "March"
+
+#. module: itis_hr_extend
+#: selection:create.emp.payroll,month:0
+msgid "May"
+msgstr "May"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Meeting"
+msgstr "Meeting"
+
+#. module: itis_hr_extend
+#: field:employee.instruction,meeting_date:0
+#: field:employee.meeting,meeting_date:0
+msgid "Meeting Date"
+msgstr "Meeting Date"
+
+#. module: itis_hr_extend
+#: field:employee.instruction,note:0
+#: field:employee.meeting,note:0
+msgid "Meeting Notes"
+msgstr "Meeting Notes"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.view_employee_form_inherit_itis
+msgid "Meetings"
+msgstr "Meetings"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:694
+#: code:addons/itis_hr_extend/models/hr_employee.py:703
+#, python-format
+msgid "Mehr als ein Vertrag zum 01.Januar"
+msgstr "More than one contract on January 01."
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.view_employee_form_inherit_itis
+msgid "Memo"
+msgstr "Memo"
+
+#. module: itis_hr_extend
+#: model:ir.model,name:itis_hr_extend.model_mail_message
+msgid "Message"
+msgstr "Message"
+
+#. module: itis_hr_extend
+#: field:itis.leave.days.calc.error,name:0
+#: field:itis_employee_children,parent_id:0
+msgid "Mitarbeiter"
+msgstr "Mitarbeiter"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Mitarbeiter/in"
+msgstr "Employee"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Mitarbeiterdaten"
+msgstr "Employee Data"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,mobile:0
+msgid "Mobile"
+msgstr "Mobile"
+
+#. module: itis_hr_extend
+#: field:create.emp.payroll,month:0
+msgid "Month"
+msgstr "Month"
+
+#. module: itis_hr_extend
+#: model:email.template,subject:itis_hr_extend.email_template_monthly_employee_data
+msgid "Monthly Employee Data Report"
+msgstr "Monthly Employee Data Report"
+
+#. module: itis_hr_extend
+#: selection:hr.holidays,half_day_type:0
+#: selection:hr.holidays,half_day_type_date_to:0
+msgid "Morning"
+msgstr "Morning"
+
+#. module: itis_hr_extend
+#: field:hr.employee,second_name:0
+msgid "Nachname"
+msgstr "Surname"
+
+#. module: itis_hr_extend
+#: field:employee.instruction,name:0
+#: field:employee.meeting,name:0
+#: field:employee.payroll.report,name:0
+#: field:hr.health.insurance,name:0
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_tree
+#: field:itis.hr.contact,name:0
+#: field:itis_employee_children,name:0
+msgid "Name"
+msgstr "Name"
+
+#. module: itis_hr_extend
+#: field:hr.employee,employee_instruction_id:0
+msgid "Next Instruction Meeting"
+msgstr "Last Instruction Meeting"
+
+#. module: itis_hr_extend
+#: field:hr.employee,employee_meeting_id:0
+msgid "Next Meeting"
+msgstr "Last Meeting"
+
+#. module: itis_hr_extend
+#: field:res.company,next_year_date:0
+msgid "Next Year Date"
+msgstr "Next Year Date"
+
+#. module: itis_hr_extend
+#: field:hr.holidays,number_of_days_temp_ny:0
+msgid "Next Year Days"
+msgstr "Next Year Days"
+
+#. module: itis_hr_extend
+#: field:employee.report.data,sum_leaves_ny:0
+#: field:hr.holidays,sum_leaves_ny:0
+msgid "Next Year Remaining Leaves"
+msgstr "Next Year Remaining Leaves"
+
+#. module: itis_hr_extend
+#: field:hr.employee,nextyear_leave_ids:0
+msgid "Nextyear leave ids"
+msgstr "Nextyear leave ids"
+
+#. module: itis_hr_extend
+#: selection:employee.payroll.report,record_change:0
+msgid "No Change"
+msgstr "No Change"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/employee_report.py:42
+#, python-format
+msgid "No associated employee found with user"
+msgstr "No associated employee found with user"
+
+#. module: itis_hr_extend
+#: field:hr.employee,contract_notes:0
+msgid "Notes"
+msgstr "Notes"
+
+#. module: itis_hr_extend
+#: field:hr.employee,emergency_contact:0
+msgid "Notfallkontakt"
+msgstr "emergency contact"
+
+#. module: itis_hr_extend
+#: selection:create.emp.payroll,month:0
+msgid "November"
+msgstr "November"
+
+#. module: itis_hr_extend
+#: selection:create.emp.payroll,month:0
+msgid "October"
+msgstr "October"
+
+#. module: itis_hr_extend
+#: model:ir.actions.act_window,name:itis_hr_extend.hr_office_time_action
+msgid "Office Leave Timing"
+msgstr "Office Leave Timing"
+
+#. module: itis_hr_extend
+#: model:ir.ui.menu,name:itis_hr_extend.menu_office_time
+msgid "Office Time"
+msgstr "Office Time"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:294
+#: code:addons/itis_hr_extend/models/hr_holiday.py:375
+#, python-format
+msgid "Only the Manager of this employee can approve this leave request."
+msgstr "Only the Manager of this employee can approve this leave request."
+
+#. module: itis_hr_extend
+#: field:employee.overtime.count,emp_overtime_count:0
+#: field:employee.report.data,overtime_count:0
+#: field:hr.employee,computed_overtime_count:0
+#: field:hr.employee,overtime_count:0
+#: field:hr.holidays,ot_hours:0
+#: field:ot.change,ot_time:0
+msgid "Overtime Count"
+msgstr "Overtime Count"
+
+#. module: itis_hr_extend
+#: field:hr.employee,employee_overtime_id:0
+msgid "Overtime Count New"
+msgstr "Overtime Count New"
+
+#. module: itis_hr_extend
+#: model:hr.holidays.status,name:itis_hr_extend.itis_leave_overtime
+msgid "Overtime Leave"
+msgstr "Overtime Leave"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:608
+#: code:addons/itis_hr_extend/models/hr_employee.py:640
+#, python-format
+msgid "Overtime has been chagned from %s to %s. Reason : %s"
+msgstr "Overtime has been chagned from %s to %s. Reason : %s"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,identification_id:0
+msgid "Personal-Nr"
+msgstr "Personal-Nr"
+
+#. module: itis_hr_extend
+#: selection:employee.data.export,report_selection:0
+#: model:ir.actions.server,name:itis_hr_extend.action_sever_itis_emp_data
+#: model:ir.ui.menu,name:itis_hr_extend.itis_emp_data_menu_server
+msgid "Personalübersicht"
+msgstr "Staff Overview"
+
+#. module: itis_hr_extend
+#: model:ir.actions.act_window,name:itis_hr_extend.employee_data_export_action
+#: model:ir.actions.act_window,name:itis_hr_extend.launch_employee_data_export_wizard
+msgid "Personalübersicht Export"
+msgstr "Staff Overview Export"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,phone:0
+msgid "Phone"
+msgstr "Phone"
+
+#. module: itis_hr_extend
+#: field:fte.records,planned_fte:0
+#: field:hr.department,planned_fte:0
+msgid "Planned FTE"
+msgstr "Planned FTE"
+
+#. module: itis_hr_extend
+#: model:ir.actions.act_window,name:itis_hr_extend.hr_planned_job
+#: model:ir.ui.menu,name:itis_hr_extend.menu_planned_job
+#: view:planned.job:itis_hr_extend.itis_planned_job_tree
+msgid "Planned Jobs"
+msgstr "Planned Jobs"
+
+#. module: itis_hr_extend
+#: field:hr.employee,planned_job_id:0
+#: field:planned.job,name:0
+msgid "Planstellen"
+msgstr "Planned Jobs"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:155
+#: code:addons/itis_hr_extend/models/hr_holiday.py:536
+#: code:addons/itis_hr_extend/models/hr_holiday.py:556
+#, python-format
+msgid "Please create a leave request for every year."
+msgstr "Please create a leave request for every year."
+
+#. module: itis_hr_extend
+#: field:hr.employee,position:0
+msgid "Position"
+msgstr "Nebentätigkeit"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,address_home:0
+#: field:employee.payroll.report,address_home_id:0
+msgid "Privatanschrift"
+msgstr "Private Address"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Probezeit Enddatum"
+msgstr "Trial End Date"
+
+#. module: itis_hr_extend
+#: field:ld.change,reason:0
+#: field:ot.change,reason:0
+msgid "Reason"
+msgstr "reason"
+
+#. module: itis_hr_extend
+#: field:hr.employee,contract_limitation_reason:0
+msgid "Reason of Limitation"
+msgstr "Reason of Limitation"
+
+#. module: itis_hr_extend
+#: field:hr.employee,sum_leaves_ny:0
+msgid "Remaining Leaves Following Year"
+msgstr "Remaining Leaves Following Year"
+
+#. module: itis_hr_extend
+#: field:employee.data.export,report_selection:0
+msgid "Report"
+msgstr "Report"
+
+#. module: itis_hr_extend
+#: model:ir.ui.menu,name:itis_hr_extend.menu_hr_reports
+msgid "Reports"
+msgstr "Reports"
+
+#. module: itis_hr_extend
+#: model:ir.model,name:itis_hr_extend.model_resource_calendar
+msgid "Resource Calendar"
+msgstr "Resource Calendar"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,year_type:0
+msgid "Restanspruch"
+msgstr "Remainig last year leaves"
+
+#. module: itis_hr_extend
+#: field:hr.employee,leave_days_last_year:0
+msgid "Resturlaub"
+msgstr "Resturlaub"
+
+#. module: itis_hr_extend
+#: model:ir.model,name:itis_hr_extend.model_hr_payroll_structure
+msgid "Salary Structure"
+msgstr "Salary Structure"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,disability:0
+#: field:hr.employee,disability:0
+msgid "Schwerbehinderung"
+msgstr "Disability"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,disability_limited_until:0
+msgid "Schwerbehinderung Gültigkeit"
+msgstr "Disability Validity"
+
+#. module: itis_hr_extend
+#: view:hr.leave.journal:itis_hr_extend.itis_hr_leave_journal_form
+msgid "Search Leave"
+msgstr "Search Leave"
+
+#. module: itis_hr_extend
+#: selection:create.emp.payroll,month:0
+msgid "September"
+msgstr "September"
+
+#. module: itis_hr_extend
+#: field:res.company,for_sow17:0
+msgid "Simulate date for leave calc"
+msgstr "Simulate date for leave calc"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Sozialversicherungsnummer"
+msgstr "social security number"
+
+#. module: itis_hr_extend
+#: field:leave.time,fullday_start_time:0
+#: field:leave.time,halfday_afternoon_start_time:0
+#: field:leave.time,halfday_morning_start_time:0
+msgid "Start Time"
+msgstr "Start Time"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Startdatum der letzten Vertragversänderung"
+msgstr "Start date of last contract change"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+#: field:itis.hr.contact,state_id:0
+msgid "State"
+msgstr "State"
+
+#. module: itis_hr_extend
+#: field:hr.family.status,name:0
+msgid "Status"
+msgstr "Status"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Steuer-ID"
+msgstr "tax-ID"
+
+#. module: itis_hr_extend
+#: field:hr.employee,taxclass:0
+msgid "Steuerklasse"
+msgstr "tax category"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 1"
+msgstr "Steuerklasse 1"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 2"
+msgstr "Steuerklasse 2"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 3"
+msgstr "Steuerklasse 3"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 4"
+msgstr "Steuerklasse 4"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 5"
+msgstr "Steuerklasse 5"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 6"
+msgstr "Steuerklasse 6"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,street:0
+msgid "Street"
+msgstr "Street"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "Street 2..."
+msgstr "Street 2..."
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "Street..."
+msgstr "Street..."
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,street2:0
+msgid "Street2"
+msgstr "Street2"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_hours:0
+#: selection:hr.leave.journal,leave_type:0
+msgid "Stunden"
+msgstr "Hours"
+
+#. module: itis_hr_extend
+#: field:employee.instruction,supervisor_id:0
+#: field:employee.meeting,supervisor_id:0
+msgid "Supervisor"
+msgstr "Supervisor"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_days:0
+#: selection:hr.leave.journal,leave_type:0
+#: field:hr.leave.nextyear,leave_days:0
+msgid "Tage"
+msgstr "Days"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Telefon (interne Durchwahl)"
+msgstr "Telefone number (internal)"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:162
+#: code:addons/itis_hr_extend/models/hr_holiday.py:172
+#, python-format
+msgid "The number of next year remaining leaves is not sufficient for this leave type.\n"
+"Please verify also the leaves waiting for validation."
+msgstr "The number of next year remaining leaves is not sufficient for this leave type.\n"
+"Please verify also the leaves waiting for validation."
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:168
+#, python-format
+msgid "The number of remaining leaves is not sufficient for this leave type.\n"
+"Please verify also the leaves waiting for validation."
+msgstr "The number of remaining leaves is not sufficient for this leave type.Please verify also the leaves waiting for validation."
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:661
+#, python-format
+msgid "There are 2 contracts assigned to this employee."
+msgstr "There are 2 contracts assigned to this employee."
+
+#. module: itis_hr_extend
+#: field:employee.data.export,name:0
+msgid "Timesheet CSV"
+msgstr "Timesheet CSV"
+
+#. module: itis_hr_extend
+#: field:hr.employee,contract_trial_end_date:0
+msgid "Trial End Date"
+msgstr "Trial End Date"
+
+#. module: itis_hr_extend
+#: view:hr.contract:itis_hr_extend.hr_contract_view_form_itis
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_form_itis
+msgid "True"
+msgstr "True"
+
+#. module: itis_hr_extend
+#: field:hr.employee,contract_type:0
+#: field:hr.leave.journal,type:0
+#: field:ld.change,type:0
+msgid "Type"
+msgstr "Type"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:822
+#: code:addons/itis_hr_extend/models/hr_employee.py:834
+#, python-format
+msgid "Umwandlung Resturlaub"
+msgstr "transfer remaining leaves"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Update"
+msgstr "Update"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Urlaub"
+msgstr "Leave"
+
+#. module: itis_hr_extend
+#: field:hr.contract,base_leaves:0
+msgid "Urlaubsanspruch"
+msgstr "leave entitlement"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Urlaubsjournal"
+msgstr "Leave Journal"
+
+#. module: itis_hr_extend
+#: field:hr.employee,leave_days:0
+msgid "Urlaubstage"
+msgstr "Urlaubstage"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/employee_report.py:44
+#, python-format
+msgid "User is associated with multiple employee"
+msgstr "User is associated with multiple employee"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:1091
+#, python-format
+msgid "Verfall Resturlaub"
+msgstr "deletion remaining last year leaves"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Vergütung"
+msgstr "Compensation"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Vergütung bei VZ"
+msgstr "Compensation full time"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+#: field:hr.employee,remuneration_incl_ag_costs:0
+msgid "Vergütung inkl. AG Kosten (25%)"
+msgstr "Compensation incl. AG Costs (25%)"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,struct_id:0
+msgid "Vergütungsmodell"
+msgstr "Compensatory Model"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,type:0
+msgid "Vertraglich"
+msgstr "based on contract"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,contract_start_date:0
+msgid "Vertragsbeginn"
+msgstr "Contract start date"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,contract_end_date:0
+msgid "Vertragsende"
+msgstr "Contract end date"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Vertragsinformationen"
+msgstr "contract informationen"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,contract_name:0
+msgid "Vertragsreferenz"
+msgstr "Contract reference"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "Vertragstyp"
+msgstr "Contract type"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,surname:0
+#: field:hr.employee,surname:0
+msgid "Vorname"
+msgstr "First name"
+
+#. module: itis_hr_extend
+#: field:employee.payroll.report,wage:0
+#: field:hr.employee,contract_wage:0
+#: field:hr.employee,emp_wage_cal:0
+msgid "Wage"
+msgstr "Wage"
+
+#. module: itis_hr_extend
+#: field:hr.employee,wage_info:0
+msgid "Wage Information"
+msgstr "Wage Information"
+
+#. module: itis_hr_extend
+#: field:hr.employee,contract_working_hours:0
+msgid "Working Hours"
+msgstr "Working Hours"
+
+#. module: itis_hr_extend
+#: field:create.emp.payroll,year:0
+msgid "Year"
+msgstr "Year"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,year_type:0
+msgid "Year type"
+msgstr "Year type"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:158
+#, python-format
+msgid "You are not allow to apply leave for the year after next"
+msgstr "You are not allow to apply leave for the year after next"
+
+#. module: itis_hr_extend
+#: constraint:hr.holidays:0
+msgid "You can not have 2 leaves that overlaps on same day!"
+msgstr "You can not have 2 leaves that overlaps on same day!"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:577
+#, python-format
+msgid "You can only change additional leave days for next year after May month"
+msgstr "You can only change additional leave days for next year after May month"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:559
+#, python-format
+msgid "You can only change next year leave after May month"
+msgstr "You can only change next year leave after May month"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "ZIP"
+msgstr "ZIP"
+
+#. module: itis_hr_extend
+#: field:hr.employee,sign_permission:0
+msgid "Zeichnungsbefugnis"
+msgstr "signing rights"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,zip:0
+msgid "Zip"
+msgstr "Zip"
+
+#. module: itis_hr_extend
+#: field:hr.employee,additional_leave_days:0
+#: selection:hr.leave.journal,type:0
+msgid "Zusatzurlaub"
+msgstr "additional leaves"
+
+#. module: itis_hr_extend
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_form_itis
+msgid "[('is_holiday', '!=',True)]"
+msgstr "[('is_holiday', '!=',True)]"
+
+#. module: itis_hr_extend
+#: field:hr.employee,approved_leaves:0
+msgid "abgegoltene Urlaubstage"
+msgstr "abgegoltene Urlaubstage"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,year_type:0
+msgid "aktuell"
+msgstr "actual"
+
+#. module: itis_hr_extend
+#: view:hr.payslip:itis_hr_extend.hr_payroll_view_hr_payslip_form_itis
+msgid "base.group_hr_payroll_manager"
+msgstr "base.group_hr_payroll_manager"
+
+#. module: itis_hr_extend
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_form_itis
+msgid "base.group_user"
+msgstr "base.group_user"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_end:0
+msgid "bis"
+msgstr "to"
+
+#. module: itis_hr_extend
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_tree_itis
+msgid "date"
+msgstr "date"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "e.g. Part Time"
+msgstr "e.g. Part Time"
+
+#. module: itis_hr_extend
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_form_itis
+msgid "hours"
+msgstr "hours"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_emp_data_tree
+msgid "letzte Vertragsänderung_L&G"
+msgstr "letzte Vertragsänderung_L&G"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,br_member:0
+#: selection:hr.employee,disability:0
+msgid "nein"
+msgstr "no"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,year_type:0
+msgid "next"
+msgstr "next"
+
+#. module: itis_hr_extend
+#: view:create.emp.payroll:itis_hr_extend.emp_payroll_wiz_form_view
+#: view:create.fte:itis_hr_extend.fte_wiz_form_view
+#: view:employee.data.export:itis_hr_extend.employee_data_export_form_view
+#: view:export.emp.payroll:itis_hr_extend.emp_payroll_export_form_view
+#: view:ld.change:itis_hr_extend.ld_change_form_view
+#: view:ot.change:itis_hr_extend.ot_change_form_view
+msgid "or"
+msgstr "or"
+
+#. module: itis_hr_extend
+#: view:leave.time:itis_hr_extend.itis_leave_timing_tree
+msgid "to"
+msgstr "to"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_start:0
+msgid "von"
+msgstr "of"
+
+#. module: itis_hr_extend
+#: field:hr.employee,emergency_contact2:0
+msgid "zweiter Notfallkontakt"
+msgstr "second emergency contact"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:708
+#, python-format
+msgid "Überschneidende Verträge"
+msgstr "two contracts on the same date"
+
diff --git a/itis_hr_extend/models/__init__.py b/itis_hr_extend/models/__init__.py
new file mode 100644
index 0000000..d64c483
--- /dev/null
+++ b/itis_hr_extend/models/__init__.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import hr_employee
+from . import hr_holiday
+from . import fte_report
+from . import hr_leave
+from . import employee_report
+from . import mail_message
+from . import employee_meeting
+from . import employee_payroll_report
diff --git a/itis_hr_extend/models/employee_meeting.py b/itis_hr_extend/models/employee_meeting.py
new file mode 100644
index 0000000..4ea33ac
--- /dev/null
+++ b/itis_hr_extend/models/employee_meeting.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+
+class employee_meeting(models.Model):
+
+ _name = 'employee.meeting'
+ _rec_name = 'meeting_date'
+
+ name = fields.Char(string="Name")
+ meeting_date = fields.Date(string="Meeting Date")
+ employee_id = fields.Many2one('hr.employee',string="Employee")
+ supervisor_id = fields.Many2one('hr.employee',string="Supervisor")
+ note = fields.Char(string="Meeting Notes")
+
+
+class employee_instruction(models.Model):
+
+ _name = 'employee.instruction'
+ _rec_name = 'meeting_date'
+
+ name = fields.Char(string="Name")
+ meeting_date = fields.Date(string="Meeting Date")
+ employee_id = fields.Many2one('hr.employee',string="Employee")
+ supervisor_id = fields.Many2one('hr.employee',string="Supervisor")
+ note = fields.Char(string="Meeting Notes")
diff --git a/itis_hr_extend/models/employee_payroll_report.py b/itis_hr_extend/models/employee_payroll_report.py
new file mode 100644
index 0000000..a871470
--- /dev/null
+++ b/itis_hr_extend/models/employee_payroll_report.py
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.exceptions import Warning
+
+
+class employee_payroll_report(models.TransientModel):
+
+ _name = 'employee.payroll.report'
+
+ @api.one
+ def _get_address(self):
+ if self.address_home:
+ self.address_home_id = unicode(self.address_home.name)
+ if self.address_home.street:
+ self.address_home_id += ' ' + unicode(self.address_home.street)
+ if self.address_home.zip:
+ self.address_home_id += ' ' + unicode(self.address_home.zip)
+ if self.address_home.city:
+ self.address_home_id += ' ' + unicode(self.address_home.city)
+ else:
+ self.address_home_id = ''
+ return
+
+ record_change = fields.Selection([('N','No Change'),('ST','Change Employee'),('V','Change Contract'),('SV','Change Employee Contract')],default='N',string='Change Record')
+ sick_days = fields.Float(string='Krankheitstage')
+ gross_salary = fields.Float(string='Brattogehalt')
+ address_home_id = fields.Char(string="Privatanschrift", compute="_get_address")
+
+
+ employee_id = fields.Many2one('hr.employee', string="Employee")
+ contract_id = fields.Many2one('hr.contract', string='Contract')
+
+ identification_id = fields.Char(related='employee_id.identification_id',string="Personal-Nr")
+ name = fields.Char(related='employee_id.second_name',string="Name")
+ surname = fields.Char(related='employee_id.surname',string="Vorname")
+ birthday = fields.Date(related='employee_id.birthday',string="Geburtsdatum")
+ address_home = fields.Many2one(related='employee_id.address_home_id',string="Privatanschrift")
+ address_id = fields.Many2one(related='employee_id.address_id',string="Arbeitgeber")
+ bank_account_id = fields.Many2one(related='employee_id.bank_account_id',string="Bankverbindung")
+ health_insurance = fields.Many2one(related='employee_id.health_insurance',string="Krankenkasse")
+ disability = fields.Selection(related='employee_id.disability',string="Schwerbehinderung")
+ disability_limited_until = fields.Date(related='employee_id.disability_limited_until',string="Schwerbehinderung Gültigkeit")
+ family_status = fields.Many2one(related='employee_id.family_status',string="Familienstand")
+ children = fields.Integer(related='employee_id.children',string="Anzahl Kinder")
+
+ contract_name = fields.Char(related='contract_id.name',string="Vertragsreferenz")
+ contract_start_date = fields.Date(related='contract_id.date_start',string="Vertragsbeginn")
+ contract_end_date = fields.Date(related='contract_id.date_end',string="Vertragsende")
+ working_hours = fields.Many2one(related='contract_id.working_hours',string="Arbeitszeit")
+ struct_id = fields.Many2one(related='contract_id.struct_id',string="Vergütungsmodell")
+ notes = fields.Text(related='contract_id.notes',string="Bemerkung Vertragsinformationen")
+ wage = fields.Float(string='Wage')
+
+
+
+
+
+
diff --git a/itis_hr_extend/models/employee_report.py b/itis_hr_extend/models/employee_report.py
new file mode 100644
index 0000000..3fb20be
--- /dev/null
+++ b/itis_hr_extend/models/employee_report.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.exceptions import Warning
+
+
+class employee_report(models.TransientModel):
+
+ _name = 'employee.report'
+
+ def _get_employee(self):
+ user_env = self.env['res.users']
+ emp_env = self.env['hr.employee']
+ emp_rec = emp_env.search([('user_id', '=', self._uid)])
+ if not len(emp_rec):
+ raise Warning(_("No associated employee found with user"))
+ if len(emp_rec) > 1:
+ raise Warning(_("User is associated with multiple employee"))
+ emp_rec = emp_rec[0]
+ emp_list = []
+ for emp in emp_env.search(['|', ('parent_id', '=', emp_rec.id), ('id', '=', emp_rec.id)]):
+ emp_val = {
+ 'employee_id': emp.id,
+ 'overtime_count':emp.employee_overtime_id.emp_overtime_count,
+ # 'overtime_count':emp.overtime_count,
+ 'sum_leaves': emp.sum_leaves,
+ 'sum_leaves_ny':emp.sum_leaves_ny #for SOW17
+ }
+ if emp_val['overtime_count'] <= 20 and emp_val['overtime_count'] >= -20:
+ color = "green"
+ elif emp_val['overtime_count'] <= 40 and emp_val['overtime_count'] >= -40:
+ color = "yellow"
+ else:
+ color = "red"
+ emp_val['color'] = color
+ emp_list.append((0, 0, emp_val))
+ return emp_list
+
+ name= fields.Date(string="Date", default=fields.Date.context_today)
+ employee_ids = fields.One2many('employee.report.data', 'employee_report_id', string='Employees', default=_get_employee)
+
+
+class employee_report_data(models.TransientModel):
+
+ _name = 'employee.report.data'
+
+ employee_id = fields.Many2one('hr.employee', string='Employee')
+ overtime_count = fields.Float(string='Overtime Count')
+ sum_leaves = fields.Float(string='Gesamtanspruch')
+ sum_leaves_ny = fields.Float(string='Next Year Remaining Leaves')#for SOW17
+ employee_report_id = fields.Many2one('employee.report', string='Employee Report')
+ color = fields.Char()
diff --git a/itis_hr_extend/models/fte_report.py b/itis_hr_extend/models/fte_report.py
new file mode 100644
index 0000000..d87d2df
--- /dev/null
+++ b/itis_hr_extend/models/fte_report.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+
+
+
+class fte_records(models.Model):
+
+ _name = 'fte.records'
+
+ department_id = fields.Many2one('hr.department', string="Department")
+ planned_fte = fields.Float(string='Planned FTE')
+ fte = fields.Float(string='FTE', digits=(5, 3))
+ diff_fte = fields.Float(string='Difference FTE', digits=(5, 3))
+ fte_id = fields.Many2one('fte.report', string="FTE Report")
+
+
+class fte_report(models.Model):
+
+ _name = 'fte.report'
+
+ _order = 'id desc'
+
+ name = fields.Date(string="Date", default=fields.Date.context_today)
+ fte_ids = fields.One2many('fte.records', 'fte_id', string='FTE Records')
+
+
+class res_company(models.Model):
+
+ _inherit = "res.company"
+
+ for_sow17 = fields.Boolean(string='Simulate date for leave calc')
+ next_year_date = fields.Date('Next Year Date')
+
diff --git a/itis_hr_extend/models/hr_employee.py b/itis_hr_extend/models/hr_employee.py
new file mode 100644
index 0000000..5cfe695
--- /dev/null
+++ b/itis_hr_extend/models/hr_employee.py
@@ -0,0 +1,1157 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.tools import float_round
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from openerp.exceptions import Warning
+from datetime import datetime, timedelta
+from calendar import monthrange
+from dateutil.relativedelta import relativedelta
+from openerp import http
+from openerp.addons.web.controllers import main as parent_controller
+from openerp.http import request, serialize_exception as _serialize_exception
+import logging
+import re
+logger = logging.getLogger(__name__)
+import pdb
+import logging
+logger = logging.getLogger(__name__)
+
+number_select = [(x,str('x')) for x in range(1,7)]
+
+class employee_overtime_count(models.Model):
+
+ _name = 'employee.overtime.count'
+ _rec_name = "emp_overtime_count"
+
+ emp_overtime_count = fields.Float(string='Overtime Count')
+ employee_id = fields.Many2one('hr.employee',string="Employee")
+
+class resource_calendar(models.Model):
+ _inherit = 'resource.calendar'
+
+ hourly_basis = fields.Boolean(string="Hourly Basis")
+
+class itis_contract_type(models.Model):
+
+ _name = 'itis.contract.type'
+
+ name = fields.Char(string="Art")
+
+class planned_job(models.Model):
+
+ _name = 'planned.job'
+
+ name = fields.Char(string="Planstellen")
+
+class itis_confession(models.Model):
+
+ _name = 'itis_confession'
+
+ name = fields.Char(string="Bezeichnung")
+
+class leave_time(models.Model):
+
+ _name = 'leave.time'
+
+ active = fields.Boolean(string="Active")
+ fullday_start_time = fields.Integer(string="Start Time")
+ fullday_end_time = fields.Integer(string="End Time")
+ halfday_morning_start_time = fields.Integer(string="Start Time")
+ halfday_morning_end_time = fields.Integer(string="End Time")
+ halfday_afternoon_start_time = fields.Integer(string="Start Time")
+ halfday_afternoon_end_time = fields.Integer(string="End Time")
+
+class itis_employee_children(models.Model):
+
+ _name = 'itis_employee_children'
+
+ name = fields.Char(string="Name")
+ birth_date = fields.Date(string="Geburtsdatum")
+ parent_id = fields.Many2one('hr.employee',string="Mitarbeiter")
+
+class itis_limitation_reason(models.Model):
+
+ _name = 'itis_limitation_reason'
+
+ name = fields.Char(string="Bezeichnung")
+
+
+class itis_hr_contact(models.Model):
+
+ _name = 'itis.hr.contact'
+
+ name = fields.Char(index=True, required=1)
+ street = fields.Char()
+ street2 = fields.Char()
+ zip = fields.Char(change_default=True)
+ city = fields.Char()
+ state_id = fields.Many2one("res.country.state", string='State', ondelete='restrict')
+ country_id = fields.Many2one('res.country', string='Country', ondelete='restrict')
+ email = fields.Char()
+ phone = fields.Char()
+ fax = fields.Char()
+ mobile = fields.Char()
+
+class itis_hr_employee_fte(models.Model):
+
+ _name = 'hr.employee.fte'
+
+ emp_id = fields.Many2one('hr.employee', string='Employee')
+ department_id = fields.Many2one('hr.department', string='Department')
+ fte = fields.Float(string="FTE", digits=(5, 3))
+
+class health_insurance(models.Model):
+
+ _name = 'hr.health.insurance'
+
+ name = fields.Char(string='Name')
+
+class falimy_status(models.Model):
+
+ _name = 'hr.family.status'
+
+ name = fields.Char(string='Status')
+
+class hr_payroll_structure(models.Model):
+ _inherit = 'hr.payroll.structure'
+
+ base_on_hours = fields.Boolean(string="Base on Hours")
+
+
+class itis_hr_employee(models.Model):
+
+ _inherit = 'hr.employee'
+
+ surname = fields.Char(string="Vorname")
+ second_name = fields.Char(string="Nachname")
+ birth_name = fields.Char(string="Geburtsname")
+ taxclass = fields.Selection(selection=[(1,'Steuerklasse 1'),(2,'Steuerklasse 2'),(3,'Steuerklasse 3'),(4,'Steuerklasse 4'),(5,'Steuerklasse 5'),(6,'Steuerklasse 6')], string="Steuerklasse")
+ confession = fields.Many2one('itis_confession', string="Konfession")
+ health_insurance = fields.Many2one('hr.health.insurance', string="Krankenkasse")
+ disability = fields.Selection([('no','nein'),('yes','Ja')], string="Schwerbehinderung")
+ disability_limited_until = fields.Date(string="Befristet bis")
+ fte = fields.Float(string="FTE", compute="_compute_fte", digits=(5, 3))
+ sign_permission = fields.Char(string="Zeichnungsbefugnis")
+ active_employee = fields.Boolean(string="Aktiv")
+ emergency_contact = fields.Many2one('itis.hr.contact', string='Notfallkontakt')
+ emergency_contact2 = fields.Many2one('itis.hr.contact', string='zweiter Notfallkontakt')
+ children_ids = fields.One2many('itis_employee_children', 'parent_id', string='Kinder')
+ five_years = fields.Date(string="5-Jahres-Jubiläum")
+ bereich = fields.Many2one('hr.department', string="Bereich")
+ overtime_count = fields.Float(string='Overtime Count')
+ fte_ids = fields.One2many('hr.employee.fte', 'emp_id', string="FTEs")
+ family_status = fields.Many2one('hr.family.status',string='Familienstand')
+ initial_date = fields.Date(string='Ersteintrittsdatum')
+ temp_contract_end_date = fields.Date(string='Enddatum befristeter Vertrag',compute="_compute_contract_end_date",multi="contract_end_date")
+ wage_info = fields.Text(string='Wage Information')
+
+ br_member = fields.Selection([('no','nein'),('yes','Ja')], string="BR Mitglied")
+ position = fields.Char(string="Position")
+ planned_job_id = fields.Many2one('planned.job',string='Planstellen')
+
+ employee_meeting_id = fields.Many2one('employee.meeting',compute="_compute_next_emp_meeting",string='Next Meeting')
+ employee_instruction_id = fields.Many2one('employee.instruction',compute="_compute_next_emp_instruction_meeting",string='Next Instruction Meeting')
+
+ employee_overtime_id = fields.Many2one('employee.overtime.count',string="Overtime Count New")
+ computed_overtime_count = fields.Float(string='Overtime Count',compute="_compute_overtime_count")
+
+ executive_employee = fields.Boolean(string="Executive Employee")
+ contract_type = fields.Many2one('hr.contract.type',string="Type", compute="get_active_contract_data", multi="contract_data")
+ contract_wage = fields.Float(string="Wage", compute="get_active_contract_data", multi="contract_data")
+ contract_leaves = fields.Float(string="Leaves", compute="get_active_contract_data", multi="contract_data")
+ contract_notes = fields.Text(string="Notes", compute="get_active_contract_data", multi="contract_data")
+ contract_limitation_reason = fields.Many2one('itis_limitation_reason',string="Reason of Limitation", compute="_compute_contract_end_date", multi="contract_end_date")
+
+ contract_working_hours = fields.Many2one('resource.calendar',string="Working Hours", compute="get_active_contract_data", multi="contract_data")
+ contract_trial_end_date = fields.Date(string="Trial End Date", compute="get_active_contract_data", multi="contract_data")
+
+ last_ma_conversation_date = fields.Date(string='Last Meeting', compute="_compute_last_emp_meeting")
+ # last_ma_conversation= fields.Many2one('employee.meeting',compute="_compute_last_emp_meeting",string='Last Meeting',help='Use to give most recent meeting in the past')
+ compensation_at_vz = fields.Float(string="Compensation At VZ", compute="get_active_contract_data", multi="contract_data")
+ remuneration_incl_ag_costs = fields.Float(string="Vergütung inkl. AG Kosten (25%)", compute="get_active_contract_data", multi="contract_data")
+ last_contract_changed_wage = fields.Float(string="Last Contract Changed Wage", compute="get_active_contract_data", multi="contract_data")
+ last_contract_changed_date = fields.Date(string="Last Contract Change Date", compute="get_active_contract_data", multi="contract_data")
+
+ # the below field is use to calculate the employee wage base on the hour as well as normal wage.It called on the scheduler once in the day.
+ emp_wage_cal = fields.Float(string="Wage")
+
+ @api.model
+ def get_monthly_employee_data(self):
+ """Call from Scheduler, Use to generate monthly employee data report and send it via email to work council"""
+
+ logger.info("---In the get_monthly_employee_data cron--")
+ today_date = datetime.today().date()
+ last_month_date = today_date - relativedelta(months= 1)
+ hr_employee_brw = self.search([('executive_employee','=',False),('active','=',True)],order='id')
+ if hr_employee_brw:
+ logger.info("---Records to get %s" %hr_employee_brw)
+ # call the subfunction to generate the .csv report
+ context = self.env['employee.data.export'].with_context(for_work_council=True).export_csv_subfunction(hr_employee_brw)
+ if context:
+ # create attachement record of the related csv file
+ ir_attachment = self.env['ir.attachment']
+ file_name ='employee_data_report_'+str(last_month_date)+'_'+str(today_date)+'.csv'
+ attachment_data = {
+ 'name': file_name,
+ 'datas_fname':file_name,
+ 'datas':context.get('default_name'),
+ 'res_model': 'email.template',
+ }
+ ir_attachment_brw = ir_attachment.create(attachment_data)
+
+ #template = self.env.ref('itis_hr_extend.email_template_monthly_employee_data', False)
+ template = False #Added by IT IS to disable email sending.
+ if ir_attachment_brw and template:
+ logger.info("---Template found and send a mail")
+ template.write({'attachment_ids': [(6, 0, [ir_attachment_brw.id])]}) # link a attachment to email template
+ template.send_mail(hr_employee_brw[0].id)# send a mail with attachment
+ template.write({'attachment_ids': [(3, ir_attachment_brw.id)]})# to unlink the attachment from template after sending a email
+
+
+ @api.model
+ def open_emp_data_tree(self):
+ """Add view for the employee data report,called from the server action"""
+ filter_employee_ids = []
+ today_date = datetime.today().date()
+ hr_contract = self.env['hr.contract']
+ hr_employee_recs = self.env['hr.employee'].search([('user_id','!=',False),('parent_id','!=',False)])
+ if hr_employee_recs:
+ for hr_employee_rec in hr_employee_recs:
+ active_contract_brw = hr_contract.search([('employee_id','=',hr_employee_rec.id),
+ ('date_start','<=',today_date),'|',('date_end','>=',today_date),('date_end','=',False)],limit=1)
+ if active_contract_brw:
+ filter_employee_ids.append(hr_employee_rec.id)
+ if active_contract_brw.struct_id.base_on_hours:
+ self.calculate_emp_wage(hr_employee_rec,active_contract_brw)
+ else:
+ hr_employee_rec.write({'emp_wage_cal':active_contract_brw.wage})
+ # print"filter_employee_ids----",filter_employee_ids
+
+ domain = "[('id', 'in', " + str(filter_employee_ids) + ")]"
+ tree_view_id = self.env.ref('itis_hr_extend.hr_emp_data_tree').id
+ value = {
+ 'domain': domain,
+ 'name': 'Personalübersicht',
+ 'view_type': 'form',
+ 'view_mode': 'tree',
+ 'res_model': 'hr.employee',
+ 'view_id': tree_view_id,
+ 'type': 'ir.actions.act_window'
+ }
+ return value
+
+ def calculate_emp_wage(self,hr_employee_rec,active_contract_brw):
+ """to calculate the monthly wage base on the hours salary structure
+ """
+ logger.info("---hr_employee_rec %s" %hr_employee_rec)
+ gross_salary = 0.0
+ hr_payslip = self.env['hr.payslip']
+ year = datetime.today().year
+ month = datetime.today().month
+ selected_month_range,num_day = monthrange(year,month)
+ period_start_date = datetime.today().date().replace(day=1)
+ period_end_date = datetime.today().date().replace(day=num_day)
+
+ contract_date_start = datetime.strptime(active_contract_brw.date_start,'%Y-%m-%d').date()
+ if active_contract_brw.date_end:
+ contract_date_end = datetime.strptime(active_contract_brw.date_end,'%Y-%m-%d').date()
+ else:
+ contract_date_end = datetime.today().date()
+
+ if contract_date_start <= period_start_date:
+ period_contract_start_date =period_start_date
+ else:
+ period_contract_start_date =contract_date_start
+
+ if contract_date_end >= period_end_date:
+ period_contract_end_date =period_end_date
+ else:
+ period_contract_end_date =contract_date_end
+
+ logger.info("---period_contract_start_date %s" %period_contract_start_date)
+ logger.info("---period_contract_end_date %s" %period_contract_end_date)
+ # print"period_contract_start_date---------",period_contract_start_date
+ # print"period_contract_end_date---------",period_contract_end_date
+
+
+ # #To check for the date and values
+ if period_contract_start_date > period_contract_end_date:
+ period_contract_end_date = period_contract_start_date
+ #period_contract_end_date = period_contract_start_date
+
+ period_contract_start_date = str(period_contract_start_date)
+ period_contract_end_date = str(period_contract_end_date)
+
+ payslip_values = {'employee_id':active_contract_brw.employee_id.id,'date_from':period_contract_start_date,'date_to':period_contract_end_date,
+ 'contract_id':active_contract_brw.id,'struct_id':active_contract_brw.struct_id.id,'journal_id':1 }
+
+
+ hr_payslip_brw=hr_payslip.sudo().create(payslip_values)
+
+ res = self.pool.get('hr.payslip').onchange_employee_id(self._cr, self._uid, [], period_contract_start_date, period_contract_end_date,
+ active_contract_brw.employee_id.id, active_contract_brw.id, None)
+ if res and res.get('value'):
+ value = res.get('value')
+ worked_days_line_ids = value.get('worked_days_line_ids')
+ for line_rec in worked_days_line_ids:
+ line_rec.update({'payslip_id':hr_payslip_brw.id})
+ self.env['hr.payslip.worked_days'].create(line_rec)
+ hr_payslip_brw.compute_sheet()
+ for data in hr_payslip_brw.details_by_salary_rule_category:
+ if data.code == "NET":
+ gross_salary = data.total
+ print"gross_salary-------",gross_salary
+ if gross_salary:
+ hr_employee_rec.write({'emp_wage_cal':gross_salary})
+ hr_payslip_brw.unlink()
+
+
+ @api.one
+ def get_active_contract_data(self):
+ """
+ Functional fields to get the data from the currently active contract
+
+ """
+ today_date = datetime.today().date()
+ hr_contract = self.env['hr.contract']
+ # active_contract_brw = self.env['hr.contract'].search([('id','=',1)],limit=1)
+ active_contract_brw = hr_contract.search([('employee_id','=',self.id),('date_start','<=',today_date),'|',('date_end','>=',today_date),('date_end','=',False)],limit=1)
+ if active_contract_brw:
+ self.contract_type = active_contract_brw.type_id.id
+ self.contract_wage = active_contract_brw.wage
+ self.contract_working_hours = active_contract_brw.working_hours
+ self.contract_leaves = active_contract_brw.base_leaves
+ # self.remuneration_incl_ag_costs = round(active_contract_brw.wage*1.25,2)
+ self.remuneration_incl_ag_costs = round(self.emp_wage_cal*1.25,2)
+ self.contract_notes = active_contract_brw.notes
+
+ contract_trial_end_date_condition = False
+ if not active_contract_brw.trial_date_end:
+ contract_trial_end_date_condition = True
+ if active_contract_brw.trial_date_end:
+ trial_date_end = datetime.strptime(active_contract_brw.trial_date_end, DEFAULT_SERVER_DATE_FORMAT).date()
+ if trial_date_end < datetime.today().date():
+ contract_trial_end_date_condition = True
+ if contract_trial_end_date_condition:
+ #search for the new contract
+ new_contracts = hr_contract.search([('employee_id','=',self.id),('date_start','>',active_contract_brw.date_start)],order='date_start')
+ for new_contract in new_contracts:
+ if new_contract.trial_date_end:
+ new_trial_date_end = datetime.strptime(new_contract.trial_date_end, DEFAULT_SERVER_DATE_FORMAT).date()
+ if new_trial_date_end >= datetime.today().date():
+ self.contract_trial_end_date = new_contract.trial_date_end
+ break
+ else:
+ self.contract_trial_end_date = active_contract_brw.trial_date_end
+
+ if self.fte:
+ # self.compensation_at_vz = round(active_contract_brw.wage/self.fte,2)
+ self.compensation_at_vz = round(self.emp_wage_cal/self.fte,2)
+
+ #Add a condition to search for the old contract and check for the change in the contract wage
+ old_contracts = hr_contract.search([('employee_id','=',self.id),('date_start','<',active_contract_brw.date_start)],order='date_start desc')
+ # print"old_contract-------",old_contracts,self.id
+ middel_contracts =[]
+ for old_contract in old_contracts:
+ if old_contract.wage!= active_contract_brw.wage:
+ self.last_contract_changed_wage =old_contract.wage
+ # print"middel------",middel_contracts
+ if middel_contracts:
+ for middel_contract in middel_contracts:
+ if middel_contract.wage != old_contract.wage:
+ self.last_contract_changed_date = middel_contract.date_start
+ # break
+
+ else:
+ self.last_contract_changed_date = active_contract_brw.date_start
+ break
+ else:
+ middel_contracts.append(old_contract)
+
+
+
+ @api.one
+ def _compute_overtime_count(self):
+ """computed field, to calculate overtime from the new field"""
+ emp_overtime_count = 0.0
+ if self.employee_overtime_id:
+ emp_overtime_count = self.employee_overtime_id.emp_overtime_count
+ self.computed_overtime_count = emp_overtime_count
+
+ @api.model
+ def create(self,values):
+ employee_overtime_count = self.env['employee.overtime.count']
+ res = super(itis_hr_employee, self).create(values)
+ for hr_employee in res:
+ emp_count_rec = employee_overtime_count.create({'employee_id':hr_employee.id,'emp_overtime_count':0.0})
+ hr_employee.write({'employee_overtime_id':emp_count_rec.id})
+ return res
+
+
+ @api.model
+ def update_new_overtime_field(self):
+ """ Scheduler, Use to update new overtime field. """
+ employee_overtime_count = self.env['employee.overtime.count']
+ hr_employee = self.env['hr.employee']
+ emp_over_count_recs = employee_overtime_count.search([])
+ if emp_over_count_recs:emp_over_count_recs.unlink()
+ for employee_rec in hr_employee.search([('user_id','!=',False)]):
+ emp_count_rec = employee_overtime_count.create({'employee_id':employee_rec.id,'emp_overtime_count':employee_rec.overtime_count})
+ employee_rec.write({'employee_overtime_id':emp_count_rec.id})
+
+ @api.one
+ def _compute_contract_end_date(self):
+ """this function is to calculate the end date of all the contract when there is end date and no gap in contracts"""
+ contract_end_date = False
+ limitation_reason = False
+ if self:
+ hr_contract_record = self.env['hr.contract'].search([('employee_id','=',self.id)],order='date_end')
+ if hr_contract_record:
+ if len(hr_contract_record) ==1:
+ if hr_contract_record[0].date_end:
+ contract_end_date = hr_contract_record[0].date_end
+ else:
+ end_date=[]
+ for hr_contract_brw in hr_contract_record:
+ if hr_contract_brw.date_end:
+ # end_date.append(hr_contract_brw.date_end) ###---new code
+
+ ###----old code commented
+ next_date_start = datetime.strptime(hr_contract_brw.date_end,DEFAULT_SERVER_DATE_FORMAT).date() + timedelta(days=1)
+ hr_contract_record_new = self.env['hr.contract'].search([('employee_id','=',self.id),('date_start','=',next_date_start)],limit=1)
+ if hr_contract_record_new:
+ if hr_contract_record_new.date_end:
+ end_date.append(hr_contract_record_new.date_end)
+ else:
+ end_date=[]
+ else:
+ end_date.append(hr_contract_brw.date_end)
+ break
+ ###---old code is commented END----##
+ if end_date:
+ end_date.sort(reverse=True)
+ if datetime.strptime(end_date[0],DEFAULT_SERVER_DATE_FORMAT).date() >= datetime.today().date():
+ contract_end_date = end_date[0]
+
+ if contract_end_date:
+ hr_contract_record_new = self.env['hr.contract'].search([('employee_id','=',self.id),('date_end','=',contract_end_date)],limit=1)
+ if hr_contract_record_new:
+ limitation_reason = hr_contract_record_new.limitation_reason
+ # print"contract_end_date------",contract_end_date
+ self.contract_limitation_reason = limitation_reason
+ self.temp_contract_end_date = contract_end_date
+
+ @api.onchange("initial_date")
+ def onchange_initial_date(self):
+ """use to calculate 5 year date for the anniversary when initial date is set"""
+
+ five_year_date =False
+ if self.initial_date:
+ date_start = datetime.strptime(self.initial_date,DEFAULT_SERVER_DATE_FORMAT).date()
+ five_year_date = date_start + relativedelta(years=+5)
+ self.five_years = five_year_date
+
+ @api.one
+ def _compute_last_emp_meeting(self):
+ """
+ This computed function is use to find out the mosta recent employee meeting in the past base on the date
+ :return:meeting id
+
+ """
+ employee_meeting_env ,employee_meeting_brw= self.env['employee.meeting'],False
+ employee_meeting_brw = employee_meeting_env.search([('employee_id','=',self.id),('meeting_date', '<=', datetime.today().date())],order='meeting_date desc')
+ if employee_meeting_brw:employee_meeting_brw=employee_meeting_brw[0]
+ self.last_ma_conversation_date=employee_meeting_brw.meeting_date
+
+ @api.one
+ def _compute_next_emp_meeting(self):
+ """
+ This computed function is use to find out the next employee meeting base on the date
+ :return:meeting id
+ """
+
+ employee_meeting_env ,employee_meeting_brw= self.env['employee.meeting'],False
+ employee_meeting_brw = employee_meeting_env.search([('employee_id','=',self.id),('meeting_date', '>=', datetime.today().date())],order='meeting_date')
+ if employee_meeting_brw:employee_meeting_brw=employee_meeting_brw[0]
+ self.employee_meeting_id=employee_meeting_brw
+
+ @api.one
+ def _compute_next_emp_instruction_meeting(self):
+ """
+ This computed function is use to find out the next employee instruction meeting base on the date
+ :return:instruction meeting id
+ """
+ employee_instruction_env ,employee_instruction_brw= self.env['employee.instruction'],False
+ employee_instruction_brw = employee_instruction_env.search([('employee_id','=',self.id),('meeting_date', '>=', datetime.today().date())],order='meeting_date')
+ if employee_instruction_brw:employee_instruction_brw=employee_instruction_brw[0]
+ self.employee_instruction_id=employee_instruction_brw
+
+ @api.multi
+ def open_ld_change(self):
+ return {
+ 'name': "Last Day Update",
+ 'res_model': 'ot.change',
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'view_type': 'form',
+ 'target': 'new',
+ 'context': {'from_ld_change': True}
+ }
+
+ @api.multi
+ def open_ot_change(self):
+ return {
+ 'name': "Overtime Count Update",
+ 'res_model': 'ot.change',
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'view_type': 'form',
+ 'target': 'new',
+ 'context': {'from_ot_change': True}
+ }
+
+ @api.multi
+ def open_leaved_day_change(self):
+ return {
+ 'name': "Leave Days Update",
+ 'res_model': 'ld.change',
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'view_type': 'form',
+ 'target': 'new',
+ 'context': {'current_year':True}
+ }
+
+ #for SOW17
+ @api.multi
+ def open_nextyear_leaved_day_change(self):
+ """Add a logic to give ability to change leave day for the next year.
+ User can only change it after May month
+ """
+ if datetime.today().month <6:
+ raise Warning(_("You can only change next year leave after May month"))
+ return {
+ 'name': "Next Year Leave Days Update",
+ 'res_model': 'ld.change',
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'view_type': 'form',
+ 'target': 'new',
+ 'context': {'next_year':True}
+ }
+
+ #for SOW17
+ @api.multi
+ def open_nextyear_add_day_change(self):
+ """Add a logic to give ability to change additional leave day for the next year.
+ User can only change it after May month
+ """
+ if datetime.today().month <6:
+ raise Warning(_("You can only change additional leave days for next year after May month"))
+ return {
+ 'name': "Last Day Update",
+ 'res_model': 'ot.change',
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'view_type': 'form',
+ 'target': 'new',
+ 'context': {'from_ld_change': True,'next_year':True}
+ }
+
+ @api.multi
+ def update_overtime_count(self, ot_time, reason):
+
+ # old_ot = self.overtime_count
+ # self.write({'overtime_count': ot_time})
+ old_ot = self.employee_overtime_id.emp_overtime_count
+ self.employee_overtime_id.write({'emp_overtime_count': ot_time})
+ leave_journal_obj = self.env['hr.leave.journal']
+ # ot_change = ot_time - self.overtime_count
+ ot_change = ot_time - self.employee_overtime_id.emp_overtime_count
+ values = {
+ 'employee_id':self.id,
+ 'year': datetime.today().year,
+ 'year_type': 'actual',
+ 'type': 'manual',
+ 'leave_type':'hours',
+ 'leave_days': ot_change,
+ 'name': reason + ' ' + self.name + ' ' + datetime.now().strftime('%d%m%Y %H:%M:%S'),
+ }
+ leave_journal_obj.create(values)
+ msg = _("Overtime has been chagned from %s to %s. Reason : %s") % \
+ (str(old_ot), str(ot_time), reason)
+ self.message_post(body=msg)
+ return True
+
+ @api.multi
+ def update_leave_day(self, leave_day, reason):
+ """Use to update additional leaves"""
+ leave_journal_obj = self.env['hr.leave.journal']
+ old_additional_day = self.additional_leave_days
+ # Added for SOW17
+ if self.env.context.get("next_year", False):
+ year_type = 'next'
+ year = datetime.today().year+1
+ old_additional_day = self.additional_leave_days_ny
+ leave_days = leave_day - self.additional_leave_days_ny
+ else:
+ year_type = 'actual'
+ year = datetime.today().year
+ self.write({'additional_leave_days': leave_day})
+ leave_days = leave_day - self.additional_leave_days
+ values = {
+ 'employee_id':self.id,
+ 'year': year,
+ 'year_type': year_type,
+ 'type': 'additional',
+ 'leave_type':'days',
+ 'leave_days': leave_days,
+ 'name': reason + ' ' + self.name + ' ' + datetime.now().strftime('%d%m%Y %H:%M:%S'),
+ }
+ leave_journal_obj.create(values)
+
+ msg = _("Additional leave has been changed from %s to %s. Reason : %s") % \
+ (str(old_additional_day), str(leave_day), reason)
+ self.message_post(body=msg)
+ return True
+
+ def onchange_department_id(self, cr, uid, ids, department_id, context=None):
+ value = super(itis_hr_employee,self).onchange_department_id(cr, uid, ids, department_id, context=context)
+ value['value']['bereich'] = False
+ if department_id:
+ department = self.pool.get('hr.department').browse(cr, uid, department_id)
+ value['value']['bereich'] = department.parent_id.id
+ return value
+
+ @api.one
+ def _compute_fte(self):
+ contract_obj = self.pool.get('hr.contract')
+ contract_ids = contract_obj.search(self._cr, self._uid, [('employee_id', '=', self.id), ('date_start', '<=', datetime.today().date()), '|', ('date_end', '>=', datetime.today().date()),('date_end','=',False)])
+ if len(contract_ids) < 1:
+ self.fte = 0
+ elif len(contract_ids) > 1:
+ self.fte = 0
+ raise Warning(_("There are 2 contracts assigned to this employee."))
+ else:
+ work_plan = contract_obj.browse(self._cr, self._uid, contract_ids[0]).working_hours
+ weekly_hours = 0.0
+ if not work_plan:
+ self.fte = 0
+ for attendance_id in work_plan.attendance_ids:
+ weekly_hours += attendance_id.hour_to - attendance_id.hour_from
+ icp_obj = self.env['ir.config_parameter'].sudo()
+ fte_base = icp_obj.get_param("fte.base")
+ self.fte = float_round(weekly_hours / float(fte_base), precision_digits = 4)
+
+ #add a logic for the 1stjune scheduler for leave calculation request on SOW17
+ @api.model
+ def june_year_change_calc_days(self):
+ """Use for calculation of the leave day for the next year base on the valid contract"""
+
+ leave_journal_obj = self.env['hr.leave.journal']
+ contract_obj = self.env['hr.contract']
+ error_obj = self.env['itis.leave.days.calc.error']
+ logger.info("---------In the Jun calculation vacation cron--------")
+ year = datetime.today().year #current year #2018
+ next_year = int(year) + 1 #next year #2019
+
+ for employee in self.search([('active','=',True)]):
+ # print('employee--name----',employee.name)
+ contract_ids_unlimited = contract_obj.search([('employee_id','=',employee.id),('date_start','<=',datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')), ('date_end','=',False)])
+ contract_ids_limited = contract_obj.search([('employee_id','=',employee.id),('date_start','<=',datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')), ('date_end', '>=', datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y'))])
+ contract_ids_future = contract_obj.search([('employee_id','=',employee.id),('date_start','>',datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')), '|', ('date_end', '>=', datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')),('date_end','=',False)])
+ error = False
+ #contract_used = False
+ #contract_id_used = False
+ if len(contract_ids_limited) > 1 or len(contract_ids_unlimited) > 1:
+ error = _('Mehr als ein Vertrag zum 01.Januar')
+ elif not contract_ids_future:
+ if not contract_ids_unlimited and len(contract_ids_limited)==1:
+ leave_days_next_year = contract_ids_limited[0].calculate_leave_days(None,next_year)[0]
+ #contract_used = contract_ids_limited[0]
+ elif len(contract_ids_unlimited)==1 and not contract_ids_limited:
+ leave_days_next_year = contract_ids_unlimited[0].calculate_leave_days(None,next_year)[0]
+ #contract_used = contract_ids_unlimited[0]
+ elif len(contract_ids_unlimited) > 0 and len(contract_ids_limited) > 0:
+ error = _('Mehr als ein Vertrag zum 01.Januar')
+ else:
+ error = _('Kein Vertrag am 01.Januar vorhanden')
+ else:
+ if len(contract_ids_unlimited) > 0:
+ error = _('Überschneidende Verträge')
+ elif not contract_ids_limited and len(contract_ids_future) == 1:
+ leave_days_next_year = contract_ids_future[0].calculate_leave_days(None,next_year)[0]
+ #contract_used = contract_ids_future[0]
+ else:
+ answer = self.get_leave_days_from_multiple_contracts(contract_ids_limited.ids or [],contract_ids_future.ids or [],next_year)
+ # print('answer-------',answer)
+ if 'leave_days' in answer:
+ leave_days_next_year = answer['leave_days']
+ elif 'error' in answer:
+ error = answer['error']
+ else:
+ error = _('Fehler in Berechnung')
+ #if contract_used:
+ # contract_id_used = contract_used.id
+ if not error:
+ values_next_year_actual = {
+ 'employee_id': employee.id,
+ 'year': next_year,
+ 'year_type': 'next',
+ 'type': 'calculate',
+ 'leave_type':'days',
+ 'leave_days': leave_days_next_year,
+ 'name': _('Berechnung Urlaub zu Jahresbeginn') + str(datetime.today().date()),
+ #'contract_id': contract_id_used,
+ }
+ leave_journal_obj.create(values_next_year_actual)
+ else:
+ values_error = {
+ 'name': employee.id,
+ 'year': next_year,
+ 'error': error,
+ }
+ error_obj.create(values_error)
+ pass
+
+ @api.model
+ # @api.multi
+ def year_change_calc_days(self):
+ """
+ Imp Note :: This scheduler should run in Dec month.Else remaining leave will have 0 value in it.
+ """
+ leave_journal_obj = self.env['hr.leave.journal']
+ contract_obj = self.env['hr.contract']
+ error_obj = self.env['itis.leave.days.calc.error']
+ logger.info("---------In the year_change_calc_days cron--------")
+
+ if datetime.today().month == 12 or datetime.today().month == 11:
+ year = datetime.today().year
+ else:
+ year = int(datetime.today().year)-1 #2018
+ # year = datetime.today().year
+ next_year = int(year) + 1 #2019
+
+ for employee in self.search([('active','=',True)]):
+ # print('Employee Name-------',employee.name)
+ remaining_leaves = employee.sum_leaves
+ addtional_leave = employee.additional_leave_days_ny
+ contract_leave = employee.leave_days_ny
+
+ remaining_part_leave = 0.0
+ # remaining_part_leave2 = 0.0
+
+ #calculation for the last year leave and total vacation
+ if employee.approved_leaves_ny >0.0: #check for the approved leave is there or not.
+
+ #check there is approve leave till march, if it is there reduce it from remaining leave
+ if employee.approved_leaves_till_march_ny >0.0:
+
+ if remaining_leaves > employee.approved_leaves_till_march_ny:
+ remaining_leaves -=employee.approved_leaves_till_march_ny
+ else: #else get a part of it
+ remaining_part_leave = employee.approved_leaves_till_march_ny-remaining_leaves
+ remaining_leaves = 0.0
+ #
+ # if employee.additional_leave_days_ny >0.0: #check for the additional leave
+ # if remaining_part_leave <=employee.additional_leave_days_ny:
+ # addtional_leave -=remaining_part_leave
+ # remaining_part_leave =0.0
+ # else:
+ # remaining_part_leave = remaining_part_leave - employee.additional_leave_days_ny
+ # addtional_leave =0.0
+ #
+ # contract_leave = employee.leave_days_ny - remaining_part_leave
+
+ #check there is approve leave after march, if it is there add it in the remaining_part_leave
+ if employee.approved_leaves_after_march_ny >0.0:
+ remaining_part_leave += employee.approved_leaves_after_march_ny
+ # if employee.approved_leaves_after_march_ny <=addtional_leave:
+ # addtional_leave -=employee.approved_leaves_after_march_ny
+ # remaining_part_leave2 =0.0
+ # else:
+ # remaining_part_leave2 = employee.approved_leaves_after_march_ny - addtional_leave
+ # addtional_leave =0.0
+ #
+ # contract_leave = contract_leave - remaining_part_leave2
+
+ # print"Additional leave-------",addtional_leave
+ # print"remaining_leaves-------",remaining_leaves
+ # print"contract_leave-------",contract_leave
+ # print"Approve leave-------",remaining_part_leave
+ # print"sum leave----",contract_leave+remaining_leaves+addtional_leave-remaining_part_leave
+
+ #for leave that is remaining in last year carry forward to next year
+ #maintain for current year for info purpose
+ #differentiate by last_year_carry_fwd
+ values = {
+ 'employee_id': employee.id,
+ 'year': year,
+ 'year_type': 'actual',
+ 'type': 'leave',
+ 'leave_type':'days',
+ 'leave_days': employee.sum_leaves,
+ 'last_year_carry_fwd':True,
+ 'name': _('Resturlaub zum Jahreswechsel') + str(datetime.today().date()),
+ }
+ leave_journal_obj.create(values)
+
+ #for leave that is remaining in last year carry forward to next year
+ values_next_year_last = {
+ 'employee_id': employee.id,
+ 'year': next_year,
+ 'year_type': 'last',
+ 'type': 'calculate',
+ 'leave_type':'days',
+ 'leave_days': remaining_leaves,
+ 'name': _('Umwandlung Resturlaub') + str(datetime.today().date()),
+ }
+ leave_journal_obj.create(values_next_year_last)
+
+ #for leave base on contract calculated base on june scheduler values
+ values_next_year_actual = {
+ 'employee_id': employee.id,
+ 'year': next_year,
+ 'year_type': 'actual',
+ 'type': 'calculate',
+ 'leave_type':'days',
+ 'leave_days': contract_leave,
+ 'name': _('Berechnung Urlaub zu Jahresbeginn') + str(datetime.today().date()),
+ }
+ leave_journal_obj.create(values_next_year_actual)
+
+ #to add following year additional leave to current year SOW17
+ if addtional_leave > 0.0:
+ values_next_year_additional = {
+ 'employee_id': employee.id,
+ 'year': next_year,
+ 'year_type': 'actual',
+ 'type': 'additional',
+ 'leave_type':'days',
+ 'leave_days': addtional_leave,
+ 'name': _('Berechnung Urlaub zu Jahresbeginn') + str(datetime.today().date()),
+ }
+ leave_journal_obj.create(values_next_year_additional)
+
+ #for leave approve leave in following year which approve in preceding year carry forward
+ values_next_year_last = {
+ 'employee_id': employee.id,
+ 'year': next_year,
+ 'year_type': 'actual',
+ 'type': 'leave',
+ 'leave_type':'days',
+ 'leave_days': remaining_part_leave,
+ 'name': _('Abgegoltene Urlaubstage') + str(datetime.today().date()),
+ }
+ leave_journal_obj.create(values_next_year_last)
+
+ #To send an email to employee for the remaining leave
+ if remaining_leaves>0.0:
+ template = self.env.ref('itis_hr_extend.email_template_remaining_leave_notification', False)
+ if template:
+ email_cc_list = self.get_cc_emails(employee) #to get a cc email address from hr manager,
+ template.with_context(remaining_leaves=remaining_leaves,email_cc = email_cc_list).send_mail(employee.id)
+
+ # Commented as requested on SOW17
+ # values_next_year_additional = {
+ # 'employee_id': employee.id,
+ # 'year': next_year,
+ # 'year_type': 'actual',
+ # 'type': 'additional',
+ # 'leave_type':'days',
+ # 'leave_days': employee.additional_leave_days,
+ # 'name': _('Berechnung Urlaub zu Jahresbeginn') + str(datetime.today().date()),
+ # }
+ # leave_journal_obj.create(values_next_year_additional)
+
+ #Below logic is commented as it is transfer to the 1st june scheduler SOW17
+ # leave_days_next_year = 0
+ # contract_ids_unlimited = contract_obj.search([('employee_id','=',employee.id),('date_start','<=',datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')), ('date_end','=',False)])
+ # contract_ids_limited = contract_obj.search([('employee_id','=',employee.id),('date_start','<=',datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')), ('date_end', '>=', datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y'))])
+ # contract_ids_future = contract_obj.search([('employee_id','=',employee.id),('date_start','>',datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')), '|', ('date_end', '>=', datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y')),('date_end','=',False)])
+ # error = False
+ # if len(contract_ids_limited) > 1 or len(contract_ids_unlimited) > 1:
+ # error = _('Mehr als ein Vertrag zum 01.Januar')
+ # elif not contract_ids_future:
+ # if not contract_ids_unlimited and len(contract_ids_limited)==1:
+ # leave_days_next_year = contract_ids_limited[0].calculate_leave_days(None,next_year)[0]
+ # elif len(contract_ids_unlimited)==1 and not contract_ids_limited:
+ # leave_days_next_year = contract_ids_unlimited[0].calculate_leave_days(None,next_year)[0]
+ # elif len(contract_ids_unlimited) > 0 and len(contract_ids_limited) > 0:
+ # error = _('Mehr als ein Vertrag zum 01.Januar')
+ # else:
+ # error = _('Kein Vertrag am 01.Januar vorhanden')
+ # else:
+ # if len(contract_ids_unlimited) > 0:
+ # error = _('Überschneidende Verträge')
+ # elif not contract_ids_limited and len(contract_ids_future) == 1:
+ # leave_days_next_year = contract_ids_future[0].calculate_leave_days(None,next_year)[0]
+ # else:
+ # answer = self.get_leave_days_from_multiple_contracts(contract_ids_limited.ids or [],contract_ids_future.ids or [],next_year)
+ # if 'leave_days' in answer:
+ # leave_days_next_year = answer['leave_days']
+ # elif 'error' in answer:
+ # error = answer['error']
+ # else:
+ # error = _('Fehler in Berechnung')
+ # if not error:
+ # values_next_year_actual = {
+ # 'employee_id': employee.id,
+ # 'year': next_year,
+ # 'year_type': 'actual',
+ # 'type': 'calculate',
+ # 'leave_type':'days',
+ # 'leave_days': leave_days_next_year,
+ # 'name': _('Berechnung Urlaub zu Jahresbeginn') + str(datetime.today().date()),
+ # }
+ # leave_journal_obj.create(values_next_year_actual)
+ # else:
+ # values_error = {
+ # 'name': employee.id,
+ # 'year': next_year,
+ # 'error': error,
+ # }
+ # error_obj.create(values_error)
+ return
+
+ @api.model
+ def get_leave_days_from_multiple_contracts(self,contracts1,contracts2,year):
+ contract_obj = self.env['hr.contract']
+ values = {}
+ error = False
+ contracts1.extend(contracts2)
+ contracts = contract_obj.browse(contracts1)
+ if len(contracts) == 1:
+ values['start_date'] = contracts[0].start_date
+ values['end_date'] = contracts[0].start_date
+ leave_days = contracts[0].calculate_leave_days(values,year)[0]
+ elif len(contracts) > 1:
+ contractvalues = {}
+ for contract in contracts:
+ workplan_days = 0
+ weekdays = {}
+ for attendance in contract.working_hours.attendance_ids:
+ if attendance.dayofweek not in weekdays:
+ weekdays[attendance.dayofweek] = True
+ workplan_days = len(weekdays)
+ contractvalues[contract] = {
+ 'date_start' : contract.date_start,
+ 'date_end': contract.date_end,
+ 'workplan_days': workplan_days,
+ 'base_leaves': contract.base_leaves
+ }
+ contractvalues_sorted = sorted(contractvalues.items(), key=lambda x: x[1]['date_start'])
+ date_start = False
+ date_end = False
+ workplan_days = False
+ base_leaves = False
+ for contract in contractvalues_sorted:
+ if not workplan_days:
+ workplan_days = contract[1]['workplan_days']
+ if not base_leaves:
+ base_leaves = contract[1]['base_leaves']
+ if not date_start:
+ date_start = contract[1]['date_start']
+ if not date_end:
+ date_end = contract[1]['date_end']
+ else:
+ if workplan_days == contract[1]['workplan_days']:
+ if base_leaves == contract[1]['base_leaves']:
+ if (datetime.strptime(contract[1]['date_start'], DEFAULT_SERVER_DATE_FORMAT)-datetime.strptime(date_end, DEFAULT_SERVER_DATE_FORMAT)).days ==1:
+ date_end = contract[1]['date_end']
+ else:
+ error = _('Fehler automatische Kalkulation durch keine durchgängigen Arbeitsverträge')
+ break
+ else:
+ error = _('Fehler automatische Kalkulation durch Änderung Urlaubsanspruch')
+ break
+ else:
+ error = _('Fehler automatische Kalkulation durch Änderung Wochenarbeitstage')
+ break
+ if not error:
+ values = {
+ 'date_start':date_start,
+ }
+ leave_days = contract[0].calculate_leave_days(values,year)[0]
+ if error:
+ return{'error':error}
+ else:
+ return {'leave_days':leave_days}
+
+ @api.model
+ def leave_request_state_change(self,employee):
+ year = datetime.today().year
+ leave_to_date = datetime.strptime('31-12-'+str(year),'%d-%m-%Y').date()
+ leave_from_date = datetime.strptime('01-01-'+str(year),'%d-%m-%Y').date()
+ leaves_ids =self.env['hr.holidays'].search([('employee_id','=',employee.id),('state','in',['draft','confirm'])]).ids
+ logger.info("-Employee --------" +str(employee.id))
+ # print'employee----',employee.name
+ # print'leaves_ids----',leaves_ids
+ for leave_id in leaves_ids:
+ leave = self.env['hr.holidays'].browse(leave_id)
+ from_dt = datetime.strptime(leave.date_from, DEFAULT_SERVER_DATETIME_FORMAT).date()
+ to_dt = datetime.strptime(leave.date_to, DEFAULT_SERVER_DATETIME_FORMAT).date()
+ if leave_to_date >= to_dt and leave_from_date <= from_dt:
+
+ if leave.state=='draft':
+ logger.info("-draft------" +str(leave.id))
+ self._cr.execute("update hr_holidays set state = 'cancel' where id = %s",(leave.id,))
+ template = self.env.ref('itis_hr_extend.email_template_draft_leave_cancel', False)
+ if template:
+ email_cc_list = self.get_cc_emails(employee) #to get a cc email address from hr manager,
+ template.with_context(date_from=from_dt,date_to =to_dt,email_cc = email_cc_list).send_mail(leave.id)
+
+ if leave.state =='confirm':
+ logger.info("-confirm------" +str(leave.id))
+ try:
+ if leave.employee_id.parent_id:
+ if leave.employee_id.parent_id.user_id:
+ leave.sudo(user=leave.employee_id.parent_id.user_id.id).holidays_validate()
+ else:
+ leave.holidays_validate()
+ except:
+ pass
+ if leave.state =='validate':
+ template = self.env.ref('itis_hr_extend.email_template_toapprove_leave_approve', False)
+ if template:
+ email_cc_list = self.get_cc_emails(employee) #to get a cc email address from hr manager,
+ template.with_context(date_from=from_dt,date_to =to_dt,email_cc = email_cc_list).send_mail(leave.id)
+
+ @api.model
+ def get_cc_emails(self,employee):
+ groups = [self.env.ref('base.group_hr_manager').id]
+ cc_list = []
+ groups_env = self.env['res.groups']
+ cc_emails=''
+ for group in groups_env.browse(groups):
+ for user in group.users:
+ if user.login and user.email and re.match('[^@]+@[^@]+\.[^@]+', user.login):
+
+ if employee and employee.user_id.id != user.id:
+ cc_list.append(user)
+
+ if employee.parent_id and employee.parent_id.user_id and employee.parent_id.user_id.email:
+ if employee.parent_id.user_id not in cc_list:
+ cc_list.append(employee.parent_id.user_id)
+ # print"CC list--------",cc_list
+ for i in cc_list:
+ cc_emails += i.email+','
+ # print('cc_emails-----',cc_emails)
+ return cc_emails
+
+ @api.model
+ def delete_last_year_leave_days(self):
+ """This scheduler is of no use. Not sure why it is added.
+ I have added a logic for the make draft leave of this year to cancel and to approve leave with approve.
+ Imp Note :: This scheduler should run in Dec month.
+ """
+ leave_journal_obj = self.env['hr.leave.journal']
+ contract_obj = self.env['hr.contract']
+ logger.info("---------In the delete last year leave cron--------")
+ for employee in self.search([]):
+ if not employee.active:
+ continue
+ to_delete_days = employee.leave_days_last_year - employee.approved_leaves
+ if to_delete_days > 0:
+ to_delete_days * -1
+ values = {
+ 'employee_id': employee.id,
+ 'year': datetime.today().year,
+ 'year_type': 'actual',
+ 'type': 'calculate',
+ 'leave_type':'days',
+ 'leave_days': to_delete_days,
+ 'name': _('Verfall Resturlaub') + str(datetime.today().date()),
+ }
+ leave_journal_obj.create(values)
+
+ #function use to make draft leave of last year rejected and to approve with approve state
+ self.leave_request_state_change(employee)
+
+ return
+
+
+class itis_hr_contract(models.Model):
+
+ _inherit = 'hr.contract'
+
+ itis_contract_type = fields.Many2one('itis.contract.type', string="Art")
+ limitation_reason = fields.Many2one('itis_limitation_reason', string="Befristungsgrund")
+ base_leaves = fields.Float(string="Urlaubsanspruch", default="20")
+
+class itis_hr_department(models.Model):
+
+ _inherit = 'hr.department'
+
+ planned_fte = fields.Float('Planned FTE')
+ account_id = fields.Many2one('account.analytic.account',string="Analytic Account")
+
+ def name_get(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ if not ids:
+ return []
+ reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
+ res = []
+ for record in reads:
+ name = record['name']
+ # if record['parent_id']:
+ # name = record['parent_id'][1]+' / '+name
+ res.append((record['id'], name))
+ return res
+
+
+class itis_leave_days_calc_error(models.Model):
+ _name = 'itis.leave.days.calc.error'
+
+ name = fields.Many2one('hr.employee', string='Mitarbeiter')
+ year = fields.Integer(string='Jahr')
+ error = fields.Char(string='Fehlermeldung')
+
+class MyFilter(parent_controller.DataSet):
+
+ @http.route(['/web/dataset/call_kw', '/web/dataset/call_kw/'], type='json', auth="user")
+ def call_kw(self, model, method, args, kwargs, path=None):
+ return_value = self._call_kw(model, method, args, kwargs)
+ if model == "hr.employee":
+ cr, uid, context = request.cr, request.uid, request.context
+ if isinstance(return_value,list):
+ for data in return_value:
+ if isinstance(data,dict):
+ if data.get("message_ids",False):
+ res_users_obj = request.registry["res.users"]
+ ir_model_obj = request.registry["ir.model.data"]
+ res_user_data = res_users_obj.browse(cr,uid,[uid],context)
+ xml_list = []
+ group_ids = []
+ for group in res_user_data.groups_id:
+ group_ids.append(group.id)
+ model_ids = ir_model_obj.search(cr,uid,[['model','=','res.groups'],['res_id','in',group_ids]],0,False,False,context)
+ model_data = ir_model_obj.browse(cr,uid,model_ids,context)
+ for value in model_data:
+ xml_list.append(value.name)
+ if "group_hr_manager" in xml_list or "group_hr_payroll_manager" in xml_list or "group_hr_user" in xml_list or uid == 1:
+ continue
+ else:
+ data["message_ids"] = []
+
+ return return_value
diff --git a/itis_hr_extend/models/hr_holiday.py b/itis_hr_extend/models/hr_holiday.py
new file mode 100644
index 0000000..324ba7c
--- /dev/null
+++ b/itis_hr_extend/models/hr_holiday.py
@@ -0,0 +1,662 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from datetime import datetime, timedelta
+from openerp.exceptions import Warning
+from openerp import SUPERUSER_ID
+from openerp import tools
+from openerp.osv import osv
+import math
+
+class HRHoliday(models.Model):
+
+ _inherit = "hr.holidays"
+
+ is_ot_leave = fields.Boolean(string="Is OT Leave")
+ leave_hours = fields.Float(string="Leave Hours", compute='calc_leave_hours')
+ ot_hours = fields.Float(string="Overtime Count", compute="calc_ot_count")
+ sum_leaves = fields.Float(string="Gesamtanspruch", compute='calc_sum_leaves')
+ # for SOW17
+ sum_leaves_ny = fields.Float(string="Next Year Remaining Leaves", compute='calc_ny_sum_leaves')
+ number_of_days_temp_ny = fields.Float(string="Next Year Days", compute='calc_number_of_days_temp_ny')
+
+ approved_by = fields.Many2one("res.users", string='Approved/Refuse By')
+ approved_at = fields.Datetime(string="Approved/Refuse At")
+ ljournal_ids = fields.One2many("hr.leave.journal", "leave_id")
+
+ leave_selection = fields.Selection([('full_day','Full Day'),('half_day','Half Day')], string="Leave Selection",default="full_day")
+ leave_selection_date_to = fields.Selection([('full_day','Full Day'),('half_day','Half Day')], string="Leave Selection",default="full_day")
+ half_day_type = fields.Selection([('morning','Morning'),('afternoon','Afternoon')], string="Half Day Type")
+ half_day_type_date_to = fields.Selection([('morning','Morning'),('afternoon','Afternoon')], string="Half Day Type")
+ leave_sele_dateto_flag = fields.Boolean(string='Date to Flag')
+
+ def onchange_date_from(self, cr, uid, ids, date_to, date_from):
+ """
+ If there are no date set for date_to, automatically set one 8 hours later than
+ the date_from.
+ """
+ # date_to has to be greater than date_from
+ # if (date_from and date_to) and (date_from > date_to):
+ # raise osv.except_osv(_('Warning!'),_('The start date must be anterior to the end date.111'))
+
+ result = {'value': {}}
+ # No date_to set so far: automatically compute one 8 hours later
+ if date_from and not date_to:
+ date_to_with_delta = datetime.strptime(date_from, tools.DEFAULT_SERVER_DATETIME_FORMAT) + timedelta(hours=8)
+ result['value']['date_to'] = str(date_to_with_delta)
+
+ if date_from and date_to:
+ DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
+ from_dt = datetime.strptime(date_from, DATETIME_FORMAT).date()
+ to_dt = datetime.strptime(date_to, DATETIME_FORMAT).date()
+ if from_dt == to_dt:
+ result['value']['leave_sele_dateto_flag'] =True
+ else:
+ result['value']['leave_sele_dateto_flag'] =False
+
+ date_from = datetime.strptime(date_from,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')+' 09:00:00'
+ date_to = datetime.strptime(date_to,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')+' 18:00:00'
+
+ # Compute and update the number of days
+ if date_from <= date_to:
+ diff_day = self._get_number_of_days(date_from, date_to)
+ result['value']['number_of_days_temp'] = round(math.floor(diff_day))+1
+ else:
+ result['value']['number_of_days_temp'] = 0
+ else:
+ result['value']['number_of_days_temp'] = 0
+
+ return result
+
+ def onchange_date_to(self, cr, uid, ids, date_to, date_from):
+ """
+ Update the number_of_days.
+ """
+ # date_to has to be greater than date_from
+ # if (date_from and date_to) and (date_from > date_to):
+ # raise osv.except_osv(_('Warning!'),_('The start date must be anterior to the end date.'))
+
+ result = {'value': {}}
+
+ if date_from and date_to:
+ DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
+ from_dt = datetime.strptime(date_from, DATETIME_FORMAT).date()
+ to_dt = datetime.strptime(date_to, DATETIME_FORMAT).date()
+ if from_dt == to_dt:
+ result['value']['leave_sele_dateto_flag'] =True
+ else:
+ result['value']['leave_sele_dateto_flag'] =False
+ date_from = datetime.strptime(date_from,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')+' 09:00:00'
+ date_to = datetime.strptime(date_to,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')+' 18:00:00'
+ # Compute and update the number of days
+ if date_from <= date_to:
+
+ diff_day = self._get_number_of_days(date_from, date_to)
+ result['value']['number_of_days_temp'] = round(math.floor(diff_day))+1
+ else:
+ result['value']['number_of_days_temp'] = 0
+ else:
+ result['value']['number_of_days_temp'] = 0
+
+ return result
+
+ def check_holidays(self, cr, uid, ids, context=None):
+ return True
+
+ def check_holidays2(self, cr, uid, ids, context=None):
+ for record in self.browse(cr, uid, ids, context=context):
+ if record.holiday_type != 'employee' or record.type != 'remove' or not record.employee_id or record.holiday_status_id.limit:
+ continue
+ if record.is_ot_leave:
+ continue
+# if record.sum_leaves < record.number_of_days_temp:
+# for SOW17
+ year = datetime.today().year
+
+ #for SOW17 testing
+ for_sow17 = self.pool.get('res.company').search(cr, uid,[('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ for_sow17 = self.pool.get('res.company').browse(cr,uid,for_sow17)
+ year = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().year
+
+ next_year = year+1
+ date_from_year = datetime.strptime(record.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year
+ date_to_year = datetime.strptime(record.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year
+
+ #warning for the same year leave
+ if date_from_year != date_to_year:
+ raise Warning(_("Please create a leave request for every year."))
+
+ if date_from_year == next_year+1:
+ raise Warning(_('You are not allow to apply leave for the year after next'))
+
+ #warning when user didn't have next year contact or next year vacation
+ if date_from_year == next_year and record.sum_leaves_ny==0.0:
+ raise Warning(_('The number of next year remaining leaves is not sufficient for this leave type.\n'
+ 'Please verify also the leaves waiting for validation.'))
+
+ if record.number_of_days_temp_ny==0.0:#for current year warning
+ if record.sum_leaves < record.number_of_days_temp:
+ # Raising a warning gives a more user-friendly feedback than the default constraint error
+ raise Warning(_('The number of remaining leaves is not sufficient for this leave type.\n'
+ 'Please verify also the leaves waiting for validation.'))
+ else:#next year warning
+ if record.sum_leaves_ny < record.number_of_days_temp_ny:
+ raise Warning(_('The number of next year remaining leaves is not sufficient for this leave type.\n'
+ 'Please verify also the leaves waiting for validation.'))
+ return True
+
+ def _check_date(self, cr, uid, ids, context=None):
+ for holiday in self.browse(cr, uid, ids, context=context):
+ domain = [
+ ('date_from', '<=', holiday.date_to),
+ ('date_to', '>=', holiday.date_from),
+ ('employee_id', '=', holiday.employee_id.id),
+ ('id', '!=', holiday.id),
+ ('state', 'not in', ['cancel', 'refuse']),
+ ('holiday_status_id','!=','Holiday')
+ ]
+ nholidays = self.search_count(cr, uid, domain, context=context)
+ if nholidays:
+ return False
+ return True
+
+ _constraints = [
+ (_check_date, 'You can not have 2 leaves that overlaps on same day!', ['date_from','date_to'])
+ ]
+
+ def write(self, cr, uid, ids, values, context=None):
+ if not context: context = {}
+ grp_hr_rec = self.pool.get("ir.model.data").xmlid_to_object(cr, SUPERUSER_ID, "base.group_hr_user")
+ hr_usr_id = False
+ if 'date_from' in values or 'date_to' in values:
+ self.check_holidays2(cr,uid,ids,context=context)
+ for usr in grp_hr_rec.users:
+ hr_usr_id = usr.id
+ break
+ if not hr_usr_id:
+ hr_usr_id = SUPERUSER_ID
+ context.update({'hr_uid':uid})
+ return super(HRHoliday, self).write(cr, hr_usr_id, ids, values, context=context)
+
+ @api.multi
+ @api.onchange("employee_id")
+ @api.depends("employee_id")
+ def calc_sum_leaves(self):
+ for record in self:
+ record.sum_leaves = record.employee_id.sum_leaves
+
+ # for SOW17
+ @api.multi
+ @api.onchange("employee_id")
+ @api.depends("employee_id")
+ def calc_ny_sum_leaves(self):
+ for record in self:
+ record.sum_leaves_ny = record.employee_id.sum_leaves_ny
+ return {}
+
+ @api.onchange("number_of_days_temp")
+ @api.depends("number_of_days_temp")
+ def calc_number_of_days_temp_ny(self):
+ for record in self:
+ res = 0
+ if not record.date_from or not record.date_to:
+ return {}
+ date_from = datetime.strptime(record.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ date_to = datetime.strptime(record.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ today_date = datetime.today().date()
+
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ today_date = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date()
+
+ temp_date = date_from
+ while temp_date <= date_to:
+ holiday = None
+ holiday = self.env['itis.holiday'].search([('date', '=', temp_date)])
+ if holiday:
+ temp_date += timedelta(days=1)
+ continue
+ if today_date.year == temp_date.year:
+ temp_date += timedelta(days=1)
+ continue
+ weekday = temp_date.weekday()
+ for contract in record.employee_id.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ if record.get_hours(weekday, contract.working_hours.attendance_ids) > 0.0:
+ if temp_date == date_from and record.leave_selection =='half_day':
+ res += 0.5
+ break
+ if temp_date == date_to and record.leave_selection_date_to =='half_day':
+ res += 0.5
+ break
+ res += 1
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+ # cont_end_date += timedelta(days=1)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ if record.get_hours(weekday, contract.working_hours.attendance_ids) > 0.0:
+ if temp_date == date_from and record.leave_selection =='half_day':
+ res += 0.5
+ break
+ if temp_date == date_to and record.leave_selection_date_to =='half_day':
+ res += 0.5
+ break
+ res += 1
+ temp_date += timedelta(days=1)
+ record.number_of_days_temp_ny = res
+
+ #END
+
+ @api.multi
+ @api.onchange("employee_id")
+ @api.depends("employee_id")
+ def calc_ot_count(self):
+ for record in self:
+ # self.ot_hours = self.employee_id.overtime_count
+ record.ot_hours = record.employee_id.employee_overtime_id.emp_overtime_count
+ return {}
+
+ @api.multi
+ def holidays_refuse(self):
+ if self.env.user.id != self.employee_id.parent_id.user_id.id:
+ raise Warning(_('Only the Manager of this employee can approve this leave request.'))
+ if self.is_ot_leave:
+ if self.state in ['validate', 'validate1']:
+ new_ot = self.ot_hours + self.leave_hours
+ # self.employee_id.sudo().write({'overtime_count': new_ot})
+ self.employee_id.sudo().employee_overtime_id.write({'emp_overtime_count': new_ot})
+ self.write({"approved_by": self.env.user.id, 'approved_at': datetime.strftime(datetime.today(), DEFAULT_SERVER_DATETIME_FORMAT)})
+ for leave_journal_entry in self.ljournal_ids:
+ leave_journal_entry.unlink()
+ nextyear_leave_data = self.env['hr.leave.nextyear'].search([('holiday_id','=',self.id),('employee_id','=',self.employee_id.id)])
+ print'nextyear_leave_data------',nextyear_leave_data
+ if nextyear_leave_data:
+ nextyear_leave_data.unlink()
+ return super(HRHoliday, self).holidays_refuse()
+
+ def holidays_validate_old(self, cr, uid, ids, context=None):
+ obj_emp = self.pool.get('hr.employee')
+ ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
+ manager = ids2 and ids2[0] or False
+ self.write(cr, uid, ids, {'state':'validate'})
+ data_holiday = self.browse(cr, uid, ids)
+ for record in data_holiday:
+ if record.double_validation:
+ self.write(cr, uid, [record.id], {'manager_id2': manager})
+ else:
+ self.write(cr, uid, [record.id], {'manager_id': manager})
+ if record.holiday_type == 'employee' and record.type == 'remove':
+ meeting_obj = self.pool.get('calendar.event')
+
+ # to check for the existing calender events for this type
+ if record.meeting_id:
+ self._create_resource_leave(cr, uid, [record], context=context)
+ meeting_obj.write(cr, uid, record.meeting_id, {'name': record.name or _('Leave Request'),})
+ else:
+ meeting_vals = {
+ 'name': record.name or _('Leave Request'),
+ 'categ_ids': record.holiday_status_id.categ_id and [(6,0,[record.holiday_status_id.categ_id.id])] or [],
+ 'duration': record.number_of_days_temp * 8,
+ 'description': record.notes,
+ 'user_id': record.user_id.id,
+ 'start': record.date_from,
+ 'stop': record.date_to,
+ 'allday': False,
+ 'state': 'open', # to block that meeting date in the calendar
+ 'class': 'confidential'
+ }
+ #Add the partner_id (if exist) as an attendee
+ if record.user_id and record.user_id.partner_id:
+ meeting_vals['partner_ids'] = [(4,record.user_id.partner_id.id)]
+
+ ctx_no_email = dict(context or {}, no_email=True)
+ meeting_id = meeting_obj.create(cr, uid, meeting_vals, context=ctx_no_email)
+ self._create_resource_leave(cr, uid, [record], context=context)
+ self.write(cr, uid, ids, {'meeting_id': meeting_id})
+ elif record.holiday_type == 'category':
+ emp_ids = obj_emp.search(cr, uid, [('category_ids', 'child_of', [record.category_id.id])])
+ leave_ids = []
+ batch_context = dict(context, mail_notify_force_send=False)
+ for emp in obj_emp.browse(cr, uid, emp_ids, context=context):
+ vals = {
+ 'name': record.name,
+ 'type': record.type,
+ 'holiday_type': 'employee',
+ 'holiday_status_id': record.holiday_status_id.id,
+ 'date_from': record.date_from,
+ 'date_to': record.date_to,
+ 'notes': record.notes,
+ 'number_of_days_temp': record.number_of_days_temp,
+ 'parent_id': record.id,
+ 'employee_id': emp.id
+ }
+ leave_ids.append(self.create(cr, uid, vals, context=batch_context))
+ for leave_id in leave_ids:
+ # TODO is it necessary to interleave the calls?
+ for sig in ('confirm', 'validate', 'second_validate'):
+ self.signal_workflow(cr, uid, [leave_id], sig)
+ return True
+ @api.multi
+ def holidays_validate(self):
+ for record in self:
+ if self.env.user.id != record.employee_id.parent_id.user_id.id:
+ raise Warning(_('Only the Manager of this employee can approve this leave request.'))
+ if record.is_ot_leave:
+ # commented function customer wants to approve leaves to actual ot_count.
+ # User can have positive actual ot count at the end of the month, although the ot_count at employee is negative,
+ # because it is updated one time a month only.
+ # if self.ot_hours < self.leave_hours:
+ # raise Warning(_('The number of overtime count is not sufficient for Overtime leave.'))
+ new_ot = record.ot_hours - record.leave_hours
+ # self.employee_id.sudo().write({'overtime_count': new_ot})
+ record.employee_id.sudo().employee_overtime_id.write({'emp_overtime_count': new_ot})
+ self.check_holidays2()
+ self.create_leave_journal_entry()
+ self.create_nextyear_leave_entry() #new added.to store the leave data for the next year which will be use for main dec scheduler
+ self.write({"approved_by": self.env.user.id, 'approved_at': datetime.strftime(datetime.today(), DEFAULT_SERVER_DATETIME_FORMAT)})
+ return self.holidays_validate_old()
+
+ def create_nextyear_leave_entry(self):
+ """new added.to store the leave data for the next year which will be use for main dec scheduler
+ """
+ for record in self:
+ year = datetime.today().year
+
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ year = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().year
+
+ next_year = year+1
+ date_from = datetime.strptime(record.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ date_to = datetime.strptime(record.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+
+ if date_from.year == next_year:
+ date_data_dict = record.get_date_data(date_from,date_to)
+ # print"date_data_dict------",date_data_dict
+ for date, day_amt in date_data_dict.iteritems():
+ nextyear_leave_vals={'date':date,'leave_days':day_amt,'employee_id':record.employee_id.id,'holiday_id':record.id}
+ self.env['hr.leave.nextyear'].create(nextyear_leave_vals)
+
+
+ def get_date_data(self,date_from,date_to):
+ """Subfunction of the above function(create_nextyear_leave_entry)"""
+ today_date = datetime.today().date()
+ temp_date = date_from
+ date_data_dict={}
+ while temp_date <= date_to:
+ holiday = None
+ holiday = self.env['itis.holiday'].search([('date', '=', temp_date)])
+ if holiday:
+ temp_date += timedelta(days=1)
+ continue
+ if today_date.year == temp_date.year:
+ temp_date += timedelta(days=1)
+ continue
+ weekday = temp_date.weekday()
+ for contract in self.employee_id.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ if self.get_hours(weekday, contract.working_hours.attendance_ids) > 0.0:
+ if temp_date == date_from and self.leave_selection =='half_day':
+ date_data_dict[temp_date] =0.5
+ break
+ if temp_date == date_to and self.leave_selection_date_to =='half_day':
+ date_data_dict[temp_date] =0.5
+ break
+ date_data_dict[temp_date] =1
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+# cont_end_date += timedelta(days=1)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ if self.get_hours(weekday, contract.working_hours.attendance_ids) > 0.0:
+ if temp_date == date_from and self.leave_selection =='half_day':
+ date_data_dict[temp_date] =0.5
+ break
+ if temp_date == date_to and self.leave_selection_date_to =='half_day':
+ date_data_dict[temp_date] =0.5
+ break
+ date_data_dict[temp_date] =1
+ temp_date += timedelta(days=1)
+ return date_data_dict
+
+
+ def check_same_day(self, date_from, date_to):
+ return date_from.date() == date_to.date()
+
+ @api.depends("date_from", "date_to", 'is_ot_leave', 'leave_selection', 'leave_selection_date_to')
+ def calc_leave_hours(self):
+ for record in self:
+ if not record.is_ot_leave:
+ return True
+ if not record.date_from or not record.date_to:
+ return True
+ date_from = datetime.strptime(record.date_from, DEFAULT_SERVER_DATETIME_FORMAT)
+ date_to = datetime.strptime(record.date_to, DEFAULT_SERVER_DATETIME_FORMAT)
+ same_day = record.check_same_day(date_from, date_to)
+ temp_date = date_from
+ day_hours = 0.0
+
+ date_from = datetime.strptime(record.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ date_to = datetime.strptime(record.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ temp_date = date_from
+ #temp_date += timedelta(days=1)
+ while temp_date <= date_to:
+ holiday = self.env['itis.holiday'].search([('date', '=', temp_date)])
+ if holiday:
+ temp_date += timedelta(days=1)
+ continue
+ weekday = temp_date.weekday()
+ for contract in record.employee_id.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ if (temp_date==date_from and record.leave_selection == 'half_day') or (temp_date.date()==date_from.date() and record.leave_selection_date_to == 'half_day'):
+ day_hours += record.get_hours(weekday, contract.working_hours.attendance_ids)/2
+ else:
+ day_hours += record.get_hours(weekday, contract.working_hours.attendance_ids)
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ if (temp_date==date_from and record.leave_selection == 'half_day') or (temp_date.date()==date_from.date() and record.leave_selection_date_to == 'half_day'):
+ day_hours += record.get_hours(weekday, contract.working_hours.attendance_ids)/2
+ else:
+ day_hours += record.get_hours(weekday, contract.working_hours.attendance_ids)
+
+ temp_date += timedelta(days=1)
+ # print"day_hours-----",day_hours
+ record.leave_hours = day_hours
+ return True
+
+ def get_day_hours(self, date_from, atten_ids):
+ weekday = date_from.weekday()
+ res = self.get_hours(weekday, atten_ids)
+ return res
+
+ def get_hours(self, weekday, atten_ids):
+ res = 0.0
+ for atten in atten_ids:
+ if int(atten.dayofweek) == weekday:
+ res += atten.hour_to - atten.hour_from
+ return res
+
+ @api.onchange("holiday_status_id")
+ def onchange_holiday_status_id(self):
+ ot_leave_rec = self.env['ir.model.data'].xmlid_to_object('itis_hr_extend.itis_leave_overtime')
+ if ot_leave_rec.id == self.holiday_status_id.id:
+ self.is_ot_leave = True
+ else:
+ self.is_ot_leave = False
+ return {}
+
+
+ #for SOW17, Made some changes in existing function
+ def create_leave_journal_entry(self):
+ leave_journal_obj = self.env['hr.leave.journal']
+
+ if self.is_ot_leave:
+ leave_type = 'hours'
+ year = datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year
+ if year != datetime.strptime(self.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year:
+ raise Warning(_("Please create a leave request for every year."))
+
+ values = {
+ 'year': year,
+ 'year_type': 'actual',
+ 'type': 'leave',
+ 'leave_type': leave_type,
+ 'leave_days': self.number_of_days_temp,
+ 'leave_hours': self.leave_hours,
+ 'name': self.name,
+ 'employee_id': self.employee_id.id,
+ 'leave_start': self.date_from,
+ 'leave_end': self.date_to,
+ 'leave_id': self.id
+ }
+ ljournal_id = leave_journal_obj.create(values)
+ else:
+ leave_type = 'days'
+ year = datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year
+ if year != datetime.strptime(self.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year:
+ raise Warning(_("Please create a leave request for every year."))
+
+ if self.number_of_days_temp_ny ==0.0: #when leave is apply for the current ongoing year
+ yeartype = self.get_year_type()
+ print"yeartype------",yeartype
+ if len(yeartype)==2 or len(yeartype)==4:
+ leave_days = yeartype[1]
+ values = {
+ 'year': year,
+ 'year_type': yeartype[0],
+ 'type': 'leave',
+ 'leave_type': leave_type,
+ 'leave_days': leave_days,
+ 'name': self.name,
+ 'employee_id': self.employee_id.id,
+ 'leave_id': self.id
+ }
+ leave_journal_obj.create(values)
+
+ if len(yeartype)==4:
+ leave_days = yeartype[3]
+ values = {
+ 'year': year,
+ 'year_type': yeartype[2],
+ 'type': 'leave',
+ 'leave_type': leave_type,
+ 'leave_days': leave_days,
+ 'name': self.name,
+ 'employee_id': self.employee_id.id,
+ 'leave_id': self.id
+ }
+ leave_journal_obj.create(values)
+ else:#when there is next year leave in current year
+ #------create an next leave for the next year----#
+ c_year = datetime.today().date().year
+ values = {
+ 'year': c_year+1,
+ 'year_type': 'next',
+ 'type': 'leave',
+ 'leave_type': leave_type,
+ 'leave_days': self.number_of_days_temp_ny,
+ 'name': self.name,
+ 'employee_id': self.employee_id.id,
+ 'leave_id': self.id
+ }
+ leave_journal_obj.create(values)
+
+ def get_year_type(self):
+ if datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT) >= datetime.strptime('01-04-'+str(datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year),'%d-%m-%Y'):
+ return ['actual',self.number_of_days_temp]
+ elif datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT) <= datetime.strptime('31-03-'+str(datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year),'%d-%m-%Y'):
+ if self.employee_id.leave_days_last_year >= self.number_of_days_temp:
+ return ['last',self.number_of_days_temp]
+ elif self.employee_id.leave_days_last_year > 0:
+ return ['last', self.employee_id.leave_days_last_year,'actual',self.number_of_days_temp-self.employee_id.leave_days_last_year]
+ else:
+ return ['actual',self.number_of_days_temp]
+
+ # for SOW17 commented this
+ # def create_leave_journal_entry(self):
+ # leave_journal_obj = self.env['hr.leave.journal']
+ #
+ # if self.is_ot_leave:
+ # leave_type = 'hours'
+ # year = datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year
+ # if year != datetime.strptime(self.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year:
+ # raise Warning(_("Please create a leave request for every year."))
+ #
+ # values = {
+ # 'year': year,
+ # 'year_type': 'actual',
+ # 'type': 'leave',
+ # 'leave_type': leave_type,
+ # 'leave_days': self.number_of_days_temp,
+ # 'leave_hours': self.leave_hours,
+ # 'name': self.name,
+ # 'employee_id': self.employee_id.id,
+ # 'leave_start': self.date_from,
+ # 'leave_end': self.date_to,
+ # 'leave_id': self.id
+ # }
+ # ljournal_id = leave_journal_obj.create(values)
+ # else:
+ # leave_type = 'days'
+ # year = datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year
+ # if year != datetime.strptime(self.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year:
+ # raise Warning(_("Please create a leave request for every year."))
+ # yeartype = self.get_year_type()
+ # if len(yeartype)==2 or len(yeartype)==4:
+ # leave_days = yeartype[1]
+ # values = {
+ # 'year': year,
+ # 'year_type': yeartype[0],
+ # 'type': 'leave',
+ # 'leave_type': leave_type,
+ # 'leave_days': leave_days,
+ # 'name': self.name,
+ # 'employee_id': self.employee_id.id,
+ # 'leave_id': self.id
+ # }
+ # leave_journal_obj.create(values)
+ #
+ # if len(yeartype)==4:
+ # leave_days = yeartype[3]
+ # values = {
+ # 'year': year,
+ # 'year_type': yeartype[2],
+ # 'type': 'leave',
+ # 'leave_type': leave_type,
+ # 'leave_days': leave_days,
+ # 'name': self.name,
+ # 'employee_id': self.employee_id.id,
+ # 'leave_id': self.id
+ # }
+ # leave_journal_obj.create(values)
diff --git a/itis_hr_extend/models/hr_leave.py b/itis_hr_extend/models/hr_leave.py
new file mode 100644
index 0000000..8e36433
--- /dev/null
+++ b/itis_hr_extend/models/hr_leave.py
@@ -0,0 +1,406 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.tools import float_round
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from datetime import datetime, timedelta
+from calendar import monthrange
+from openerp.exceptions import Warning
+import pdb
+
+
+class HRHolidayStatus(models.Model):
+
+ _inherit = "hr.holidays.status"
+
+ is_holiday = fields.Boolean(string='Is holiday Type')
+ is_sick_leave_type = fields.Boolean(string='Is Sick Leave Type')
+
+class HRLeaveNextYear(models.Model):
+
+ _name = "hr.leave.nextyear"
+
+ date = fields.Date('Date')
+ holiday_id = fields.Many2one("hr.holidays", "Holiday")
+ employee_id = fields.Many2one('hr.employee')
+ leave_days = fields.Float('Tage')
+
+class HRLeaveJournal(models.Model):
+
+ _name = "hr.leave.journal"
+ _order = "year desc"
+
+ name = fields.Char("Begründung")
+ employee_id = fields.Many2one('hr.employee')
+ year = fields.Integer('Jahr')
+ # year_type = fields.Selection([('actual','aktuell'),('last','Restanspruch')])
+
+ #added for the SOW17
+ year_type = fields.Selection([('actual','aktuell'),('last','Restanspruch'),('next','next')])
+
+ type = fields.Selection([('calculate','Vertraglich'),('leave','Ausgleich'),('manual','Manuell'),('additional','Zusatzurlaub')])
+ leave_type = fields.Selection([('days','Tage'),('hours','Stunden')])
+ leave_start = fields.Date('von')
+ leave_end = fields.Date('bis')
+ leave_days = fields.Float('Tage')
+ leave_hours = fields.Float('Stunden')
+ description = fields.Char('Begründung')
+ contract_id = fields.Many2one('hr.contract')
+ last_year_carry_fwd = fields.Boolean('Last Year Carry Fwd Info')
+ leave_id = fields.Many2one('hr.holidays')
+
+
+class HREmployee(models.Model):
+
+ _inherit = "hr.employee"
+
+ leave_days = fields.Float('Urlaubstage', compute="calculate_actual_year_leave_days")
+ leave_days_last_year = fields.Float('Resturlaub', compute="calculate_last_year_leave_days")
+ additional_leave_days = fields.Float('Zusatzurlaub', compute="calculate_additional_leave_days")
+ sum_leaves = fields.Float('Gesamtanspruch', compute="_calculate_sum_leaves")
+ sum_journal_entries = fields.Integer('Anzahl Journaleinträge', compute="_calculate_sum_journal_entries")
+ leave_journal_ids = fields.One2many('hr.leave.journal','employee_id')
+
+ approved_leaves = fields.Float('abgegoltene Urlaubstage', compute="_calculate_approved_leave_days")
+
+ #added new field for the following year june1st SOW17
+ leave_days_ny = fields.Float('Leaves Following Year', compute="calculate_nextyear_leave_days")
+ additional_leave_days_ny = fields.Float('Addtional Leaves Following Year', compute="calculate_nextyear_additional_leave_days")
+ approved_leaves_ny = fields.Float('Approve Leaves Following Year', compute="_calculate_nextyear_approved_leave_days")
+ sum_leaves_ny = fields.Float('Remaining Leaves Following Year', compute="_calculate_nextyear_sum_leaves")
+
+ #added to maintain data for next year so it will be use for dec scheduler
+ nextyear_leave_ids = fields.One2many('hr.leave.nextyear','employee_id')
+ approved_leaves_till_march_ny = fields.Float('Approve Leaves Till March', compute="_calculate_nextyear_approved_leave_days_march")
+ approved_leaves_after_march_ny = fields.Float('Approve Leaves After March', compute="_calculate_nextyear_approved_leave_days_aft_march")
+
+ #added field to display remaining leaves of last year based on journal entries from that year
+ last_year_remaining_leaves = fields.Float('Resturlaub Vorjahr (Zum Jahreswechsel)', compute="calculate_last_year_remaining_leaves")
+
+
+ @api.one
+ def _calculate_nextyear_approved_leave_days_march(self):
+ leave_days = 0
+ next_year = datetime.today().year+1
+ period_date_start = datetime.strptime('01-01-'+str(next_year),'%d-%m-%Y').date()
+ period_date_end = datetime.strptime('01-04-'+str(next_year),'%d-%m-%Y').date()
+ for nextyear_leave in self.nextyear_leave_ids:
+ leave_date = datetime.strptime(nextyear_leave.date,DEFAULT_SERVER_DATE_FORMAT).date()
+ if leave_date >=period_date_start and leave_date < period_date_end:
+ leave_days +=nextyear_leave.leave_days
+ self.approved_leaves_till_march_ny = leave_days
+
+ @api.one
+ def _calculate_nextyear_approved_leave_days_aft_march(self):
+ leave_days = 0
+ next_year = datetime.today().year+1
+ period_date_start = datetime.strptime('01-04-'+str(next_year),'%d-%m-%Y').date()
+ period_date_end = datetime.strptime('31-12-'+str(next_year),'%d-%m-%Y').date()
+ for nextyear_leave in self.nextyear_leave_ids:
+ leave_date = datetime.strptime(nextyear_leave.date,DEFAULT_SERVER_DATE_FORMAT).date()
+ if leave_date >=period_date_start and leave_date <= period_date_end:
+ leave_days +=nextyear_leave.leave_days
+ self.approved_leaves_after_march_ny = leave_days
+
+
+ #added new functions for the following year june1st SOW17
+ @api.one
+ def calculate_nextyear_leave_days(self):
+ today_date = datetime.today().date()
+
+ # for sow17
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ today_date = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date()
+
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year_type =='next':# condtion to check year type as next
+
+ period_date_start = datetime.strptime('01-06-'+str(leave_id.year-1),'%d-%m-%Y').date()
+ period_date_end = datetime.strptime('01-01-'+str(leave_id.year),'%d-%m-%Y').date()
+ if today_date >=period_date_start and today_date < period_date_end:
+ # condition to display value from 01-06-2018 to 03-01-2019,
+ # when june scheduler run, this value will display again from june to next jan date
+
+ if leave_id.type == 'calculate' or leave_id.type == 'manual':
+ leave_days += leave_id.leave_days
+ self.leave_days_ny = leave_days
+ return
+
+ @api.one
+ def calculate_nextyear_additional_leave_days(self):
+ today_date = datetime.today().date()
+
+ # for sow17
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ today_date = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date()
+
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year_type =='next':
+ period_date_start = datetime.strptime('01-06-'+str(leave_id.year-1),'%d-%m-%Y').date()
+ period_date_end = datetime.strptime('01-01-'+str(leave_id.year),'%d-%m-%Y').date()
+ if today_date >=period_date_start and today_date < period_date_end:
+ # condition to display value from 01-06-2018 to 03-01-2019,
+ # when june scheduler run, this value will display again from june to next jan date
+ if leave_id.type == 'additional':
+ leave_days += leave_id.leave_days
+ self.additional_leave_days_ny = leave_days
+
+ @api.one
+ def _calculate_nextyear_approved_leave_days(self):
+ today_date = datetime.today().date()
+
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ today_date = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date()
+
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year_type =='next':
+ period_date_start = datetime.strptime('01-06-'+str(leave_id.year-1),'%d-%m-%Y').date()
+ period_date_end = datetime.strptime('01-01-'+str(leave_id.year),'%d-%m-%Y').date()
+ if today_date >=period_date_start and today_date < period_date_end:
+ # condition to display value from 01-06-2018 to 03-01-2019,
+ # when june scheduler run, this value will display again from june to next jan date
+ if leave_id.type == 'leave' and leave_id.leave_type == 'days':
+ leave_days += leave_id.leave_days
+ self.approved_leaves_ny = leave_days
+
+ @api.one
+ def _calculate_nextyear_sum_leaves(self):
+ sum_leaves = self.leave_days_ny + self.additional_leave_days_ny - self.approved_leaves_ny
+ self.sum_leaves_ny = sum_leaves
+ return
+ #----END----#
+
+ @api.one
+ def _calculate_sum_leaves(self):
+ sum_leaves = self.leave_days + self.leave_days_last_year + self.additional_leave_days - self.approved_leaves
+ self.sum_leaves = sum_leaves
+ return
+
+ @api.one
+ def _calculate_sum_journal_entries(self):
+ journal_entry_ids = self.env['hr.leave.journal'].search([('employee_id.id','=',self.id),('year','=',datetime.today().year)])
+ self.sum_journal_entries = len(journal_entry_ids)
+
+ @api.one
+ def calculate_actual_year_leave_days(self):
+ year = datetime.today().year
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ year = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().year
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year != year or leave_id.year_type != 'actual':
+ continue
+ else:
+ if leave_id.type == 'calculate':
+ leave_days += leave_id.leave_days
+ elif leave_id.type == 'manual':
+ leave_days += leave_id.leave_days
+ self.leave_days = leave_days
+ return
+
+ @api.one
+ def calculate_last_year_leave_days(self):
+ month = datetime.today().month
+ year = datetime.today().year
+
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ year = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().year
+ month = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().month
+ if month > 3:
+ self.leave_days_last_year = 0
+ return
+
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year != year or leave_id.year_type != 'last' or leave_id.type == 'manual':
+ continue
+ else:
+ if leave_id.type == 'calculate':
+ leave_days += leave_id.leave_days
+ elif leave_id.type == 'leave':
+ leave_days -= leave_id.leave_days
+ self.leave_days_last_year = leave_days
+ return
+
+ @api.one
+ def calculate_additional_leave_days(self):
+ year = datetime.today().year
+
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ year = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().year
+
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year != year or leave_id.year_type != 'actual':
+ continue
+ else:
+ if leave_id.type == 'additional':
+ leave_days += leave_id.leave_days
+ self.additional_leave_days = leave_days
+ return
+
+ @api.one
+ def _calculate_approved_leave_days(self):
+ year = datetime.today().year
+
+ # for sow17 testing
+ for_sow17 = self.env['res.company'].sudo().search([('for_sow17','=',True)],limit=1)
+ if for_sow17:
+ year = datetime.strptime(for_sow17.next_year_date,DEFAULT_SERVER_DATE_FORMAT).date().year
+
+ leave_days = 0
+ for leave_id in self.leave_journal_ids:
+ # if leave_id.year != year or leave_id.year_type != 'actual':#original
+ if leave_id.year != year or leave_id.year_type != 'actual' or leave_id.last_year_carry_fwd: #for sow17 testing
+ continue
+ else:
+ if leave_id.type == 'leave' and leave_id.leave_type == 'days':
+ leave_days += leave_id.leave_days
+ self.approved_leaves = leave_days
+ return
+
+ # Function to calculate remaining leaves for last year for information purposes
+ @api.one
+ def calculate_last_year_remaining_leaves(self):
+ year = datetime.today().year-1
+ #print"Last Year: ",year
+ leaves_ly = 0
+ for leave_id in self.leave_journal_ids:
+ if leave_id.year == year and leave_id.year_type == 'actual' and not leave_id.last_year_carry_fwd:
+ if leave_id.type in ['calculate', 'manual', 'additional']:
+ leaves_ly += leave_id.leave_days
+ elif leave_id.type == 'leave' and leave_id.leave_type == 'days':
+ leaves_ly -= leave_id.leave_days
+ #print"leaves_ly =====> ", leaves_ly
+ self.last_year_remaining_leaves = leaves_ly
+ return
+
+
+class HRContract(models.Model):
+
+ _inherit = "hr.contract"
+
+ def create(self, cr, uid, values, context=None):
+ new_id = super(HRContract, self).create(cr, uid, values, context=context)
+ new_rec = self.browse(cr,uid,new_id, context=context)
+ contract_ids = self.pool.get('hr.leave.journal').search(cr, uid, [('employee_id','=', new_rec.employee_id.id),('type','=','calculate'), ('year_type','=','actual'),('year','=', datetime.today().year)])
+ if len(contract_ids) == 0:
+ self.create_leave_journal_entries(cr,uid,new_id,values)
+ return new_id
+
+ @api.one
+ def create_leave_journal_entries(self,values):
+ leave_journal_obj = self.env['hr.leave.journal']
+ leave_days = self.calculate_leave_days(values)
+ lj_values = {
+ 'employee_id': self.employee_id.id,
+ 'year': datetime.today().year,
+ 'year_type': 'actual',
+ 'type': 'calculate',
+ 'leave_type':'days',
+ 'leave_days': leave_days[0],
+ 'name': 'Vertragsanpassung' + str(datetime.today().date()),
+ 'contract_id': self.id
+ }
+ leave_journal_obj.create(lj_values)
+ return
+
+ @api.one
+ def calculate_leave_days(self,values=None,cyear=None):
+ leave_days = 0
+ if not values:
+ values={}
+ if not cyear:
+ cyear = datetime.today().year
+ date_start = self.date_start
+ date_end = self.date_end
+ base_leaves = self.base_leaves
+ if 'date_start' in values:
+ date_start = values['date_start']
+ if 'date_end' in values:
+ date_end = values['date_end']
+ if 'base_leaves' in values:
+ base_leaves = values['base_leaves']
+ if datetime.strptime(date_start.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year < cyear:
+ if not date_end:
+ leave_days = base_leaves
+ elif datetime.strptime(date_end.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year > cyear:
+ leave_days = base_leaves
+ # elif datetime.strptime(date_end.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT) >= datetime.strptime('01-07-'+str(cyear),'%d-%m-%Y'):
+ # leave_days = base_leaves
+ else:
+ st = datetime.strptime('01-01-'+str(cyear),'%d-%m-%Y')
+ leave_days = self.calculate_partial_year(st, datetime.strptime(date_end.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT), base_leaves)[0]
+ elif datetime.strptime(date_start.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year == cyear:
+ if not self.date_end:
+ date_end = datetime.strptime('31-12-'+str(cyear),'%d-%m-%Y')
+ else:
+ if datetime.strptime(date_end.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year > cyear:
+ date_end = datetime.strptime('31-12-'+str(cyear),'%d-%m-%Y')
+ elif datetime.strptime(date_end.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT).year == cyear:
+ date_end = datetime.strptime(date_end.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ # Contract starts on 01.01, duration is full year so no need to call calculate_partial_year
+ ds = datetime.strptime(date_start.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ de = date_end
+ #print"date_start: ",ds.year,ds.month,ds.day
+ #print"date_end: ",de.year,de.month,de.day
+ if ds.year == cyear and ds.month == 1 and ds.day == 1 and de.year == cyear and de.month == 12 and de.day == 31:
+ leave_days = base_leaves
+ else:
+ leave_days = self.calculate_partial_year(datetime.strptime(date_start.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT), date_end, base_leaves)[0]
+ return leave_days
+
+ @api.one
+ def calculate_partial_year(self,date_start,date_end,base_leaves):
+ date_start_calc = date_start
+ date_end_calc = date_end
+ if date_start.day != 1 or date_start.month != 1:
+ date_start_calc = date_start + timedelta(days=-1)
+ elif date_end.day != 31 or date_end.month != 12:
+ date_end_calc = date_end + timedelta(days=1)
+ # else:
+ # return base_leaves
+ full_month = date_end_calc.month - date_start_calc.month
+ if date_end.day != monthrange(date_end.year, date_end.month)[1] and date_start.day != monthrange(date_start.year, date_start.month)[1]:
+ if date_end.day <= date_start.day:
+ full_month -= 1
+ # if full_month >= 6 and date_end.day >= date_start.day:
+ # leave_days = base_leaves
+ # else:
+ # leave_days = float_round(full_month * float(base_leaves) / 12, precision_rounding = 1)
+ leave_days = float_round(full_month * float(base_leaves) / 12, precision_rounding = 1)
+ return leave_days
+
+
+
diff --git a/itis_hr_extend/models/mail_message.py b/itis_hr_extend/models/mail_message.py
new file mode 100644
index 0000000..b2c0f3c
--- /dev/null
+++ b/itis_hr_extend/models/mail_message.py
@@ -0,0 +1,27 @@
+
+from openerp import models, api, fields, _
+from email.utils import formataddr
+
+
+class mail_message(models.Model):
+ _inherit = 'mail.message'
+
+ @api.model
+ def create(self, vals):
+ # print"self._context.------",self._context
+ # if self._context.get('holiday_create'):
+
+ if self._context.get('hr_uid'):
+ user = self.env['res.users'].browse(self._context.get('hr_uid'))
+
+ if user.alias_name and user.alias_domain:
+ from_address = formataddr((user.name, '%s@%s' % (user.alias_name, user.alias_domain)))
+ vals.update({'email_from': from_address,'reply_to':from_address})
+ elif user.email:
+ from_address = formataddr((user.name, user.email))
+ vals.update({'email_from': from_address,'reply_to':from_address})
+
+ vals.update({'author_id': user.partner_id.id})
+ res = super(mail_message, self).create(vals)
+ return res
+
diff --git a/itis_hr_extend/security/groups.xml b/itis_hr_extend/security/groups.xml
new file mode 100644
index 0000000..d91b2f1
--- /dev/null
+++ b/itis_hr_extend/security/groups.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ Payroll Manager
+ the user will have the additional right to approve payroll slips.
+
+
+
+
+
+
+
+ Assigned Leaves
+
+ ['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id)]
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/security/ir.model.access.csv b/itis_hr_extend/security/ir.model.access.csv
new file mode 100644
index 0000000..ee7394f
--- /dev/null
+++ b/itis_hr_extend/security/ir.model.access.csv
@@ -0,0 +1,32 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_itis_confession,access_itis_confession,model_itis_confession,,1,1,1,1
+access_itis_employee_children,access_itis_employee_children,model_itis_employee_children,,1,1,1,1
+access_itis_limitation_reason,access_itis_limitation_reason,model_itis_limitation_reason,,1,1,1,1
+access_itis_hr_contact_manager,access_itis_hr_contact_manager,model_itis_hr_contact,,1,1,1,1
+access_itis_fte_report,access_itis_fte_report,model_fte_report,,1,1,1,1
+access_itis_fte_records,access_itis_fre_report,model_fte_records,,1,1,1,1
+access_itis_create_fte,access_itis_create_fte,model_create_fte,,1,1,1,1
+access_hr_employee_fte,access_hr_employee_fte,model_hr_employee_fte,,1,1,1,1
+access_itis_hr_contact_manager,access_itis_hr_contact_manager,model_itis_hr_contact,,1,1,1,1
+access_hr_leave_journal,access_hr_leave_journal,model_hr_leave_journal,,1,1,1,1
+access_hr_payslip_read,access_hr_payslip_read,hr_payroll.model_hr_payslip,,1,1,1,1
+access_leave_time_read,access_leave_time_read,model_leave_time,base.group_user,1,0,0,0
+access_hr_contract_read,access_hr_contract_read,hr_contract.model_hr_contract,base.group_user,1,0,0,0
+access_resource_calendar_read,access_resource_calendar_read,resource.model_resource_calendar,base.group_user,1,0,0,0
+access_resource_calendar_attendance_read,access_resource_calendar_attendance_read,resource.model_resource_calendar_attendance,base.group_user,1,0,0,0
+access_itis_emp_report,access_itis_emp_report,model_employee_report,,1,1,1,1
+access_itis_emp_report_data,access_itis_emp_report_data,model_employee_report_data,,1,1,1,1
+access_itis_health,access_itis_health,model_hr_health_insurance,,1,1,1,1
+access_itis_family,access_itis_family,model_hr_family_status,,1,1,1,1
+access_itis_leave_days_calc_error,access_itis_leave_days_calc_error,model_itis_leave_days_calc_error,,1,1,1,1
+access_itis_employee_meeting,access_employee_meeting,model_employee_meeting,,1,1,1,1
+access_itis_employee_instruction,access_employee_instruction,model_employee_instruction,,1,1,1,1
+access_itis_planned_jobs,access_planned_jobs,model_planned_job,,1,1,1,1
+access_itis_contract_type,access_contract_type,model_itis_contract_type,,1,1,1,1
+access_itis_model_employee_overtime_count,access_model_employee_overtime_count,model_employee_overtime_count,,1,1,1,1
+access_hr_rule_input,access_hr_rule_input_read,hr_payroll.model_hr_rule_input,,1,1,1,1
+access_hr_payslip_worked_days,access_hr_payslip_worked_days_read,hr_payroll.model_hr_payslip_worked_days,,1,1,1,1
+access_res_partner,access_res_partner_read,base.model_res_partner,,1,1,1,1
+access_hr_leave_nextyear,access_hr_leave_nextyear_read,model_hr_leave_nextyear,,1,1,1,1
+
+
diff --git a/itis_hr_extend/static/data.xml b/itis_hr_extend/static/data.xml
new file mode 100644
index 0000000..1ee1fbe
--- /dev/null
+++ b/itis_hr_extend/static/data.xml
@@ -0,0 +1,59 @@
+
+
+
+ Sachgrundlos
+
+
+ Projektbefristet
+
+
+ Elternzeit/Mutterschutz
+
+
+ Krankheit
+
+
+ Sabbatical Vertretung
+
+
+ fte.base
+ 40
+
+
+
+ Overtime Leave
+ magenta
+ 1
+
+
+
+
+
+ Employee Holidays
+
+ ['|', ('employee_id.user_id','=',user.id), ('employee_id', 'child_of', [x.id for x in user.employee_ids])]
+
+
+
+
+
+
+
+
+ Resource: see own leaves
+
+
+ ['|','|',
+ ('resource_id', '=', False),
+ ('resource_id.user_id', '=', user.id),
+ ('resource_id.user_id', '!=', user.id),
+ ]
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/views/employee_meeting_view.xml b/itis_hr_extend/views/employee_meeting_view.xml
new file mode 100644
index 0000000..2673434
--- /dev/null
+++ b/itis_hr_extend/views/employee_meeting_view.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+ employee.meeting
+ form
+ Employee Meeting
+ tree,form
+ [('employee_id','in',[active_id])]
+ {'search_default_employee_id': [active_id], 'default_employee_id': active_id}
+
+
+
+ employee_meeting_tree
+ employee.meeting
+
+
+
+
+
+
+
+
+
+
+
+
+
+ employee.instruction
+ form
+ Employee Instruction
+ tree,form
+ [('employee_id','in',[active_id])]
+ {'search_default_employee_id': [active_id], 'default_employee_id': active_id}
+
+
+
+ employee_instruction_tree
+ employee.instruction
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/views/employee_payroll_report_view.xml b/itis_hr_extend/views/employee_payroll_report_view.xml
new file mode 100644
index 0000000..f3f0afd
--- /dev/null
+++ b/itis_hr_extend/views/employee_payroll_report_view.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ itis.emp.payroll.report.tree
+ employee.payroll.report
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/views/employee_report_view.xml b/itis_hr_extend/views/employee_report_view.xml
new file mode 100644
index 0000000..2ab7d7e
--- /dev/null
+++ b/itis_hr_extend/views/employee_report_view.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ itis.employee.report.tree
+ employee.report
+
+
+
+
+
+
+ Employee Report
+ ir.actions.act_window
+ employee.report
+ form
+ form
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/views/fte_report_view.xml b/itis_hr_extend/views/fte_report_view.xml
new file mode 100644
index 0000000..1cafcb2
--- /dev/null
+++ b/itis_hr_extend/views/fte_report_view.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+ company_view_form_itis
+ res.company
+
+
+
+
+
+
+
+
+
+
+
+
+ itis.fte.records.form
+ fte.records
+
+
+
+
+
+
+
+
+
+
+
+ itis.fte.report.tree
+ fte.report
+
+
+
+
+
+
+
+
+
+
+ itis.fte.report.form
+ fte.report
+
+
+
+
+
+
+ FTE Report
+ ir.actions.act_window
+ fte.report
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/views/hr_employee_view.xml b/itis_hr_extend/views/hr_employee_view.xml
new file mode 100644
index 0000000..065d9e2
--- /dev/null
+++ b/itis_hr_extend/views/hr_employee_view.xml
@@ -0,0 +1,782 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr_department_view_form_itis
+ hr.department
+
+
+
+
+
+
+
+
+
+
+ hr.leave.journal
+
+ tree,form
+ form
+ Leaves
+ {'search_default_employee_id': [active_id], 'default_employee_id': active_id}
+
+
+
+
+ hr_leave_journal_tree
+ hr.leave.journal
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr_leave_journal_form
+ hr.leave.journal
+
+
+
+
+
+
+
+ hr_leave_journal_form
+ hr.leave.journal
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr_hr_employee_view_form_itis
+ hr.employee
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr.holidays.status.form.inherit.itis
+ hr.holidays.status
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/wizard/__init__.py b/itis_hr_extend/wizard/__init__.py
new file mode 100644
index 0000000..30dfcb1
--- /dev/null
+++ b/itis_hr_extend/wizard/__init__.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import ot_change
+from . import fte_wizard
+from . import emp_payroll_wizard
+from . import emp_data_wizard
+
+
diff --git a/itis_hr_extend/wizard/emp_data_wizard.py b/itis_hr_extend/wizard/emp_data_wizard.py
new file mode 100755
index 0000000..c2bb27a
--- /dev/null
+++ b/itis_hr_extend/wizard/emp_data_wizard.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+
+from openerp import models, fields, api, _
+from openerp.exceptions import Warning
+import csv
+from datetime import datetime
+import base64
+import os
+
+class employee_data_export(models.TransientModel):
+
+ _name = 'employee.data.export'
+
+ name = fields.Binary('Timesheet CSV')
+ file_name = fields.Char('File')
+ report_selection = fields.Selection([('export_employee','Personalübersicht'),
+ ('export_workcouncil','BR Übersicht')],
+ string='Report',default='export_employee', required=True)
+
+ @api.multi
+ def export_emp_data_csv(self):
+ """
+ This function is use to export the employee data records which are preselected.
+ """
+
+ if self._context and 'active_model' in self._context and self._context['active_model'] == 'hr.employee':
+ context = self._context.copy()
+ hr_employee = self.env['hr.employee']
+ if self.report_selection =='export_workcouncil':
+ hr_employee_records = hr_employee.search([('executive_employee','=',False),('id','in',context['active_ids'])])
+ else:
+ hr_employee_records = hr_employee.browse(context['active_ids'])
+ # print"analytic_timesheet_records----",analytic_timesheet_records
+ context = self.export_csv_subfunction(hr_employee_records)
+
+ return {
+ 'name': _('Exported Employee Data'),
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'employee.data.export',
+ 'type': 'ir.actions.act_window',
+ 'context': context,
+ 'target':'new',
+ }
+
+ def get_date_format(self,date):
+ if date:
+ return datetime.strptime(date,'%Y-%m-%d').strftime('%d.%m.%Y')
+ else:
+ return ''
+
+
+ def export_csv_subfunction(self,emp_data_records):
+ """
+ It is a subfunction for the export csv.
+ """
+
+ data_list = []
+ if self._context.get('for_work_council') or self.report_selection =='export_workcouncil':
+ csv_header = ['Personalnummer','Vorname','Nachname','Bereich','Team','Stellenbezeichnung','Vertragstyp',
+ 'Ersteintrittsdatum','Enddatum befristeter Vertrag','Befristungsgrund','Probezeit Enddatum',
+ 'letztes MA Gespraech',]
+ csv_name = "Betriebsratsübersicht"
+
+ else:
+ csv_header = ['Personalnummer','Vorname','Nachname','Geburtstag','Company','Bereich','Team','Planstellenbezeichnung',
+ 'Stellenbezeichnung','Vertragstyp','Ersteintrittsdatum','Enddatum befristeter Vertrag','Befristungsgrund',
+ 'Probezeit Enddatum','letztes MA Gespraech','5-Jahresjubilaeum','Arbeitszeit','Urlaub','Schwerbehinderung',
+ 'letzte Vertragsaenderung_L&G','Startdatum der letzten Vertragversänderung','Verguetung','Verguetung bei VZ','Verguetung inkl. AG Kosten (25%)','BR Mitglied',
+ 'Bemerkungen','Manager']
+ csv_name = "Personalübersicht"
+ time_csv = datetime.now().strftime('%Y-%m-%d_%H%M%S') + '.csv'
+ csv_path = "/tmp/" + time_csv
+ for emp_record in emp_data_records:
+
+ if self._context.get('for_work_council') or self.report_selection =='export_workcouncil':
+ vals = {
+ 'Personalnummer': (emp_record.identification_id or '').encode('utf-8'),
+ 'Nachname': (emp_record.second_name or '').encode('utf-8'),
+ 'Vorname': (emp_record.surname or '').encode('utf-8'),
+ 'Bereich': (emp_record.bereich and emp_record.bereich.name or '').encode('utf-8'),
+ 'Team': (emp_record.department_id and emp_record.department_id.name or '').encode('utf-8'),
+ 'Stellenbezeichnung': (emp_record.job_id and emp_record.job_id.name or '').encode('utf-8'),
+ 'Vertragstyp': (emp_record.sudo().contract_type and emp_record.sudo().contract_type.name or '').encode('utf-8'),
+ 'Ersteintrittsdatum': self.get_date_format(emp_record.initial_date),
+ 'Enddatum befristeter Vertrag': self.get_date_format(emp_record.temp_contract_end_date),
+ 'Befristungsgrund': (emp_record.contract_limitation_reason and emp_record.contract_limitation_reason.name or '').encode('utf-8'),
+ 'Probezeit Enddatum': self.get_date_format(emp_record.contract_trial_end_date),
+ 'letztes MA Gespraech': self.get_date_format(emp_record.last_ma_conversation_date),
+
+ }
+
+ else:
+ notes = ''
+ if emp_record.contract_notes:
+ notes= emp_record.contract_notes.replace("\n"," / ")
+ vals = {
+ 'Personalnummer': (emp_record.identification_id or '').encode('utf-8'),
+ 'Nachname': (emp_record.second_name or '').encode('utf-8'),
+ 'Vorname': (emp_record.surname or '').encode('utf-8'),
+ 'Geburtstag': self.get_date_format(emp_record.birthday),
+ 'Company': (emp_record.address_id and emp_record.address_id.sudo().name or '').encode('utf-8'),
+ 'Bereich': (emp_record.bereich and emp_record.bereich.name or '').encode('utf-8'),
+ 'Team': (emp_record.department_id and emp_record.department_id.name or '').encode('utf-8'),
+ 'Planstellenbezeichnung': (emp_record.planned_job_id and emp_record.planned_job_id.name or '').encode('utf-8'),
+ 'Stellenbezeichnung': (emp_record.job_id and emp_record.job_id.name or '').encode('utf-8'),
+ 'Vertragstyp': (emp_record.sudo().contract_type and emp_record.sudo().contract_type.name or '').encode('utf-8'),
+ 'Ersteintrittsdatum': self.get_date_format(emp_record.initial_date),
+ 'Enddatum befristeter Vertrag': self.get_date_format(emp_record.temp_contract_end_date),
+ 'Befristungsgrund': (emp_record.contract_limitation_reason and emp_record.contract_limitation_reason.name or '').encode('utf-8'),
+ 'Probezeit Enddatum': self.get_date_format(emp_record.contract_trial_end_date),
+ 'letztes MA Gespraech': self.get_date_format(emp_record.last_ma_conversation_date),
+ '5-Jahresjubilaeum': self.get_date_format(emp_record.five_years),
+ 'Arbeitszeit': (emp_record.contract_working_hours and emp_record.contract_working_hours.name or '').encode('utf-8'),
+ 'Urlaub': emp_record.contract_leaves or '',
+ 'Schwerbehinderung': ('ja' if emp_record.disability=='yes' else 'nein' or ''),
+ # 'letzte Vertragsaenderung_L&G': emp_record.last_contract_changed_wage or '',
+ 'letzte Vertragsaenderung_L&G': ("%.2f" % emp_record.last_contract_changed_wage).replace('.',',') or '',
+ 'Startdatum der letzten Vertragversänderung':self.get_date_format(emp_record.last_contract_changed_date),
+ 'Verguetung': ("%.2f" % emp_record.emp_wage_cal).replace('.',',') or '',
+ # 'Verguetung bei VZ': emp_record.compensation_at_vz or '',
+ 'Verguetung bei VZ': ("%.2f" % emp_record.compensation_at_vz).replace('.',',') or '',
+ # 'Verguetung inkl. AG Kosten (25%)': emp_record.remuneration_incl_ag_costs or '',
+ 'Verguetung inkl. AG Kosten (25%)': ("%.2f" % emp_record.remuneration_incl_ag_costs).replace('.',',') or '',
+ 'BR Mitglied': ('ja' if emp_record.br_member=='yes' else 'nein' or '').encode('utf-8'),
+ 'Bemerkungen': (notes).encode('utf-8'),
+ 'Manager': (emp_record.parent_id and emp_record.parent_id.name or '').encode('utf-8'),
+
+ }
+ data_list.append(vals)
+
+ with open(csv_path, 'wb') as csvfile:
+
+ w = csv.DictWriter(csvfile, fieldnames=csv_header, delimiter=';',quoting=csv.QUOTE_ALL)
+ w.writeheader()
+ w.writerows(data_list)
+ csvfile.close()
+
+ data = ''
+ with open(csv_path, 'rb') as csvfile:
+ data = csvfile.read()
+ data = data.encode('base64')
+ csvfile.close()
+ context = self._context.copy()
+ file_name = datetime.now().strftime('%Y%m%d_%H_%M')+'_'+csv_name+ '.csv'
+ context.update({'default_name': data, 'default_file_name':file_name})
+ os.remove(csv_path)
+ return context
diff --git a/itis_hr_extend/wizard/emp_data_wizard_view.xml b/itis_hr_extend/wizard/emp_data_wizard_view.xml
new file mode 100755
index 0000000..9341b1e
--- /dev/null
+++ b/itis_hr_extend/wizard/emp_data_wizard_view.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+ emloyee.data.export.form.view
+ employee.data.export
+
+
+
+
+
+
+ Personalübersicht Export
+ ir.actions.act_window
+ employee.data.export
+ form
+ form
+ new
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/wizard/emp_payroll_wizard.py b/itis_hr_extend/wizard/emp_payroll_wizard.py
new file mode 100644
index 0000000..dbaffdc
--- /dev/null
+++ b/itis_hr_extend/wizard/emp_payroll_wizard.py
@@ -0,0 +1,327 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, api, fields, _
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
+from calendar import monthrange
+import csv
+import os
+import base64
+
+def get_years():
+ year = []
+ for i in range(2016,2040):
+ year.append((i,str(i)))
+ return year
+
+class create_emp_payroll(models.TransientModel):
+
+ _name = 'create.emp.payroll'
+
+ @api.model
+ def _default_date_from(self):
+ date = datetime.today().date()
+ last_month_date = (date - relativedelta(months= 1)).replace(day=20)
+ return last_month_date
+
+ @api.model
+ def _default_date_to(self):
+ date = datetime.today().date().replace(day=20)
+ return date
+
+ @api.model
+ def _default_month(self):
+ date = datetime.today().date()
+ return date.month
+
+ @api.model
+ def _default_year(self):
+ date = datetime.today().date()
+ return date.year
+
+ month = fields.Selection([(1,'January'),(2,'February'),(3,'March'),(4,'April'),(5,'May'),(6,'June')
+ ,(7,'July'),(8,'Augast'),(9,'September'),(10,'October'),(11,'November'),(12,'December')],default =_default_month,string='Month')
+ year = fields.Selection(get_years(),default =_default_year,string='Year')
+ date_from = fields.Date('Date From',default =_default_date_from)
+ date_to = fields.Date('Date To',default =_default_date_to)
+
+
+
+ @api.multi
+ def generate_employee_report(self):
+ emp_payroll_report = self.env['employee.payroll.report']
+ record_ids = []
+
+
+ hr_contract_records = self.env['hr.contract'].search([('employee_id','!=',False)],order='employee_id')
+ # hr_contract_records = self.env['hr.contract'].search([('id','=',169)],order='employee_id')
+ for hr_contract_brw in hr_contract_records:
+ if hr_contract_brw.date_start:
+ # print"hr_contract_brw----",hr_contract_brw
+ # ----------------to calculate the selected year month combination for the contract
+ selected_year_month = str(self.year)+'-'+str(self.month)
+ # print"selected_year_month------",selected_year_month
+
+ contract_date_start = datetime.strptime(hr_contract_brw.date_start,'%Y-%m-%d').date()
+ if hr_contract_brw.date_end:
+ contract_date_end = datetime.strptime(hr_contract_brw.date_end,'%Y-%m-%d').date()
+ else:
+ contract_date_end = datetime.today().date()
+ #Added newly
+ selected_month_range = monthrange(self.year,self.month)
+ selected_month_enddate = datetime.strptime(selected_year_month+'-'+str(selected_month_range[1]),'%Y-%m-%d').date()
+ if contract_date_end < selected_month_enddate:
+ contract_date_end = selected_month_enddate
+
+
+ contract_date_start_new = contract_date_start.replace(day=1)
+ contract_date_end_new = contract_date_end.replace(day=1)
+ # print"contract_date_start_new----",contract_date_start_new
+ # print"contract_date_end_new----",contract_date_end_new
+ contracted_year_months = []
+ while contract_date_start_new <=contract_date_end_new:
+ data = str(contract_date_start_new.year)+'-'+str(contract_date_start_new.month)
+ contracted_year_months.append(data)
+ contract_date_start_new = contract_date_start_new + relativedelta(months= 1)
+ # print"contracted_year_months----",contracted_year_months
+
+ # Selected year and month criteria
+ # if contract_date_start.year <= self.year and contract_date_start.month <= self.month and contract_date_end.year >= self.year and contract_date_end.month >= self.month:
+ if selected_year_month in contracted_year_months:
+ # print"Active Contract------",hr_contract_brw.name
+ # print"Employee Name ------",hr_contract_brw.employee_id.name
+
+ # --------------to calculate gross salary
+ gross_salary = 0.0
+ hr_payslip = self.env['hr.payslip']
+ selected_month_range = monthrange(self.year,self.month)
+
+ period_start_date = datetime.strptime(selected_year_month+'-01','%Y-%m-%d').date()
+ period_end_date = datetime.strptime(selected_year_month+'-'+str(selected_month_range[1]),'%Y-%m-%d').date()
+
+ if contract_date_start <= period_start_date:
+ period_contract_start_date =str(period_start_date)
+ else:
+ period_contract_start_date =str(contract_date_start)
+ if contract_date_end >= period_end_date:
+ period_contract_end_date =str(period_end_date)
+ else:
+ period_contract_end_date =str(contract_date_end)
+
+ #To check for the date and values
+ if period_contract_start_date > period_contract_end_date:
+ period_contract_end_date = period_contract_start_date
+ #period_contract_end_date = period_contract_start_date
+
+ # print"period_contract_start_date------",period_contract_start_date
+ # print"period_contract_end_date------",period_contract_end_date
+ # print"contract_date_end------",contract_date_end
+ payslip_values = {'employee_id':hr_contract_brw.employee_id.id,'date_from':period_contract_start_date,'date_to':period_contract_end_date,
+ 'contract_id':hr_contract_brw.id,'struct_id':hr_contract_brw.struct_id.id,'journal_id':1 }
+
+ hr_payslip_brw=hr_payslip.sudo().create(payslip_values)
+
+ res = self.pool.get('hr.payslip').onchange_employee_id(self._cr, self._uid, [], period_contract_start_date, period_contract_end_date,
+ hr_contract_brw.employee_id.id, hr_contract_brw.id, None)
+ if res and res.get('value'):
+ value = res.get('value')
+ worked_days_line_ids = value.get('worked_days_line_ids')
+ for line_rec in worked_days_line_ids:
+ line_rec.update({'payslip_id':hr_payslip_brw.id})
+ self.env['hr.payslip.worked_days'].create(line_rec)
+ hr_payslip_brw.compute_sheet()
+ for data in hr_payslip_brw.details_by_salary_rule_category:
+ if data.code == "NET":
+ gross_salary = data.total
+ hr_payslip_brw.unlink()
+
+
+ # ---------------to calculate sick days
+ sick_days = 0.0
+ selected_date_from = datetime.strptime(self.date_from,'%Y-%m-%d').date()
+ selected_date_to = datetime.strptime(self.date_to,'%Y-%m-%d').date()
+
+
+ if contract_date_start<= selected_date_from:
+ sick_leave_start_date = selected_date_from
+ else:
+ sick_leave_start_date = contract_date_start
+ if contract_date_end >= selected_date_to:
+ sick_leave_end_date = selected_date_to
+ else:
+ sick_leave_end_date = contract_date_end
+
+ while sick_leave_start_date <=sick_leave_end_date:
+ # print"sick_leave_start_date----",sick_leave_start_date
+
+ hr_analytic_env = self.env['hr.analytic.timesheet']
+ search_domain = [
+
+ ('date', '=', str(sick_leave_start_date)),
+ ('user_id', '=',hr_contract_brw.employee_id.user_id.id),
+ ('account_id', '=', hr_contract_brw.employee_id.company_id.sick_account_id.id)
+ ]
+
+ timesheet_line_ids = hr_analytic_env.search(search_domain)
+ # print"timesheet_line_ids--------",timesheet_line_ids
+ if len(timesheet_line_ids):
+ for line in timesheet_line_ids:
+ for plan in line.sheet_id.planned_ids:
+ if plan.sheet_date == line.date and plan.duration:
+ sick_days +=line.unit_amount/plan.duration
+
+ sick_days = float("{0:.2f}".format(sick_days))
+
+ # print"sick_days--------",sick_days
+
+ # sick_day_status = self.env['hr.holidays.status'].search([('is_sick_leave_type','=',True)],limit=1)
+ # if sick_day_status:
+ # sick_day_leave_records = self.env['hr.holidays'].search([('holiday_status_id','=',sick_day_status.id),('state','=','validate'),
+ # ('employee_id','=',hr_contract_brw.employee_id.id),('date_from','<=',str(sick_leave_start_date)),('date_to','>=',str(sick_leave_start_date))],limit=1)
+ #
+ # if sick_day_leave_records:
+ # leave_date_from = datetime.strptime(sick_day_leave_records.date_from,DEFAULT_SERVER_DATETIME_FORMAT).date()
+ # leave_date_to = datetime.strptime(sick_day_leave_records.date_to,DEFAULT_SERVER_DATETIME_FORMAT).date()
+ # if leave_date_from == sick_leave_start_date and leave_date_to == sick_leave_start_date:
+ # sick_days += sick_day_leave_records.number_of_days_temp
+ # else:
+ # if leave_date_from == sick_leave_start_date and sick_day_leave_records.leave_selection =='half_day':
+ # sick_days +=0.5
+ # elif leave_date_to == sick_leave_start_date and sick_day_leave_records.leave_selection_date_to =='half_day':
+ # sick_days +=0.5
+ # else:
+ # sick_days +=1
+
+ sick_leave_start_date = sick_leave_start_date+relativedelta(days=1)
+ # print"sick_days------",sick_days
+
+
+ # ----------------For coloring base on the last modification date
+ change_record,employee_brw='N',hr_contract_brw.employee_id
+ if self.date_from and self.date_to:
+ if hr_contract_brw.write_date >= self.date_from and hr_contract_brw.write_date <= self.date_to and \
+ employee_brw.write_date >= self.date_from and employee_brw.write_date <= self.date_to:
+ change_record = 'SV'
+ elif self.date_from <= hr_contract_brw.write_date and self.date_to >= hr_contract_brw.write_date:
+ change_record = 'V'
+ elif self.date_from <= employee_brw.write_date and self.date_to >= employee_brw.write_date:
+ change_record = 'ST'
+
+ # ----------------To get a wage base on the hourly basis time
+ wage =0.0
+ if hr_contract_brw:
+ wage = hr_contract_brw.wage
+
+
+ vals = {'contract_id':hr_contract_brw.id,'employee_id':hr_contract_brw.employee_id.id,
+ 'record_change':change_record,'sick_days':sick_days,'gross_salary':gross_salary,'wage':wage}
+ record_ids.append(emp_payroll_report.create(vals).id)
+
+ emp_payroll_report_tree_view = self.env.ref('itis_hr_extend.itis_emp_payroll_report_tree', False)
+ return {
+ 'name': ("Employee Report"),
+ 'view_mode': 'tree',
+ 'view_id': False,
+ 'view_type': 'form',
+ 'res_model': 'employee.payroll.report',
+ 'type': 'ir.actions.act_window',
+ 'target': 'current',
+ 'domain': "[('id', 'in', %s)]" % record_ids,
+ 'views': [(emp_payroll_report_tree_view and emp_payroll_report_tree_view.id or False, 'tree')],
+ 'context': {}
+ }
+
+
+
+class export_emp_payroll(models.TransientModel):
+
+ _name = 'export.emp.payroll'
+
+ name = fields.Binary('Employee Report CSV')
+ file_name = fields.Char('File')
+
+ @api.multi
+ def export_csv(self):
+ """
+ This function is use to export the employee payroll report
+ """
+ emp_payroll_report = self.env['employee.payroll.report']
+ if self._context and 'active_model' in self._context and self._context['active_model'] == 'employee.payroll.report':
+
+ emp_payroll_report_records = emp_payroll_report.browse(self._context['active_ids'])
+
+ data_list = []
+ csv_header = ['record_change','Personal-Nr', 'Name', 'Vorname', "Geburtsdatum", "Privatanschrift",'Bankverbindung','Krankenkasse',
+ 'Schwerbehinderung','Schwerbehinderung Gültigkeit','Familienstand','Anzahl Kinder', 'Vertragsreferenz','Vertragsbeginn','Vertragsende',
+ 'Arbeitszeit','Vergütungsmodell','Bruttogehalt','Wage','Krankheitstage','Bemerkung Vertragsinformationen']
+ time_csv = datetime.now().strftime('%Y-%m-%d_%H_%M_%S') + '.csv'
+ csv_path = "/tmp/" + time_csv
+
+ for emp_report_brw in emp_payroll_report_records:
+
+ bank_info =''
+ if emp_report_brw.bank_account_id:
+ bank_account_id = emp_report_brw.bank_account_id
+ if bank_account_id.state =='iban':
+ bank_info = (bank_account_id.bank_name or ' ') +' '+'IBAN '+(bank_account_id.acc_number or' ')
+ else:
+ bank_info = (bank_account_id.bank_name or' ')+' '+(bank_account_id.acc_number or' ')
+ if bank_account_id.bank_bic:
+ bank_info = bank_info+' BIC- '+bank_account_id.bank_bic
+ #
+ record_change = emp_report_brw.record_change
+ if record_change =='V':
+ record_change = 'VÄ'
+
+ vals = {
+ 'record_change': record_change,
+ 'Personal-Nr':(emp_report_brw.identification_id or '').encode('utf-8'),
+ "Name": (emp_report_brw.name or '').encode('utf-8'),
+ 'Vorname': (emp_report_brw.surname or '').encode('utf-8'),
+ 'Geburtsdatum': emp_report_brw.birthday or '',
+ 'Privatanschrift': (emp_report_brw.address_home_id or '').encode('utf-8') ,
+ 'Bankverbindung': bank_info.encode('utf-8'),
+ 'Krankenkasse': (emp_report_brw.health_insurance and emp_report_brw.health_insurance.name or '').encode('utf-8'),
+ 'Schwerbehinderung': emp_report_brw.disability or '',
+ 'Schwerbehinderung Gültigkeit':emp_report_brw.disability_limited_until or '',
+ 'Familienstand': emp_report_brw.family_status and emp_report_brw.family_status.name or '',
+ 'Anzahl Kinder': emp_report_brw.children,
+
+ 'Vertragsreferenz':(emp_report_brw.contract_name or '').encode('utf-8'),
+ 'Vertragsbeginn':emp_report_brw.contract_start_date,
+ 'Vertragsende':emp_report_brw.contract_end_date or '',
+ 'Arbeitszeit':(emp_report_brw.working_hours and emp_report_brw.working_hours.name or '').encode('utf-8'),
+ 'Vergütungsmodell':(emp_report_brw.struct_id and emp_report_brw.struct_id.name or '').encode('utf-8'),
+ 'Bruttogehalt':emp_report_brw.gross_salary,
+ 'Wage':emp_report_brw.wage,
+ 'Krankheitstage':emp_report_brw.sick_days,
+ 'Bemerkung Vertragsinformationen':(emp_report_brw.notes or '').replace('\n',' ').encode('utf-8'),
+ }
+ data_list.append(vals)
+
+ with open(csv_path, 'wb') as csvfile:
+
+ w = csv.DictWriter(csvfile, fieldnames=csv_header, delimiter=',', quoting=csv.QUOTE_ALL)
+ w.writeheader()
+ w.writerows(data_list)
+ csvfile.close()
+
+ data = ''
+ with open(csv_path, 'rb') as csvfile:
+ data = csvfile.read()
+ data = data.encode('base64')
+ csvfile.close()
+ context = self._context.copy()
+ context.update({'default_name': data, 'default_file_name': 'employee_report_export_' + time_csv})
+ os.remove(csv_path)
+
+ return {
+ 'name': _('Exported Employee Report'),
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'export.emp.payroll',
+ 'type': 'ir.actions.act_window',
+ 'context': context,
+ 'target':'new',
+ }
\ No newline at end of file
diff --git a/itis_hr_extend/wizard/emp_payroll_wizard_view.xml b/itis_hr_extend/wizard/emp_payroll_wizard_view.xml
new file mode 100644
index 0000000..b898fb5
--- /dev/null
+++ b/itis_hr_extend/wizard/emp_payroll_wizard_view.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+ emp.payroll.wiz.form.view
+ create.emp.payroll
+
+
+
+
+
+
+ Employee Payroll Report
+ ir.actions.act_window
+ create.emp.payroll
+ form
+ form
+ new
+
+
+
+
+
+
+
+ emp.payroll.export.form.view
+ export.emp.payroll
+
+
+
+
+
+
+ Employee Report Export
+ ir.actions.act_window
+ export.emp.payroll
+ form
+ form
+ new
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/wizard/fte_wizard.py b/itis_hr_extend/wizard/fte_wizard.py
new file mode 100644
index 0000000..ffe686e
--- /dev/null
+++ b/itis_hr_extend/wizard/fte_wizard.py
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+
+
+class create_fte(models.TransientModel):
+
+ _name = 'create.fte'
+
+ @api.model
+ def check_parent(self, dep_dict, parent, pass_list):
+ dep_env = self.env['hr.department']
+ for dep in dep_env.browse(dep_dict.keys()):
+ if dep.id not in pass_list:
+ if dep.parent_id.id == parent:
+ return False
+ return True
+
+ @api.model
+ def compute_child(self, dep, dep_dict, parent_list, pass_list):
+# print "dep_dict", dep_dict
+ if dep.parent_id:
+ # print parent_list,">>" , dep.name, ">>", dep.parent_id.name, '=', dep_dict.get(dep.id)
+ if dep.parent_id.id not in parent_list:
+ if not dep_dict.get(dep.parent_id.id):
+ dep_dict[dep.parent_id.id] = dep_dict.get(dep.id)
+ else:
+ dep_dict[dep.parent_id.id] += dep_dict.get(dep.id)
+ if dep_dict.get(dep.id) and self.check_parent(dep_dict, dep.parent_id.id, pass_list):
+ parent_list.append(dep.parent_id.id)
+ else:
+ dep_dict[dep.parent_id.id] = dep_dict.get(dep.id)
+ self.compute_child(dep.parent_id, dep_dict, parent_list, pass_list)
+ else:
+ if not dep_dict.get(dep.parent_id.id):
+ dep_dict[dep.id] = dep_dict.get(dep.id)
+ else:
+ dep_dict[dep.id] += dep_dict.get(dep.id)
+ return dep_dict, parent_list
+
+
+
+
+ @api.model
+ def calc_fte(self, dep_dict):
+ dep_env = self.env['hr.department']
+ parent_list = []
+ pass_list = []
+ for dep in dep_env.browse(dep_dict.keys()):
+ pass_list.append(dep.id)
+ dep_dict, parent_list = self.compute_child(dep, dep_dict, parent_list, pass_list)
+ # print "dep_dict", dep_dict
+ return dep_dict
+
+ @api.multi
+ def generate_fte_report(self):
+ department_env = self.env['hr.department']
+ employee_env = self.env['hr.employee']
+ dep_dict = {}
+ for emp in employee_env.search([]):
+# print emp.fte, emp.name
+ for fte in emp.fte_ids:
+ if not dep_dict.get(fte.department_id.id):
+ dep_dict[fte.department_id.id] = (fte.fte/100) * emp.fte
+ else:
+ dep_dict[fte.department_id.id] += (fte.fte/100) * emp.fte
+ fte_list = []
+ dep_dict = self.calc_fte(dep_dict)
+ for dep in department_env.search([]):
+
+ vals = {
+ 'department_id': dep.id,
+ 'planned_fte': dep.planned_fte,
+ 'fte': dep_dict.get(dep.id, 0.0),
+ 'diff_fte': dep.planned_fte - dep_dict.get(dep.id, 0.0)
+ }
+ fte_list.append((0,0,vals))
+ fte = self.env['fte.report'].create({'fte_ids': fte_list})
+
+ fte_view = self.env.ref('itis_hr_extend.itis_fte_report_form', False)
+ return {
+ 'name': _('FTE Report'),
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'fte.report',
+ 'views': [(fte_view.id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'current',
+ 'res_id':fte.id
+ }
diff --git a/itis_hr_extend/wizard/fte_wizard_view.xml b/itis_hr_extend/wizard/fte_wizard_view.xml
new file mode 100644
index 0000000..19b45f9
--- /dev/null
+++ b/itis_hr_extend/wizard/fte_wizard_view.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+ fte.wiz.form.view
+ create.fte
+
+
+
+
+
+
+ FTE Report
+ ir.actions.act_window
+ create.fte
+ form
+ form
+ new
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_extend/wizard/ot_change.py b/itis_hr_extend/wizard/ot_change.py
new file mode 100644
index 0000000..708caac
--- /dev/null
+++ b/itis_hr_extend/wizard/ot_change.py
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from datetime import datetime, timedelta
+
+
+class OTChange(models.TransientModel):
+
+ _name = "ot.change"
+
+ reason = fields.Char("Reason")
+ ot_time = fields.Float("Overtime Count")
+ leave_day = fields.Float("Leave Day")
+
+ @api.model
+ def default_get(self, fields):
+
+ res = super(OTChange, self).default_get(fields)
+ emp_id = self.env.context.get("active_id")
+ emp_rec = self.env['hr.employee'].browse(emp_id)
+ if self.env.context.get("from_ot_change", False):
+ # res.update({'ot_time': emp_rec.overtime_count})
+ res.update({'ot_time': emp_rec.employee_overtime_id.emp_overtime_count})
+ else:
+ res.update({'leave_day': emp_rec.additional_leave_days})
+ return res
+
+ @api.multi
+ def set_ot_time(self):
+ emp_id = self.env.context.get("active_id")
+ emp_rec = self.env['hr.employee'].browse(emp_id)
+ if self.env.context.get("from_ot_change", False):
+ emp_rec.update_overtime_count(self.ot_time, self.reason)
+ else:
+ emp_rec.update_leave_day(self.leave_day, self.reason)
+ return True
+
+class LDChange(models.TransientModel):
+
+ _name = "ld.change"
+
+ reason = fields.Char("Reason")
+ type = fields.Selection([('add', 'Hinzufügen'),('sub', 'Abziehen')], "Type")
+ leave_day = fields.Float("Leave Day")
+
+ @api.multi
+ def set_ld_time(self):
+ leave_journal_obj = self.env['hr.leave.journal']
+ leave_days = self.leave_day
+ if self.type == 'sub':
+ leave_days = leave_days * -1
+ values = {
+ 'employee_id': self.env.context.get("active_id"),
+ 'year': datetime.today().year,
+ 'year_type': 'actual',
+ 'type': 'manual',
+ 'leave_type':'days',
+ 'leave_days': leave_days,
+ 'name': self.reason + ' ' + self.env['res.users'].browse(self._uid).name + ' ' + datetime.now().strftime('%d%m%Y %H:%M:%S'),
+ }
+ leave_journal_obj.create(values)
+
+ #for SOW17
+ @api.multi
+ def set_nextyear_ld_time(self):
+ """Add a logic to give ability to change leave day for the next year.
+ User can only change it after May month
+ """
+ leave_journal_obj = self.env['hr.leave.journal']
+ leave_days = self.leave_day
+ if self.type == 'sub':
+ leave_days = leave_days * -1
+ values = {
+ 'employee_id': self.env.context.get("active_id"),
+ 'year': datetime.today().year+1,
+ 'year_type': 'next',
+ 'type': 'manual',
+ 'leave_type':'days',
+ 'leave_days': leave_days,
+ 'name': self.reason + ' ' + self.env['res.users'].browse(self._uid).name + ' ' + datetime.now().strftime('%d%m%Y %H:%M:%S'),
+ }
+ leave_journal_obj.create(values)
diff --git a/itis_hr_extend/wizard/ot_change_view.xml b/itis_hr_extend/wizard/ot_change_view.xml
new file mode 100644
index 0000000..04d040b
--- /dev/null
+++ b/itis_hr_extend/wizard/ot_change_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ ot_change_form_view
+ ot.change
+
+
+
+
+
+
+ ld_change_form_view
+ ld.change
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_leave_extend/__init__.py b/itis_hr_leave_extend/__init__.py
new file mode 100644
index 0000000..7433469
--- /dev/null
+++ b/itis_hr_leave_extend/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import wizard
+from . import models
diff --git a/itis_hr_leave_extend/__openerp__.py b/itis_hr_leave_extend/__openerp__.py
new file mode 100644
index 0000000..5646bee
--- /dev/null
+++ b/itis_hr_leave_extend/__openerp__.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+{
+ 'name': "ITIS HR Leave Extend",
+ 'summary': """ Module will extend Human Ressources leave""",
+ 'description': """
+ Module to extend the functionalities of the HR module.
+ """,
+ 'author': "IT IS AG",
+ 'website': "http://www.itis-odoo.de",
+ 'category': 'base',
+ 'version': '1.0.55.0',
+ 'depends': ['itis_hr_extend','itis_hr_attendance_extend'],
+ 'data': [
+ 'views/hr_setting_view.xml',
+ 'security/ir.model.access.csv',
+ 'wizard/hr_sick_leave.xml'
+ ],
+ 'css': [],
+ 'demo': [],
diff --git a/itis_hr_leave_extend/i18n/de.po b/itis_hr_leave_extend/i18n/de.po
new file mode 100644
index 0000000..130f0c4
--- /dev/null
+++ b/itis_hr_leave_extend/i18n/de.po
@@ -0,0 +1,208 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * itis_hr_leave_extend
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-06-07 13:17+0000\n"
+"PO-Revision-Date: 2017-06-07 15:19+0100\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: itis_hr_leave_extend
+#: field:hr.config.settings,leave_account_id:0
+#: field:res.company,leave_account_id:0
+msgid "Analytic Account for Leave"
+msgstr "Kosenstelle für Urlaub"
+
+#. module: itis_hr_leave_extend
+#: field:hr.config.settings,ot_leave_account_id:0
+#: field:res.company,ot_leave_account_id:0
+msgid "Analytic Account for Overtime Leave"
+msgstr "Kostenstelle für Überstundenabbau"
+
+#. module: itis_hr_leave_extend
+#: view:hr.config.settings:itis_hr_leave_extend.view_human_resources_configuration
+msgid "Analytic account"
+msgstr "Kostenstelle"
+
+#. module: itis_hr_leave_extend
+#: view:hr.sick.leave:itis_hr_leave_extend.sick_leave_form_view
+msgid "Cancel"
+msgstr "Cancel"
+
+#. module: itis_hr_leave_extend
+#: model:ir.model,name:itis_hr_leave_extend.model_res_company
+msgid "Companies"
+msgstr "Unternehmen"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,create_uid:0 field:hr.sick.leave,create_uid:0
+msgid "Created by"
+msgstr "Erstellt von"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,create_date:0 field:hr.sick.leave,create_date:0
+msgid "Created on"
+msgstr "Erstellt am"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,date:0
+msgid "Date"
+msgstr "Datum"
+
+#. module: itis_hr_leave_extend
+#: field:hr.sick.leave,end_date:0
+msgid "End Date"
+msgstr "End Date"
+
+#. module: itis_hr_leave_extend
+#: model:ir.actions.act_window,name:itis_hr_leave_extend.launch_sick_leave_wizard
+msgid "Fill Employee Sick Leave"
+msgstr "Krankheitstage erfassen"
+
+#. module: itis_hr_leave_extend
+#: model:ir.actions.act_window,name:itis_hr_leave_extend.sick_leave_action
+msgid "Fill Sick Leave"
+msgstr "Krankheitstage erfassen"
+
+#. module: itis_hr_leave_extend
+#: view:hr.sick.leave:itis_hr_leave_extend.sick_leave_form_view
+msgid "Fill Sick Time"
+msgstr "Krankentage buchen."
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,holiday_id:0
+msgid "Holiday"
+msgstr "Urlaub"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,duration:0
+msgid "Hours"
+msgstr "Stunden"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,id:0 field:hr.sick.leave,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,write_uid:0 field:hr.sick.leave,write_uid:0
+msgid "Last Updated by"
+msgstr "Aktualisiert von"
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,write_date:0 field:hr.sick.leave,write_date:0
+msgid "Last Updated on"
+msgstr "Aktualisiert am"
+
+#. module: itis_hr_leave_extend
+#: model:ir.model,name:itis_hr_leave_extend.model_hr_holidays
+msgid "Leave"
+msgstr "Urlaub"
+
+#. module: itis_hr_leave_extend
+#: model:ir.model,name:itis_hr_leave_extend.model_hr_holidays_status
+msgid "Leave Type"
+msgstr "Abwesenheitstyp"
+
+#. module: itis_hr_leave_extend
+#: code:addons/itis_hr_leave_extend/models/hr_holiday.py:148
+#, python-format
+msgid "Please define cost unit for this employee."
+msgstr "Bitte definieren Sie ein Konstenjournal für diesen Mitarbeiter."
+
+#. module: itis_hr_leave_extend
+#: code:addons/itis_hr_leave_extend/models/hr_holiday.py:121
+#, python-format
+msgid ""
+"Please set the analytic account for Leaves.\n"
+"Please contact your administrator for the same."
+msgstr ""
+"Bitte hinterlegen Sie die Kostenstelle für Urlaub.Bitte kontaktieren Sie "
+"dafür Ihren Administrator."
+
+#. module: itis_hr_leave_extend
+#: code:addons/itis_hr_leave_extend/wizard/hr_sick_leave.py:55
+#, python-format
+msgid ""
+"Please set the analytic account for Sick Leaves.\n"
+"Please contact your administrator for the same."
+msgstr ""
+"Bitte hinterlegen Sie die Kostenstelle für Krankheit\n"
+"Bitte kontaktieren Sie dafür ihren Administrator."
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays.timesheet,sheet_id:0
+msgid "Sheet"
+msgstr "Sheet"
+
+#. module: itis_hr_leave_extend
+#: field:hr.sick.leave,start_date:0
+msgid "Start Date"
+msgstr "Start Date"
+
+#. module: itis_hr_leave_extend
+#: code:addons/itis_hr_leave_extend/models/hr_holiday.py:133
+#, python-format
+msgid ""
+"The Time period is allready closed. \n"
+" Please contact the Human Resource Team if the leave request should be "
+"confirmed nevertheless"
+msgstr ""
+"Die Zeiterfassung für den entsprechenden Zeitraum ist bereits "
+"abgeschlossen. \n"
+"Bitte wenden Sie sich an die Peronalabteilung, wenn der Antrag trotzdem "
+"genehmigt werden soll."
+
+#. module: itis_hr_leave_extend
+#: view:hr.sick.leave:itis_hr_leave_extend.sick_leave_form_view
+msgid "This wizard is use to fill up the time sheet when employee is sick."
+msgstr ""
+"Mit dieser Maske kann die Krankheitszeit eines Mitarbeiters in dessen "
+"Abwesenheit erfasst und gebucht werden."
+
+#. module: itis_hr_leave_extend
+#: field:hr.holidays,holidays_timesheet_ids:0
+#: field:hr.holidays.timesheet,timesheet_id:0
+#: model:ir.model,name:itis_hr_leave_extend.model_hr_timesheet_sheet_sheet
+msgid "Timesheet"
+msgstr "Zeiterfassung"
+
+#. module: itis_hr_leave_extend
+#: code:addons/itis_hr_leave_extend/models/hr_holiday.py:148
+#, python-format
+msgid "User Error!"
+msgstr "Benutzerfehler!"
+
+#. module: itis_hr_leave_extend
+#: code:addons/itis_hr_leave_extend/wizard/hr_sick_leave.py:145
+#, python-format
+msgid ""
+"User Error! \n"
+"Please define cost unit for this employee."
+msgstr ""
+"Fehler! \n"
+"Bitte legen Sie eine Kostenstelle für den Mitarbeiter fest."
+
+#. module: itis_hr_leave_extend
+#: view:hr.config.settings:itis_hr_leave_extend.view_human_resources_configuration
+msgid "for Leave"
+msgstr "für Urlaub"
+
+#. module: itis_hr_leave_extend
+#: view:hr.config.settings:itis_hr_leave_extend.view_human_resources_configuration
+msgid "for Overtime Leave"
+msgstr "für Überstundenabbau"
+
+#. module: itis_hr_leave_extend
+#: view:hr.sick.leave:itis_hr_leave_extend.sick_leave_form_view
+msgid "or"
+msgstr "or"
diff --git a/itis_hr_leave_extend/i18n/en_US.po b/itis_hr_leave_extend/i18n/en_US.po
new file mode 100644
index 0000000..abcfca2
--- /dev/null
+++ b/itis_hr_leave_extend/i18n/en_US.po
@@ -0,0 +1,835 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * itis_hr_extend
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-19 15:57+0000\n"
+"PO-Revision-Date: 2017-04-19 17:59+0100\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: itis_hr_extend
+#: field:hr.employee,five_years:0
+msgid "5-Jahres-Jubiläum"
+msgstr "5 year anniversary"
+
+#. module: itis_hr_extend
+#: selection:ld.change,type:0
+msgid "Abziehen"
+msgstr "Substract"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "Address"
+msgstr "Address"
+
+#. module: itis_hr_extend
+#: field:hr.employee,active_employee:0
+msgid "Aktiv"
+msgstr "active"
+
+#. module: itis_hr_extend
+#: field:hr.holidays,approved_at:0
+msgid "Approved/Refuse At"
+msgstr "Approved/Refuse At"
+
+#. module: itis_hr_extend
+#: field:hr.holidays,approved_by:0
+msgid "Approved/Refuse By"
+msgstr "Approved/Refuse By"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,type:0
+msgid "Ausgleich"
+msgstr "Compensation"
+
+#. module: itis_hr_extend
+#: field:hr.employee,disability_limited_until:0
+msgid "Befristet bis"
+msgstr "Limited until"
+
+#. module: itis_hr_extend
+#: field:hr.contract,limitation_reason:0
+msgid "Befristungsgrund"
+msgstr "reason of Limitation"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,description:0 field:hr.leave.journal,name:0
+msgid "Begründung"
+msgstr "reason"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:280
+#: code:addons/itis_hr_extend/models/hr_employee.py:326
+#, python-format
+msgid "Berechnung Urlaub zu Jahresbeginn"
+msgstr "calculation year leaves"
+
+#. module: itis_hr_extend
+#: field:hr.employee,bereich:0
+msgid "Bereich"
+msgstr "Section"
+
+#. module: itis_hr_extend
+#: field:itis_confession,name:0 field:itis_limitation_reason,name:0
+msgid "Bezeichnung"
+msgstr "Name"
+
+#. module: itis_hr_extend
+#: view:create.fte:itis_hr_extend.fte_wiz_form_view
+#: view:ld.change:itis_hr_extend.ld_change_form_view
+#: view:ot.change:itis_hr_extend.ot_change_form_view
+msgid "Cancel"
+msgstr "Cancel"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+#: field:itis.hr.contact,city:0
+msgid "City"
+msgstr "City"
+
+#. module: itis_hr_extend
+#: view:create.fte:itis_hr_extend.fte_wiz_form_view
+msgid "Click 'Generate' button to Generate FTE report"
+msgstr "Click 'Generate' button to Generate FTE report"
+
+#. module: itis_hr_extend
+#: field:employee.report.data,color:0
+msgid "Color"
+msgstr "Color"
+
+#. module: itis_hr_extend
+#: model:ir.actions.act_window,name:itis_hr_extend.action_itis_hr_contact
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_tree
+msgid "Contacts"
+msgstr "Contacts"
+
+#. module: itis_hr_extend
+#: model:ir.model,name:itis_hr_extend.model_hr_contract
+msgid "Contract"
+msgstr "Contract"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,contract_id:0
+msgid "Contract id"
+msgstr "Contract id"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+#: field:itis.hr.contact,country_id:0
+msgid "Country"
+msgstr "Country"
+
+#. module: itis_hr_extend
+#: field:create.fte,create_uid:0 field:employee.report,create_uid:0
+#: field:employee.report.data,create_uid:0 field:fte.records,create_uid:0
+#: field:fte.report,create_uid:0 field:hr.employee.fte,create_uid:0
+#: field:hr.family.status,create_uid:0 field:hr.health.insurance,create_uid:0
+#: field:hr.leave.journal,create_uid:0 field:itis.hr.contact,create_uid:0
+#: field:itis.leave.days.calc.error,create_uid:0
+#: field:itis_confession,create_uid:0
+#: field:itis_employee_children,create_uid:0
+#: field:itis_limitation_reason,create_uid:0 field:ld.change,create_uid:0
+#: field:ot.change,create_uid:0
+msgid "Created by"
+msgstr "Created by"
+
+#. module: itis_hr_extend
+#: field:create.fte,create_date:0 field:employee.report,create_date:0
+#: field:employee.report.data,create_date:0 field:fte.records,create_date:0
+#: field:fte.report,create_date:0 field:hr.employee.fte,create_date:0
+#: field:hr.family.status,create_date:0
+#: field:hr.health.insurance,create_date:0
+#: field:hr.leave.journal,create_date:0 field:itis.hr.contact,create_date:0
+#: field:itis.leave.days.calc.error,create_date:0
+#: field:itis_confession,create_date:0
+#: field:itis_employee_children,create_date:0
+#: field:itis_limitation_reason,create_date:0 field:ld.change,create_date:0
+#: field:ot.change,create_date:0
+msgid "Created on"
+msgstr "Created on"
+
+#. module: itis_hr_extend
+#: field:employee.report,name:0 field:fte.report,name:0
+msgid "Date"
+msgstr "Date"
+
+#. module: itis_hr_extend
+#: field:fte.records,department_id:0 field:hr.employee.fte,department_id:0
+msgid "Department"
+msgstr "Department"
+
+#. module: itis_hr_extend
+#: field:fte.records,diff_fte:0
+msgid "Difference FTE"
+msgstr "Difference FTE"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,email:0
+msgid "Email"
+msgstr "Email"
+
+#. module: itis_hr_extend
+#: field:employee.report.data,employee_id:0 field:hr.employee.fte,emp_id:0
+#: model:ir.model,name:itis_hr_extend.model_hr_employee
+msgid "Employee"
+msgstr "Employee"
+
+#. module: itis_hr_extend
+#: field:employee.report.data,employee_report_id:0
+#: model:ir.actions.act_window,name:itis_hr_extend.employee_report_action
+#: model:ir.ui.menu,name:itis_hr_extend.menu_employee_report
+msgid "Employee Report"
+msgstr "Employee Report"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,employee_id:0
+msgid "Employee id"
+msgstr "Employee id"
+
+#. module: itis_hr_extend
+#: view:employee.report:itis_hr_extend.itis_employee_report_tree
+#: field:employee.report,employee_ids:0
+msgid "Employees"
+msgstr "Employees"
+
+#. module: itis_hr_extend
+#: field:fte.records,fte:0 field:hr.employee.fte,fte:0
+msgid "FTE"
+msgstr "FTE"
+
+#. module: itis_hr_extend
+#: view:fte.records:itis_hr_extend.itis_fte_records_form
+#: view:fte.report:itis_hr_extend.itis_fte_report_form
+#: field:fte.report,fte_ids:0
+msgid "FTE Records"
+msgstr "FTE Records"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/wizard/fte_wizard.py:108
+#: field:fte.records,fte_id:0
+#: view:fte.report:itis_hr_extend.itis_fte_report_tree
+#: model:ir.actions.act_window,name:itis_hr_extend.fte_report_action
+#: model:ir.actions.act_window,name:itis_hr_extend.fte_window_action
+#, python-format
+msgid "FTE Report"
+msgstr "FTE Report"
+
+#. module: itis_hr_extend
+#: model:ir.ui.menu,name:itis_hr_extend.menu_fte_report
+msgid "FTE Reports"
+msgstr "FTE Reports"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "FTE(%)"
+msgstr "FTE(%)"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+#: field:hr.employee,fte_ids:0
+msgid "FTEs"
+msgstr "FTEs"
+
+#. module: itis_hr_extend
+#: view:hr.family.status:itis_hr_extend.itis_family_status_form
+#: view:hr.family.status:itis_hr_extend.itis_family_status_tree
+#: model:ir.actions.act_window,name:itis_hr_extend.hr_family_status_action
+#: model:ir.ui.menu,name:itis_hr_extend.menu_family_status
+#: view:itis.leave.days.calc.error:itis_hr_extend.itis_leave_days_calc_error_tree
+msgid "Family Status"
+msgstr "Family Status"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,fax:0
+msgid "Fax"
+msgstr "Fax"
+
+#. module: itis_hr_extend
+#: model:ir.actions.act_window,name:itis_hr_extend.leave_days_calc_error_action
+#: model:ir.ui.menu,name:itis_hr_extend.menu_days_calc_error
+msgid "Fehler Urlaubsberechnung"
+msgstr "leave Calculation Errors"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:384
+#, python-format
+msgid ""
+"Fehler automatische Kalkulation durch keine durchgängigen Arbeitsverträge"
+msgstr "error automatic calculation due to gaps between contracts"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:387
+#, python-format
+msgid "Fehler automatische Kalkulation durch Änderung Urlaubsanspruch"
+msgstr "error automatic calculation due to change of base leave"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:390
+#, python-format
+msgid "Fehler automatische Kalkulation durch Änderung Wochenarbeitstage"
+msgstr "error automatic calculation due to change of work days a week"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:317
+#, python-format
+msgid "Fehler in Berechnung"
+msgstr "error in calculation"
+
+#. module: itis_hr_extend
+#: field:itis.leave.days.calc.error,error:0
+msgid "Fehlermeldung"
+msgstr "error meassage"
+
+#. module: itis_hr_extend
+#: field:itis_employee_children,birth_date:0
+msgid "Geburtsdatum"
+msgstr "birthdate"
+
+#. module: itis_hr_extend
+#: field:hr.employee,birth_name:0
+msgid "Geburtsname"
+msgstr "birth name"
+
+#. module: itis_hr_extend
+#: view:create.fte:itis_hr_extend.fte_wiz_form_view
+msgid "Generate"
+msgstr "Generate"
+
+#. module: itis_hr_extend
+#: model:ir.ui.menu,name:itis_hr_extend.menu_fte_report_generate
+msgid "Generate FTE Report"
+msgstr "Generate FTE Report"
+
+#. module: itis_hr_extend
+#: field:employee.report.data,sum_leaves:0
+msgid "Gesamtanspruch"
+msgstr "Sum Leaves"
+
+#. module: itis_hr_extend
+#: model:ir.ui.menu,name:itis_hr_extend.itis_hr_contact_menu
+msgid "HR Contacts"
+msgstr "HR Contacts"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+#: view:hr.employee:itis_hr_extend.view_employee_form_inherit_itis
+msgid "HR Settings"
+msgstr "HR Settings"
+
+#. module: itis_hr_extend
+#: view:hr.health.insurance:itis_hr_extend.itis_health_insurance_form
+#: view:hr.health.insurance:itis_hr_extend.itis_health_insurance_tree
+#: model:ir.actions.act_window,name:itis_hr_extend.hr_health_action
+#: model:ir.ui.menu,name:itis_hr_extend.menu_health_insurance
+msgid "Health Insurance"
+msgstr "Health Insurance"
+
+#. module: itis_hr_extend
+#: selection:ld.change,type:0
+msgid "Hinzufügen"
+msgstr "Add"
+
+#. module: itis_hr_extend
+#: field:create.fte,id:0 field:employee.report,id:0
+#: field:employee.report.data,id:0 field:fte.records,id:0
+#: field:fte.report,id:0 field:hr.employee.fte,id:0
+#: field:hr.family.status,id:0 field:hr.health.insurance,id:0
+#: field:hr.leave.journal,id:0 field:itis.hr.contact,id:0
+#: field:itis.leave.days.calc.error,id:0 field:itis_confession,id:0
+#: field:itis_employee_children,id:0 field:itis_limitation_reason,id:0
+#: field:ld.change,id:0 field:ot.change,id:0
+msgid "ID"
+msgstr "ID"
+
+#. module: itis_hr_extend
+#: field:hr.holidays,is_ot_leave:0
+msgid "Is OT Leave"
+msgstr "Is Overtime Leave"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,disability:0
+msgid "Ja"
+msgstr "Yes"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,year:0 field:itis.leave.days.calc.error,year:0
+msgid "Jahr"
+msgstr "Year"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:304
+#, python-format
+msgid "Kein Vertrag am 01.Januar vorhanden"
+msgstr "No contract on January 01."
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+#: field:hr.employee,children_ids:0
+msgid "Kinder"
+msgstr "Children"
+
+#. module: itis_hr_extend
+#: field:hr.employee,confession:0
+msgid "Konfession"
+msgstr "Confession"
+
+#. module: itis_hr_extend
+#: field:hr.employee,health_insurance:0
+msgid "Krankenkasse"
+msgstr "health Insurance company"
+
+#. module: itis_hr_extend
+#: field:create.fte,write_uid:0 field:employee.report,write_uid:0
+#: field:employee.report.data,write_uid:0 field:fte.records,write_uid:0
+#: field:fte.report,write_uid:0 field:hr.employee.fte,write_uid:0
+#: field:hr.family.status,write_uid:0 field:hr.health.insurance,write_uid:0
+#: field:hr.leave.journal,write_uid:0 field:itis.hr.contact,write_uid:0
+#: field:itis.leave.days.calc.error,write_uid:0
+#: field:itis_confession,write_uid:0 field:itis_employee_children,write_uid:0
+#: field:itis_limitation_reason,write_uid:0 field:ld.change,write_uid:0
+#: field:ot.change,write_uid:0
+msgid "Last Updated by"
+msgstr "Last Updated by"
+
+#. module: itis_hr_extend
+#: field:create.fte,write_date:0 field:employee.report,write_date:0
+#: field:employee.report.data,write_date:0 field:fte.records,write_date:0
+#: field:fte.report,write_date:0 field:hr.employee.fte,write_date:0
+#: field:hr.family.status,write_date:0 field:hr.health.insurance,write_date:0
+#: field:hr.leave.journal,write_date:0 field:itis.hr.contact,write_date:0
+#: field:itis.leave.days.calc.error,write_date:0
+#: field:itis_confession,write_date:0
+#: field:itis_employee_children,write_date:0
+#: field:itis_limitation_reason,write_date:0 field:ld.change,write_date:0
+#: field:ot.change,write_date:0
+msgid "Last Updated on"
+msgstr "Last Updated on"
+
+#. module: itis_hr_extend
+#: model:ir.model,name:itis_hr_extend.model_hr_holidays
+msgid "Leave"
+msgstr "Leave"
+
+#. module: itis_hr_extend
+#: field:ld.change,leave_day:0 field:ot.change,leave_day:0
+msgid "Leave Day"
+msgstr "Leave Day"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_id:0
+msgid "Leave id"
+msgstr "Leave id"
+
+#. module: itis_hr_extend
+#: field:hr.employee,leave_journal_ids:0
+msgid "Leave journal ids"
+msgstr "Leave journal ids"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_type:0
+msgid "Leave type"
+msgstr "Leave type"
+
+#. module: itis_hr_extend
+#: model:ir.actions.act_window,name:itis_hr_extend.act_hr_leaves_overview
+msgid "Leaves"
+msgstr "Leaves"
+
+#. module: itis_hr_extend
+#: field:hr.holidays,ljournal_ids:0
+msgid "Ljournal ids"
+msgstr "Ljournal ids"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,type:0
+msgid "Manuell"
+msgstr "Manual"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:295
+#: code:addons/itis_hr_extend/models/hr_employee.py:302
+#, python-format
+msgid "Mehr als ein Vertrag zum 01.Januar"
+msgstr "More than one contract on January 01."
+
+#. module: itis_hr_extend
+#: model:ir.model,name:itis_hr_extend.model_mail_message
+msgid "Message"
+msgstr "Message"
+
+#. module: itis_hr_extend
+#: field:itis.leave.days.calc.error,name:0
+#: field:itis_employee_children,parent_id:0
+msgid "Mitarbeiter"
+msgstr "Employee"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Mitarbeiter/in"
+msgstr "Employee"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,mobile:0
+msgid "Mobile"
+msgstr "Mobile"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.view_employee_form_inherit_itis
+msgid "Monatlich Lohnrelevante Informationen"
+msgstr "salary export information"
+
+#. module: itis_hr_extend
+#: field:hr.employee,second_name:0
+msgid "Nachname"
+msgstr "Surname"
+
+#. module: itis_hr_extend
+#: field:hr.health.insurance,name:0
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_tree
+#: field:itis.hr.contact,name:0 field:itis_employee_children,name:0
+msgid "Name"
+msgstr "Name"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/employee_report.py:42
+#, python-format
+msgid "No associated employee found with user"
+msgstr "No associated employee found with user"
+
+#. module: itis_hr_extend
+#: field:hr.employee,emergency_contact:0
+msgid "Notfallkontakt"
+msgstr "emergency contact"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:106
+#: code:addons/itis_hr_extend/models/hr_holiday.py:119
+#, python-format
+msgid "Only the Manager of this employee can approve this leave request."
+msgstr "Only the Manager of this employee can approve this leave request."
+
+#. module: itis_hr_extend
+#: field:employee.report.data,overtime_count:0
+#: field:hr.employee,overtime_count:0 field:ot.change,ot_time:0
+msgid "Overtime Count"
+msgstr "Overtime Count"
+
+#. module: itis_hr_extend
+#: model:hr.holidays.status,name:itis_hr_extend.itis_leave_overtime
+msgid "Overtime Leave"
+msgstr "Overtime Leave"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:180
+#: code:addons/itis_hr_extend/models/hr_employee.py:202
+#, python-format
+msgid "Overtime has been chagned from %s to %s. Reason : %s"
+msgstr "Overtime has been chagned from %s to %s. Reason : %s"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,phone:0
+msgid "Phone"
+msgstr "Phone"
+
+#. module: itis_hr_extend
+#: field:fte.records,planned_fte:0 field:hr.department,planned_fte:0
+msgid "Planned FTE"
+msgstr "Planned FTE"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:295
+#: code:addons/itis_hr_extend/models/hr_holiday.py:315
+#, python-format
+msgid "Please create a leave request for every year."
+msgstr "Please create a leave request for every year."
+
+#. module: itis_hr_extend
+#: field:ld.change,reason:0 field:ot.change,reason:0
+msgid "Reason"
+msgstr "reason"
+
+#. module: itis_hr_extend
+#: model:ir.ui.menu,name:itis_hr_extend.menu_hr_reports
+msgid "Reports"
+msgstr "Reports"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,year_type:0
+msgid "Restanspruch"
+msgstr "Remainig last year leaves"
+
+#. module: itis_hr_extend
+#: field:hr.employee,disability:0
+msgid "Schwerbehinderung"
+msgstr "Disability"
+
+#. module: itis_hr_extend
+#: view:hr.leave.journal:itis_hr_extend.itis_hr_leave_journal_form
+msgid "Search Leave"
+msgstr "Search Leave"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Sozialversicherungsnummer"
+msgstr "social security number"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+#: field:itis.hr.contact,state_id:0
+msgid "State"
+msgstr "State"
+
+#. module: itis_hr_extend
+#: field:hr.family.status,name:0
+msgid "Status"
+msgstr "Status"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Steuer-ID"
+msgstr "tax-ID"
+
+#. module: itis_hr_extend
+#: field:hr.employee,taxclass:0
+msgid "Steuerklasse"
+msgstr "tax category"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 1"
+msgstr "Steuerklasse 1"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 2"
+msgstr "Steuerklasse 2"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 3"
+msgstr "Steuerklasse 3"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 4"
+msgstr "Steuerklasse 4"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 5"
+msgstr "Steuerklasse 5"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,taxclass:0
+msgid "Steuerklasse 6"
+msgstr "Steuerklasse 6"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,street:0
+msgid "Street"
+msgstr "Street"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "Street 2..."
+msgstr "Street 2..."
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "Street..."
+msgstr "Street..."
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,street2:0
+msgid "Street2"
+msgstr "Street2"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_hours:0
+#: selection:hr.leave.journal,leave_type:0
+msgid "Stunden"
+msgstr "Hours"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_days:0 selection:hr.leave.journal,leave_type:0
+msgid "Tage"
+msgstr "Days"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Telefon (interne Durchwahl)"
+msgstr "Telefone number (internal)"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_holiday.py:71
+#, python-format
+msgid ""
+"The number of remaining leaves is not sufficient for this leave type.\n"
+"Please verify also the leaves waiting for validation."
+msgstr ""
+"The number of remaining leaves is not sufficient for this leave type.Please "
+"verify also the leaves waiting for validation."
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:223
+#, python-format
+msgid "There are 2 contracts assigned to this employee."
+msgstr "There are 2 contracts assigned to this employee."
+
+#. module: itis_hr_extend
+#: view:hr.contract:itis_hr_extend.hr_contract_view_form_itis
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "True"
+msgstr "True"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,type:0 field:ld.change,type:0
+msgid "Type"
+msgstr "Type"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:258
+#: code:addons/itis_hr_extend/models/hr_employee.py:269
+#, python-format
+msgid "Umwandlung Resturlaub"
+msgstr "transfer remaining leaves"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Update"
+msgstr "Update"
+
+#. module: itis_hr_extend
+#: field:hr.contract,base_leaves:0
+msgid "Urlaubsanspruch"
+msgstr "leave entitlement"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Urlaubsjournal"
+msgstr "Leave Journal"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/employee_report.py:44
+#, python-format
+msgid "User is associated with multiple employee"
+msgstr "User is associated with multiple employee"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:420
+#, python-format
+msgid "Verfall Resturlaub"
+msgstr "deletion remaining last year leaves"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,type:0
+msgid "Vertraglich"
+msgstr "based on contract"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "Vertragsinformationen"
+msgstr "contract informationen"
+
+#. module: itis_hr_extend
+#: field:hr.employee,surname:0
+msgid "Vorname"
+msgstr "First name"
+
+#. module: itis_hr_extend
+#: field:hr.employee,wage_info:0
+msgid "Wage Information"
+msgstr "Wage Information"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,year_type:0
+msgid "Year type"
+msgstr "Year type"
+
+#. module: itis_hr_extend
+#: view:itis.hr.contact:itis_hr_extend.itis_hr_contact_form
+msgid "ZIP"
+msgstr "ZIP"
+
+#. module: itis_hr_extend
+#: field:hr.employee,sign_permission:0
+msgid "Zeichnungsbefugnis"
+msgstr "signing rights"
+
+#. module: itis_hr_extend
+#: field:itis.hr.contact,zip:0
+msgid "Zip"
+msgstr "Zip"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,type:0
+msgid "Zusatzurlaub"
+msgstr "additional leaves"
+
+#. module: itis_hr_extend
+#: selection:hr.leave.journal,year_type:0
+msgid "aktuell"
+msgstr "actual"
+
+#. module: itis_hr_extend
+#: view:hr.payslip:itis_hr_extend.hr_payroll_view_hr_payslip_form_itis
+msgid "base.group_hr_payroll_manager"
+msgstr "base.group_hr_payroll_manager"
+
+#. module: itis_hr_extend
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_form_itis
+msgid "base.group_user"
+msgstr "base.group_user"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_end:0
+msgid "bis"
+msgstr "to"
+
+#. module: itis_hr_extend
+#: view:hr.employee:itis_hr_extend.hr_hr_employee_view_form_itis
+msgid "e.g. Part Time"
+msgstr "e.g. Part Time"
+
+#. module: itis_hr_extend
+#: view:hr.holidays:itis_hr_extend.hr_holidays_view_form_itis
+msgid "hours"
+msgstr "hours"
+
+#. module: itis_hr_extend
+#: selection:hr.employee,disability:0
+msgid "nein"
+msgstr "no"
+
+#. module: itis_hr_extend
+#: view:create.fte:itis_hr_extend.fte_wiz_form_view
+#: view:ld.change:itis_hr_extend.ld_change_form_view
+#: view:ot.change:itis_hr_extend.ot_change_form_view
+msgid "or"
+msgstr "or"
+
+#. module: itis_hr_extend
+#: field:hr.leave.journal,leave_start:0
+msgid "von"
+msgstr "of"
+
+#. module: itis_hr_extend
+#: field:hr.employee,emergency_contact2:0
+msgid "zweiter Notfallkontakt"
+msgstr "second emergency contact"
+
+#. module: itis_hr_extend
+#: code:addons/itis_hr_extend/models/hr_employee.py:307
+#, python-format
+msgid "Überschneidende Verträge"
+msgstr "two contracts on the same date"
diff --git a/itis_hr_leave_extend/models/__init__.py b/itis_hr_leave_extend/models/__init__.py
new file mode 100644
index 0000000..10c6dda
--- /dev/null
+++ b/itis_hr_leave_extend/models/__init__.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import hr_holiday
diff --git a/itis_hr_leave_extend/models/hr_holiday.py b/itis_hr_leave_extend/models/hr_holiday.py
new file mode 100644
index 0000000..3d7ad1e
--- /dev/null
+++ b/itis_hr_leave_extend/models/hr_holiday.py
@@ -0,0 +1,333 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, api, fields, _
+from openerp.osv import osv
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from datetime import datetime, timedelta
+from openerp.exceptions import Warning
+import math
+from openerp import SUPERUSER_ID
+
+
+class HRHolidayTimesheet(models.Model):
+
+ _name = "hr.holidays.timesheet"
+
+ date = fields.Date('Date')
+ holiday_id = fields.Many2one("hr.holidays", "Holiday")
+ sheet_id = fields.Many2one('hr_timesheet_sheet.sheet', 'Sheet')
+ timesheet_id = fields.Many2one("hr.analytic.timesheet", "Timesheet")
+ duration = fields.Float("Hours")
+
+class HRTimesheetSheet(models.Model):
+
+ _inherit = "hr_timesheet_sheet.sheet"
+
+ @api.model
+ def create(self, values):
+ res = super(HRTimesheetSheet, self).create(values)
+ res.calc_leave_hours()
+ return res
+
+ @api.multi
+ def calc_leave_hours(self):
+ leave_obj = self.env['hr.holidays']
+ leave_recs = leave_obj.search([('employee_id', '=', self.employee_id.id), ('state', '=', 'validate'), ('state', '!=', 'refuse')])
+ for leave in leave_recs:
+ leave_processed = True
+ for hl_ts_rec in leave.holidays_timesheet_ids:
+ if not hl_ts_rec.timesheet_id:
+ #print"Calc leave hours - No Timesheet_id", hl_ts_rec
+ leave_processed = False
+ if not leave_processed:
+ leave.make_timesheet_entry()
+
+class HRHoliday(models.Model):
+
+ _inherit = "hr.holidays"
+
+ holidays_timesheet_ids = fields.One2many("hr.holidays.timesheet", "holiday_id", "Timesheet")
+
+ @api.multi
+ def holidays_refuse(self):
+ res = super(HRHoliday, self).holidays_refuse()
+ for hl_ts_rec in self.sudo().holidays_timesheet_ids:
+ hl_ts_rec.timesheet_id.unlink()
+ hl_ts_rec.write({'sheet_id': False})
+ return res
+
+ @api.multi
+ def holidays_validate(self):
+ res = super(HRHoliday, self).holidays_validate()
+ self.make_timesheet_entry()
+ return res
+
+ @api.multi
+ def make_holidays_timesheet(self, res):
+ result = []
+ holi_ts_obj = self.env['hr.holidays.timesheet']
+ cur_recs = holi_ts_obj.search([('holiday_id', '=', self.id)])
+ res_days = res.keys()
+ for rec in cur_recs:
+ if rec.date not in res_days:
+ rec.unlink()
+ for day, duration in res.iteritems():
+ holiday = None
+ holiday = self.env['itis.holiday'].search([('date', '=', day)])
+ if holiday:
+ continue
+ cur_rec = holi_ts_obj.search([('holiday_id', '=', self.id), ('date', '=', day)])
+ if not cur_rec.id:
+ cur_rec = holi_ts_obj.create({'date': day, 'duration': duration, "holiday_id": self.id})
+ if cur_rec.duration != duration:
+ cur_rec.update({'duration': duration})
+ result.append(cur_rec)
+ return result
+
+ @api.multi
+ def make_timesheet_entry(self):
+ res = self.count_day_hours_leave()
+ res = self.make_holidays_timesheet(res)
+ account_id = False
+ if self.is_ot_leave:
+ account_id = self.env.user.company_id.ot_leave_account_id
+ else:
+ account_id = self.env.user.company_id.leave_account_id
+ if not account_id:
+ raise Warning(_('Please set the analytic account for Leaves.\nPlease contact your administrator for the same.'))
+ sheet_obj = self.env['hr_timesheet_sheet.sheet']
+ timesheets = sheet_obj.search([("employee_id", '=', self.employee_id.id)])
+ for hl_ts_rec in res:
+ if hl_ts_rec.timesheet_id:
+ continue
+ cur_day = datetime.strptime(hl_ts_rec.date, DEFAULT_SERVER_DATE_FORMAT)
+ for timesheet in timesheets:
+ ts_date_from = datetime.strptime(timesheet.date_from, DEFAULT_SERVER_DATE_FORMAT)
+ ts_date_to = datetime.strptime(timesheet.date_to, DEFAULT_SERVER_DATE_FORMAT)
+ if cur_day >= ts_date_from and cur_day <= ts_date_to:
+ if timesheet.state != 'draft':
+ continue
+ #raise Warning(_('The Time period is allready closed. \n Please contact the Human Resource Team if the leave request should be confirmed nevertheless'))
+ #print"cur_day ", cur_day
+ ana_ts_id = self.create_timesheet(account_id, timesheet, hl_ts_rec.duration, hl_ts_rec.date)
+ hl_ts_rec.write({'timesheet_id': ana_ts_id[0], 'sheet_id': timesheet.id})
+ return True
+
+ @api.one
+ def create_timesheet(self, account_id, sheet, duration, day):
+ timesheet_obj = self.pool.get('hr.analytic.timesheet')
+ cr = self.env.cr
+ uid = self.env.uid
+ emp_obj = self.env['hr.employee']
+ hour = duration
+ res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
+ # res.update({
+ # 'general_account_id': False,
+ # })
+ if not res['product_id']:
+ res['product_id'] = 1
+ if not res['product_uom_id']:
+ res['product_uom_id'] = 5
+ if not res['product_uom_id']:
+ raise osv.except_osv(_('User Error!'), _('Please define cost unit for this employee.'))
+ up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour,False, res['product_uom_id'])['value']
+ print"UP ", up
+ res['name'] = "Leave on " + day
+ res['account_id'] = account_id.id
+ res['unit_amount'] = hour
+ emp_journal = emp_obj.search([('user_id', '=', self.employee_id.user_id.id)]).journal_id
+ res['journal_id'] = emp_journal and emp_journal.id or False
+ res.update(up)
+ up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
+ res.update(up)
+ print"RES ", res
+ # if not res['general_account_id']:
+ # res['general_account_id'] = 698
+ res.update({
+ 'date': day,
+ 'user_id': self.employee_id.user_id.id,
+ 'sheet_id': sheet.id,
+ })
+ return timesheet_obj.create(cr, SUPERUSER_ID, res)
+
+ @api.multi
+ def count_day_hours_leave(self):
+ res = {}
+ date_from = datetime.strptime(self.date_from, DEFAULT_SERVER_DATETIME_FORMAT)
+ date_to = datetime.strptime(self.date_to, DEFAULT_SERVER_DATETIME_FORMAT)
+ same_day = self.check_same_day(date_from, date_to)
+ temp_date = date_from
+ day_hours = 0.0
+ weekday = temp_date.weekday()
+ for contract in self.employee_id.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ if same_day:
+ cur_hour = self.get_day_hours(date_from, contract.working_hours.attendance_ids)
+ day_hours = cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ if self.leave_selection =='half_day':
+ new_hour =new_hour/2
+ res.update({day_str: new_hour})
+ else:
+ fday_cur_hour = self.get_day_hours(date_from, contract.working_hours.attendance_ids)
+ day_hours += fday_cur_hour
+ lday_cur_hour = self.get_day_hours(date_to, contract.working_hours.attendance_ids)
+ day_hours = lday_cur_hour
+ fday_str = datetime.strftime(date_from, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ fday_new_hour = res.get(fday_str, 0.0) + fday_cur_hour
+ if self.leave_selection =='half_day':
+ fday_new_hour =fday_new_hour/2
+ res.update({fday_str: fday_new_hour})
+ lday_str = datetime.strftime(date_to, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ lday_new_hour = res.get(lday_str, 0.0) + lday_cur_hour
+ if self.leave_selection_date_to =='half_day':
+ lday_new_hour =lday_new_hour/2
+ #if temp_date == self.start_date and self.start_date_leave_selection == 'half_day':
+ # lday_new_hour =lday_new_hour/2
+ #elif temp_date == self.end_date and self.end_date_leave_selection == 'half_day':
+ # lday_new_hour =lday_new_hour/2
+ res.update({lday_str: lday_new_hour})
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date += timedelta(days=1)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ if same_day:
+ cur_hour = self.get_day_hours(date_from, contract.working_hours.attendance_ids)
+ day_hours += cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ if self.leave_selection =='half_day':
+ new_hour =new_hour/2
+ res.update({day_str: new_hour})
+ else:
+ fday_cur_hour = self.get_day_hours(date_from, contract.working_hours.attendance_ids)
+ day_hours += fday_cur_hour
+ lday_cur_hour = self.get_day_hours(date_to, contract.working_hours.attendance_ids)
+ day_hours = lday_cur_hour
+ fday_str = datetime.strftime(date_from, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ fday_new_hour = res.get(fday_str, 0.0) + fday_cur_hour
+ if self.leave_selection =='half_day':
+ fday_new_hour =fday_new_hour/2
+ res.update({fday_str: fday_new_hour})
+ lday_str = datetime.strftime(date_to, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ lday_new_hour = res.get(lday_str, 0.0) + lday_cur_hour
+ if self.leave_selection_date_to =='half_day':
+ lday_new_hour =lday_new_hour/2
+ res.update({lday_str: lday_new_hour})
+ date_from = datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ date_to = datetime.strptime(self.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ temp_date = date_from
+ temp_date += timedelta(days=1)
+ while temp_date < date_to:
+ weekday = temp_date.weekday()
+ for contract in self.employee_id.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ cur_hour = self.get_hours(weekday, contract.working_hours.attendance_ids)
+ day_hours += cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATE_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ res.update({day_str: new_hour})
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+# cont_end_date += timedelta(days=1)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ cur_hour = self.get_hours(weekday, contract.working_hours.attendance_ids)
+ day_hours = cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATE_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ res.update({day_str: new_hour})
+
+ temp_date += timedelta(days=1)
+ return res
+
+ @api.onchange("number_of_days_temp","leave_selection","leave_selection_date_to")
+ def calc_days(self):
+ res = 0
+ if not self.date_from or not self.date_to:
+ return {}
+ date_from = datetime.strptime(self.date_from.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ date_to = datetime.strptime(self.date_to.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ # if date_from == date_to:
+ # if self.leave_selection =='half_day' or self.leave_selection_date_to =='half_day':
+ # self.number_of_days_temp = 0.5
+ # return {}
+ temp_date = date_from
+ while temp_date <= date_to:
+ holiday = None
+ holiday = self.env['itis.holiday'].search([('date', '=', temp_date)])
+ if holiday:
+ temp_date += timedelta(days=1)
+ continue
+ weekday = temp_date.weekday()
+ for contract in self.employee_id.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ if self.get_hours(weekday, contract.working_hours.attendance_ids) > 0.0:
+ if temp_date == date_from and self.leave_selection =='half_day':
+ res += 0.25
+ break
+ if temp_date == date_to and self.leave_selection_date_to =='half_day':
+ res += 0.25
+ break
+ res += 1
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+# cont_end_date += timedelta(days=1)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ if self.get_hours(weekday, contract.working_hours.attendance_ids) > 0.0:
+ if temp_date == date_from and self.leave_selection =='half_day':
+ res += 0.25
+ break
+ if temp_date == date_to and self.leave_selection_date_to =='half_day':
+ res += 0.25
+ break
+ res += 1
+ temp_date += timedelta(days=1)
+ self.number_of_days_temp = res
+ return {}
+
+class HRHolidayStatus(models.Model):
+
+ _inherit = "hr.holidays.status"
+
+ def name_get(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ if not context.get('employee_id',False):
+ # leave counts is based on employee_id, would be inaccurate if not based on correct employee
+ return super(HRHolidayStatus, self).name_get(cr, uid, ids, context=context)
+
+ res = []
+ for record in self.browse(cr, uid, ids, context=context):
+ name = record.name
+ if not record.limit:
+ name = name
+ res.append((record.id, name))
+ return res
diff --git a/itis_hr_leave_extend/security/ir.model.access.csv b/itis_hr_leave_extend/security/ir.model.access.csv
new file mode 100644
index 0000000..80cfbae
--- /dev/null
+++ b/itis_hr_leave_extend/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_hr_holidays_timesheet,access_hr_holidays_timesheet,model_hr_holidays_timesheet,base.group_user,1,1,1,1
+access_hr_sick_leave,access_hr_sick_leave,model_hr_sick_leave,base.group_hr_manager,1,1,1,1
\ No newline at end of file
diff --git a/itis_hr_leave_extend/tests/__init__.py b/itis_hr_leave_extend/tests/__init__.py
new file mode 100644
index 0000000..1b6d2d6
--- /dev/null
+++ b/itis_hr_leave_extend/tests/__init__.py
@@ -0,0 +1 @@
+from . import test_hr_leave_extend
\ No newline at end of file
diff --git a/itis_hr_leave_extend/tests/test_hr_leave_extend.py b/itis_hr_leave_extend/tests/test_hr_leave_extend.py
new file mode 100644
index 0000000..e30ecc8
--- /dev/null
+++ b/itis_hr_leave_extend/tests/test_hr_leave_extend.py
@@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-
+
+from openerp.tests.common import TransactionCase
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
+from openerp.osv.orm import except_orm
+import logging
+_logger = logging.getLogger(__name__)
+
+class TestHrLeave(TransactionCase):
+
+ def setUp(self):
+ super(TestHrLeave, self).setUp()
+ cr, uid = self.cr, self.uid
+
+ # Find Employee group
+ group_employee_ref = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_user')
+ self.group_employee_id = group_employee_ref and group_employee_ref[1] or False
+
+ # Find Hr User group
+ group_hr_user_ref = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_hr_user')
+ self.group_hr_user_ref_id = group_hr_user_ref and group_hr_user_ref[1] or False
+
+ # Find Hr Manager group
+ group_hr_manager_ref = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_hr_manager')
+ self.group_hr_manager_ref_id = group_hr_manager_ref and group_hr_manager_ref[1] or False
+
+
+
+ self.test_hrmanager_user = self.env['res.users'].create({
+ 'name': 'Bastien HrManager',
+ 'login': 'bastien',
+ 'alias_name': 'bastien',
+ 'email': 'bastien.hrmanager@example.com',
+ 'groups_id': [(6, 0, [self.group_employee_id, self.group_hr_manager_ref_id])]
+ })
+
+ self.test_hrmanager_employee = self.env['hr.employee'].create({
+ 'name': 'Hr Manager Test',
+ 'user_id':self.test_hrmanager_user.id,
+ })
+
+
+ self.test_user = self.env['res.users'].create({
+ 'name': 'Agrolait Test User',
+ 'login': 'user',
+ 'email': 'hro@example.com',
+ 'signature': '--\nAgr',
+ 'groups_id': [(6, 0, [self.group_employee_id])]
+ })
+
+ self.test_employee = self.env['hr.employee'].create({
+ 'name': 'Agrolait Test Emp',
+ 'user_id':self.test_user.id,
+ 'parent_id':self.test_hrmanager_employee.id,
+ })
+
+ working_hours = self.env["resource.calendar"].search([('name','=','45 Hours/Week')])
+ struct_id = self.env["hr.payroll.structure"].search([])
+ today_date = datetime.now().date()
+ test_contract = self.env['hr.contract'].create({
+ 'name':'test employee contract',
+ 'employee_id':self.test_employee.id,
+ 'struct_id':struct_id[0].id,
+ 'wage':100,
+ 'date_start':str(today_date.replace(month=01,day=01)),
+ 'date_end':str(today_date.replace(month=12,day=01)),
+ 'working_hours':working_hours.id,
+ })
+
+ def test_fillup_sick_leave(self):
+ """test case to test the sick leave fill up functionality"""
+ hr_sick_leave = self.env["hr.sick.leave"]
+ hr_analytic_timesheet =self.env['hr.analytic.timesheet']
+ today_date = datetime.now().date()
+ end_date = today_date+relativedelta(days=1)
+ hr_sick_leave_rec = hr_sick_leave.create({
+ 'start_date':today_date,
+ 'end_date':end_date,
+ })
+
+ hr_sick_leave_rec.with_context(active_ids = [self.test_employee.id]).confirm_sick_time()
+ leave_record = hr_analytic_timesheet.search([('date','>=',today_date),('date','<=',end_date),('user_id','<=',self.test_user.id)])
+ print"leave_record------",leave_record
+ if leave_record:
+ _logger.info('-----Sick leave is created.')
+ else:
+ self.assertEqual(1,2,'Sick leave is not created.')
+
+ def test_create_timesheet(self):
+ """test case to test creation of timesheet and planned,fillup hours,closed timesheet"""
+ account_journal = self.env['account.analytic.journal'].search([])
+ account_analytic = self.env['account.analytic.account'].search([('use_timesheets','=',True),('type','=','contract')])
+ timesheet_sheet = self.env['hr_timesheet_sheet.sheet'].create({
+ 'date_from': str(datetime.today()),
+ 'date_to': str(datetime.today()),
+ 'name': 'Agrolait Test',
+ 'state': 'new',
+ 'user_id': self.test_user.id,
+ 'employee_id': self.test_employee.id,
+ 'timesheet_ids': [(0, 0, {
+ 'date': str(datetime.today()),
+ 'name': 'Develop yaml for hr module(1)',
+ 'user_id': self.test_user.id,
+ 'unit_amount': 8.00,
+ 'journal_id':account_journal[0].id,
+ 'account_id':account_analytic[0].id,
+ })]})
+
+ try:
+ timesheet_sheet.action_timesheet_confirm()
+ except Exception:
+ pass
+ print"Planned hour--------",timesheet_sheet.total_contract_time
+ print"total_timesheet-11-------",timesheet_sheet.total_timesheet
+ print"actual_ot-11-------",timesheet_sheet.actual_ot
+ print"time_diff-11-------",timesheet_sheet.time_diff
+ self.assertEqual(timesheet_sheet.actual_ot,timesheet_sheet.time_diff,'Total overtime hour need to be equal.')
+ try:
+ timesheet_sheet.button_confirm()
+ except Exception:
+ pass
+ self.assertEqual(timesheet_sheet.actual_ot,timesheet_sheet.time_diff,'Total overtime hour need to be equal.')
+
+ def test_create_half_day_leave(self):
+ """test half day leave test cases"""
+
+ hr_holidays = self.registry('hr.holidays')
+ holidays_status_1 = self.env["hr.holidays.status"].create({
+ 'name': 'NotLimited',
+ 'limit': True,
+ })
+ date_from = datetime.today() + relativedelta(days=2)
+ date_end = datetime.today() + relativedelta(days=2)
+
+ timesheet_rec = self.env['hr_timesheet_sheet.sheet'].create({
+ 'date_from': str(date_from),
+ 'date_to': str(date_end),
+ 'name': 'Agrolait Test',
+ 'state': 'new',
+ 'user_id': self.test_user.id,
+ 'employee_id': self.test_employee.id,
+ })
+
+ holiday_id = hr_holidays.create(self.cr, self.test_hrmanager_user.id,{
+ 'name': 'Holiday1',
+ 'employee_id': self.test_employee.id,
+ 'holiday_status_id': holidays_status_1.id,
+ 'date_from': str(date_from),
+ 'date_to': str(date_end),
+ 'leave_selection':'half_day',
+ 'half_day_type':'morning',
+ 'number_of_days_temp':0.5
+ })
+ holiday_rec = hr_holidays.browse(self.cr, self.test_hrmanager_user.id, holiday_id)
+ self.assertEqual(holiday_rec.state, 'confirm', 'hr_holidays: newly created leave request should be in confirm state')
+ self.assertEqual(holiday_rec.number_of_days_temp, 0.5, 'hr_holidays: Half day leave request need to shaw day as 0.5')
+
+ hr_holidays.signal_workflow(self.cr, self.test_hrmanager_user.id, [holiday_id], 'validate')
+ self.assertEqual(holiday_rec.state, 'validate', 'hr_holidays: validates leave request should be in validate state')
+
+ leave_record = self.env['hr.analytic.timesheet'].search([('date','>=',date_from),('date','<=',date_end),('user_id','<=',self.test_user.id)])
+ if leave_record:
+ _logger.info('-----Half Day leave is created.')
+ else:
+ self.assertEqual(1,2,'Half Day leave is not created.')
+
+
diff --git a/itis_hr_leave_extend/views/hr_setting_view.xml b/itis_hr_leave_extend/views/hr_setting_view.xml
new file mode 100644
index 0000000..ae1ec17
--- /dev/null
+++ b/itis_hr_leave_extend/views/hr_setting_view.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+ hr settings
+ hr.config.settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/itis_hr_leave_extend/wizard/__init__.py b/itis_hr_leave_extend/wizard/__init__.py
new file mode 100644
index 0000000..c82151b
--- /dev/null
+++ b/itis_hr_leave_extend/wizard/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from . import hr_setting
+from . import hr_sick_leave
diff --git a/itis_hr_leave_extend/wizard/hr_setting.py b/itis_hr_leave_extend/wizard/hr_setting.py
new file mode 100644
index 0000000..44ee312
--- /dev/null
+++ b/itis_hr_leave_extend/wizard/hr_setting.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, fields, api, _
+
+
+class HRConfig(models.TransientModel):
+
+ _inherit = "hr.config.settings"
+
+ leave_account_id = fields.Many2one("account.analytic.account", "Analytic Account for Leave")
+ ot_leave_account_id = fields.Many2one("account.analytic.account", "Analytic Account for Overtime Leave")
+
+ @api.multi
+ def set_ot_leave_account_id(self):
+ self.env.user.company_id.write({
+ "leave_account_id": self.leave_account_id.id,
+ "ot_leave_account_id": self.ot_leave_account_id.id,
+ })
+ return True
+
+ @api.model
+ def default_get(self, fields):
+ la_id = self.env.user.company_id.leave_account_id.id or False
+ ola_id = self.env.user.company_id.ot_leave_account_id.id or False
+ res = super(HRConfig, self).default_get(fields)
+ res.update({
+ "leave_account_id": la_id,
+ "ot_leave_account_id": ola_id,
+ })
+ return res
+
+class ResCompany(models.Model):
+
+ _inherit = "res.company"
+
+ leave_account_id = fields.Many2one("account.analytic.account", "Analytic Account for Leave")
+ ot_leave_account_id = fields.Many2one("account.analytic.account", "Analytic Account for Overtime Leave")
diff --git a/itis_hr_leave_extend/wizard/hr_sick_leave.py b/itis_hr_leave_extend/wizard/hr_sick_leave.py
new file mode 100644
index 0000000..3e2e123
--- /dev/null
+++ b/itis_hr_leave_extend/wizard/hr_sick_leave.py
@@ -0,0 +1,278 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+# TicTac allows several HR functionalities. This program bases on Odoo v. 8. Copyright
+# (C) 2018 ITIS www.itis.de commissioned by Wikimedia Deutschland e.V.
+#
+# This program is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# this program. If not, see .
+#
+##############################################################################
+
+from openerp import models, fields, api, _
+from openerp.exceptions import Warning
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from datetime import datetime, timedelta
+from openerp import SUPERUSER_ID
+from dateutil.relativedelta import relativedelta
+
+class hr_sick_leave(models.TransientModel):
+
+ _name = 'hr.sick.leave'
+
+ start_date = fields.Datetime('Start Date')
+ end_date = fields.Datetime('End Date')
+
+
+ @api.multi
+ def confirm_sick_time(self):
+ """ This function is use to fill the timesheet when employee is sick.
+ """
+ hr_employee_env = self.env['hr.employee']
+ sheet_obj = self.env['hr_timesheet_sheet.sheet']
+ timesheet_obj = self.pool.get('hr.analytic.timesheet')
+ active_ids = self.env.context.get('active_ids')
+ if active_ids:
+ account_id = self.env.user.company_id and self.env.user.company_id.sick_account_id or False
+ if not account_id:
+ raise Warning(_('Please set the analytic account for Sick Leaves.\nPlease contact your administrator for the same.'))
+
+ for hr_employee_brw in hr_employee_env.browse(active_ids):
+ res = self.count_day_sickleave(hr_employee_brw)
+ timesheets = sheet_obj.search([("employee_id", '=', hr_employee_brw.id)])
+ #for sick_leave_rec in res:
+ for key, value in res.iteritems():
+ cur_day_timesheeht_found = False
+ cur_day = datetime.strptime(key, DEFAULT_SERVER_DATE_FORMAT)
+ for timesheet in timesheets:
+ ts_date_from = datetime.strptime(timesheet.date_from, DEFAULT_SERVER_DATE_FORMAT)
+ ts_date_to = datetime.strptime(timesheet.date_to, DEFAULT_SERVER_DATE_FORMAT)
+ if cur_day >= ts_date_from and cur_day <= ts_date_to:
+ cur_day_timesheeht_found = True
+ # print"Final Timesheet----",timesheet
+ # if timesheet.state != 'draft':
+ # raise Warning(_('The Time period is allready closed. \n Please contact the Human Resource Team if the leave request should be confirmed nevertheless'))
+ # timesheet_ids = timesheet_obj.search(self.env.cr,self.env.uid,[('name','like','Sick Leave on:'),('sheet_id','=',timesheet.id),('user_id','=',hr_employee_brw.user_id.id)])
+ # if timesheet_ids:
+ # timesheet_obj.unlink(self.env.cr,self.env.uid,timesheet_ids)
+ ana_ts_id = self.create_sickleave_timesheet(account_id, timesheet, value, key,hr_employee_brw)
+ #hl_ts_rec.write({'timesheet_id': ana_ts_id[0], 'sheet_id': timesheet.id})
+ if cur_day_timesheeht_found == False:
+ self.create_future_timesheet(cur_day,account_id, value, key,hr_employee_brw)
+
+ return True
+
+ def create_future_timesheet(self,cur_day,account_id, value, key,hr_employee_brw):
+ """
+ Use to create a future timesheet base upon the user configuration
+
+ """
+ hr_timesheet =self.env['hr_timesheet_sheet.sheet']
+ timesheet_start_date = self.get_timesheet_start_date(cur_day)
+ timesheet_end_date =self.get_timesheet_end_date(cur_day)
+
+ timesheets = hr_timesheet.search([("employee_id", '=', hr_employee_brw.id),("date_from", '=', timesheet_start_date),("date_to", '=', timesheet_end_date)])
+ # print"START----------END--------",timesheet_start_date,timesheet_end_date,timesheets
+ if not timesheets:
+ timesheets = hr_timesheet.create({'employee_id':hr_employee_brw.id,'date_from':timesheet_start_date,'date_to':timesheet_end_date})
+
+ self.create_sickleave_timesheet(account_id, timesheets, value, key,hr_employee_brw)
+
+ def get_timesheet_start_date(self,cur_day):
+ user = self.env['res.users'].browse(self.env.uid)
+ r = user.company_id and user.company_id.timesheet_range or 'month'
+ if r == 'month':
+ timesheet_start_date = cur_day.strftime('%Y-%m-01')
+ elif r == 'week':
+ timesheet_start_date = (cur_day+ relativedelta(weekday=0, days=-6)).strftime('%Y-%m-%d')
+ elif r == 'year':
+ timesheet_start_date = cur_day.strftime('%Y-01-01')
+ else:
+ timesheet_start_date = cur_day
+ return timesheet_start_date
+
+ def get_timesheet_end_date(self,cur_day):
+ user = self.env['res.users'].browse(self.env.uid)
+ r = user.company_id and user.company_id.timesheet_range or 'month'
+ if r == 'month':
+ timesheet_end_date = (cur_day+ relativedelta(months=+1, day=1, days=-1)).strftime('%Y-%m-%d')
+ elif r == 'week':
+ timesheet_end_date = (cur_day+ relativedelta(weekday=6)).strftime('%Y-%m-%d')
+ elif r == 'year':
+ timesheet_end_date = cur_day.strftime('%Y-12-31')
+ else:
+ timesheet_end_date = cur_day
+ return timesheet_end_date
+
+
+ @api.one
+ def create_sickleave_timesheet(self, account_id, sheet, duration, day,hr_employee_brw):
+ """
+ This function is use to create analytic timesheet based on the sick date and other inputs
+ :param account_id: analytic account id
+ :param sheet: timesheet id
+ :param duration: planned time of the leave
+ :param day: date of the leave
+ :param hr_employee_brw: employee browse record
+ :return: created record for the analytic timesheet
+ """
+ timesheet_obj = self.pool.get('hr.analytic.timesheet')
+ cr = self.env.cr
+ uid = self.env.uid
+ emp_obj = self.env['hr.employee']
+ hour = duration
+
+ res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
+
+ if not res['product_uom_id']:
+ raise Warning(_('User Error! \nPlease define cost unit for this employee.'))
+ up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour,False, res['product_uom_id'])['value']
+
+ res['name'] = "Sick Leave on:" + day
+ res['account_id'] = account_id.id
+ res['unit_amount'] = hour
+ emp_journal = emp_obj.search([('user_id', '=', hr_employee_brw.user_id.id)]).journal_id
+ res['journal_id'] = emp_journal and emp_journal.id or False
+ res.update(up)
+ up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
+ res.update(up)
+ res.update({
+ 'date': day,
+ 'user_id': hr_employee_brw.user_id.id,
+ 'sheet_id': sheet.id,
+ })
+ return timesheet_obj.create(cr, SUPERUSER_ID, res)
+
+
+
+
+
+
+ def count_day_sickleave(self,hr_employee_brw):
+ res = {}
+ date_from = datetime.strptime(self.start_date, DEFAULT_SERVER_DATETIME_FORMAT)
+ date_to = datetime.strptime(self.end_date, DEFAULT_SERVER_DATETIME_FORMAT)
+ same_day = self.check_same_day(date_from, date_to)
+ temp_date = date_from
+ day_hours = 0.0
+ weekday = temp_date.weekday()
+ for contract in hr_employee_brw.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ if same_day:
+ cur_hour = self.get_sameday_hours(date_from, date_to, contract.working_hours.attendance_ids)
+ day_hours += cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ res.update({day_str: new_hour})
+ else:
+ fday_cur_hour = self.get_fday_hours(date_from, contract.working_hours.attendance_ids)
+ day_hours += fday_cur_hour
+ lday_cur_hour = self.get_lday_hours(date_to, contract.working_hours.attendance_ids)
+ day_hours += lday_cur_hour
+ fday_str = datetime.strftime(date_from, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ fday_new_hour = res.get(fday_str, 0.0) + fday_cur_hour
+ res.update({fday_str: fday_new_hour})
+ lday_str = datetime.strftime(date_to, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ lday_new_hour = res.get(lday_str, 0.0) + lday_cur_hour
+ res.update({lday_str: lday_new_hour})
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date += timedelta(days=1)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ if same_day:
+ cur_hour = self.get_sameday_hours(date_from, date_to, contract.working_hours.attendance_ids)
+ day_hours += cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ res.update({day_str: new_hour})
+ else:
+ fday_cur_hour = self.get_fday_hours(date_from, contract.working_hours.attendance_ids)
+ day_hours += fday_cur_hour
+ lday_cur_hour = self.get_lday_hours(date_to, contract.working_hours.attendance_ids)
+ day_hours += lday_cur_hour
+ fday_str = datetime.strftime(date_from, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ fday_new_hour = res.get(fday_str, 0.0) + fday_cur_hour
+ res.update({fday_str: fday_new_hour})
+ lday_str = datetime.strftime(date_to, DEFAULT_SERVER_DATETIME_FORMAT).split(" ")[0]
+ lday_new_hour = res.get(lday_str, 0.0) + lday_cur_hour
+ res.update({lday_str: lday_new_hour})
+ date_from = datetime.strptime(self.start_date.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ date_to = datetime.strptime(self.end_date.split(" ")[0], DEFAULT_SERVER_DATE_FORMAT)
+ temp_date = date_from
+ temp_date += timedelta(days=1)
+ while temp_date < date_to:
+ weekday = temp_date.weekday()
+ for contract in hr_employee_brw.contract_ids:
+ cont_start_date = datetime.strptime(contract.date_start, DEFAULT_SERVER_DATE_FORMAT)
+ cont_end_date = False
+ if not contract.date_end:
+ if cont_start_date <= temp_date:
+ cur_hour = self.get_hours(weekday, contract.working_hours.attendance_ids)
+ day_hours += cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATE_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ res.update({day_str: new_hour})
+ else:
+ cont_end_date = datetime.strptime(contract.date_end, DEFAULT_SERVER_DATE_FORMAT)
+ if cont_start_date <= temp_date and cont_end_date >= temp_date:
+ cur_hour = self.get_hours(weekday, contract.working_hours.attendance_ids)
+ day_hours += cur_hour
+ day_str = datetime.strftime(temp_date, DEFAULT_SERVER_DATE_FORMAT).split(" ")[0]
+ new_hour = res.get(day_str, 0.0) + cur_hour
+ res.update({day_str: new_hour})
+
+ temp_date += timedelta(days=1)
+
+ return res
+
+
+ def check_same_day(self, date_from, date_to):
+ return date_from.date() == date_to.date()
+
+ def get_sameday_hours(self, date_from, date_to, atten_ids):
+
+ weekday = date_from.weekday()
+ res = self.get_hours(weekday, atten_ids)
+ return res
+
+ def get_lday_hours(self, date_to, atten_ids):
+ weekday = date_to.weekday()
+ return self.get_hours(weekday, atten_ids)
+
+
+ def get_fday_hours(self, date_from, atten_ids):
+ weekday = date_from.weekday()
+ return self.get_hours(weekday, atten_ids)
+
+
+ def get_hours(self, weekday, atten_ids):
+ res = 0.0
+ for atten in atten_ids:
+ if int(atten.dayofweek) == weekday:
+ res += atten.hour_to - atten.hour_from
+ return res
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/itis_hr_leave_extend/wizard/hr_sick_leave.xml b/itis_hr_leave_extend/wizard/hr_sick_leave.xml
new file mode 100644
index 0000000..5ce0908
--- /dev/null
+++ b/itis_hr_leave_extend/wizard/hr_sick_leave.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ sick.leave.form.view
+ hr.sick.leave
+
+
+
+
+
+
+ Fill Sick Leave
+ ir.actions.act_window
+ hr.sick.leave
+ form
+ form
+ new
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_notifications/__init__.py b/itis_hr_notifications/__init__.py
new file mode 100644
index 0000000..a5e7e1d
--- /dev/null
+++ b/itis_hr_notifications/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import models
\ No newline at end of file
diff --git a/itis_hr_notifications/__openerp__.py b/itis_hr_notifications/__openerp__.py
new file mode 100644
index 0000000..b21d5ab
--- /dev/null
+++ b/itis_hr_notifications/__openerp__.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+{
+ 'name': "ITIS HR Notifications",
+
+ 'summary': """
+ A module by ITIS to send various HR notifications""",
+
+ 'description': """
+ A module by ITIS to send various HR notifications
+ """,
+
+ 'author': "ITIS AG",
+ 'website': "http://itis.de",
+ 'category': 'Human Resource',
+ 'version': '1.0.55.0',
+
+ 'depends': ['hr', 'itis_hr_attendance_extend', 'itis_hr_extend'],
+
+ 'data': [
+ 'data/email_templates.xml',
+ 'hr_view.xml',
+ 'data/ir_cron.xml',
+ 'security/ir.model.access.csv',
+ ],
+
+ 'application': False,
diff --git a/itis_hr_notifications/data/email_templates.xml b/itis_hr_notifications/data/email_templates.xml
new file mode 100644
index 0000000..363bc6a
--- /dev/null
+++ b/itis_hr_notifications/data/email_templates.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+ Training_end Notification
+
+
+ ${(user.email or '') | safe}
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe}
+ Training End Notification
+ Hello ${object.employee_id and object.employee_id.name or object.user_id and object.user_id.name},
+
+
please be informed that the probation period for ${object.for_emp.name} is ending on ${object.date}.
+
+
Regards
+
Your Human-Resources Team
+ ]]>
+
+
+
+ work permit Notification
+
+
+ ${(user.email or '') | safe}
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe}
+ Work Permit End Notification
+ Hello ${object.employee_id and object.employee_id.name or object.user_id and object.user_id.name},
+
+
please be informed that the work permit for ${object.for_emp.name} is ending on ${object.date}.
+
+
Regards
+
Your Human-Resources Team
+ ]]>
+
+
+
+ Term end Notification
+
+
+ ${(user.email or '') | safe}
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe}
+ Term End Notification
+ Hello ${object.employee_id and object.employee_id.name or object.user_id and object.user_id.name},
+
+
please be informed that the temporary employment for ${object.for_emp.name} is ending on ${object.date}.
+
+
Regards
+
Your Human-Resources Team
+ ]]>
+
+
+
+ Disability Notification
+
+
+ ${(user.email or '') | safe}
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe}
+ Disability Notification
+ Hello ${object.employee_id and object.employee_id.name or object.user_id and object.user_id.name},
+
+
please be informed that the severely handicapped pass for ${object.for_emp.name} is ending on ${object.date}.
+
+
Regards
+
Your Human-Resources Team
+ ]]>
+
+
+
+ Leave end Notification
+
+
+ ${(user.email or '') | safe}
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe}
+ Leave Balance Notification
+ Hello ${object.employee_id and object.employee_id.name or object.user_id and object.user_id.name},
+
+
please be informed that you have ${object.days} remaining leave.
+
The leave needs to be taken until the end of march.
+
Remaining leave from the old year will expire on 1st of April.
+
+
Regards
+
Your Human-Resources Team
+ ]]>
+
+
+
+
+ Overtime Notification
+
+
+ ${(user.email or '') | safe}
+ ${( object.employee_id.work_email or object.user_id != False and object.user_id.email )|safe}
+ Overtime Notification
+ Hello ${object.employee_id and object.employee_id.name or object.user_id and object.user_id.name},
+
+
please be informed that the timesheet for ${object.for_emp.name} is showing ${object.hours}.
+
+
Regards
+
Your Human-Resources Team
+ ]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_notifications/data/ir_cron.xml b/itis_hr_notifications/data/ir_cron.xml
new file mode 100644
index 0000000..db4d733
--- /dev/null
+++ b/itis_hr_notifications/data/ir_cron.xml
@@ -0,0 +1,55 @@
+
+
+
+
+ HR Contract Notifications
+ 1
+ days
+ -1
+
+
+
+
+
+
+
+
+ Employee Disability
+ 1
+ days
+ -1
+
+
+
+
+
+
+
+ Employee Leave Balance
+ 1
+ days
+ -1
+
+
+
+
+
+
+
+ Employee Overtime
+ 1
+ months
+ -1
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_notifications/hr_view.xml b/itis_hr_notifications/hr_view.xml
new file mode 100644
index 0000000..55b4688
--- /dev/null
+++ b/itis_hr_notifications/hr_view.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+ ITIS hr settings
+ hr.config.settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/itis_hr_notifications/i18n/de.po b/itis_hr_notifications/i18n/de.po
new file mode 100644
index 0000000..0577b80
--- /dev/null
+++ b/itis_hr_notifications/i18n/de.po
@@ -0,0 +1,328 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * itis_hr_notifications
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-12-11 13:55+0000\n"
+"PO-Revision-Date: 2016-12-11 18:53+0100\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: itis_hr_notifications
+#: model:email.template,body_html:itis_hr_notifications.email_template_temp_empl
+msgid ""
+"\n"
+"\t\t\t
Hello ${object.employee_id.name},
\n"
+"\t\t\t\n"
+"\t\t\t
please be informed that the temporary employment for ${object."
+"employee_id.name} is ending on ${object.date}.
\n"
+"\t\t\t \n"
+"\t\t\t
Regards
\n"
+"\t\t\t
Your Human-Resources Team
\n"
+"\t\t\t"
+msgstr ""
+"\n"
+"
Hallo ${object.employee_id.name},
\n"
+"\n"
+"
Das befristete Arbeitsverhältnis für ${object.employee_id.name} endet am "
+"${object.date}.