Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] hr_birthday_calendar: Migration to 16.0 #1395

Open
wants to merge 6 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions hr_birthday_calendar/LICENSE

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions hr_birthday_calendar/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
====================
HR Birthday Calendar
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:29f07180c9a5eae5f7f3341c66e41eda6552741e4d5690316903837a8d036301
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github
:target: https://github.com/OCA/hr/tree/16.0/hr_birthday_calendar
:alt: OCA/hr
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-16-0/hr-16-0-hr_birthday_calendar
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows you to view the birthdays of all employees in a
calendar view.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

- Go to *Employees* > Employees > Employees

- On an employee's form, in the "Private Information" tab, fill in the
"Date of Birth" field > save

- Go to *Employees* > Personal

- Change the view type to calendar by clicking on the calendar icon.

Now you can view the birthdays of each day.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_birthday_calendar%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Mint System GmbH

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

- Janik von Rotz https://www.mint-system.ch/

Maintainers
-----------

This module is maintained by the OCA.

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

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

This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/16.0/hr_birthday_calendar>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions hr_birthday_calendar/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions hr_birthday_calendar/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "HR Birthday Calendar",
"summary": """
Add birthday calendar view.
""",
"author": "Mint System GmbH, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr",
"category": "Human Resources",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": ["hr"],
"data": ["data/birthday_calendar.xml"],
"installable": True,
"application": False,
"images": ["images/screen.png"],
}
55 changes: 55 additions & 0 deletions hr_birthday_calendar/data/birthday_calendar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version='1.0' encoding='UTF-8' ?>
<odoo>

<record id="hr_employee_public_view_form_add_birthday_public" model="ir.ui.view">
<field name="active" eval="True" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='work_location_id']" position="after">
<field name="birthday_public" />
</xpath>
</data>
</field>
<field name="inherit_id" ref="hr.hr_employee_public_view_form" />
<field name="mode">extension</field>
<field name="model">hr.employee.public</field>
<field name="name">Mint System: hr.employee.public.form customization</field>
<field name="priority">99</field>
<field name="type">form</field>
</record>

<record id="hr_birthday_public_calendar_view" model="ir.ui.view">
<field name="active" eval="True" />
<field name="arch" type="xml">
<calendar
mode="month"
date_start="birthday_public"
date_stop="birthday_public"
string="Birthday Calendar"
/>
</field>
<field name="mode">primary</field>
<field name="model">hr.employee.public</field>
<field name="name">Mint System: Default calendar view for hr.employee.public</field>
<field name="priority">16</field>
<field name="type">calendar</field>
</record>

<record id="hr.hr_employee_public_action" model="ir.actions.act_window">
<field name="limit">80</field>
<field name="name">Personal</field>
<field name="res_model">hr.employee.public</field>
<field name="search_view_id" ref="hr.hr_employee_public_view_search" />
<field name="target">current</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">kanban,tree,form,calendar</field>
</record>

<record id="hr_employee_personal_menu" model="ir.ui.menu">
<field name="name">Personal</field>
<field name="parent_id" ref="hr.menu_hr_root" />
<field name="action" ref="hr.hr_employee_public_action" />
<field name="sequence" eval="10" />
</record>

</odoo>
Binary file added hr_birthday_calendar/images/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions hr_birthday_calendar/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import hr_employee_public
21 changes: 21 additions & 0 deletions hr_birthday_calendar/models/hr_employee_public.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from odoo import fields, models


class HrEmployeePublic(models.Model):
_inherit = "hr.employee.public"

birthday_public = fields.Date(
"Birthday", compute="_compute_birthday_public", compute_sudo=True
)

def _compute_birthday_public(self):
for employee in self:
now = fields.Datetime.now()
employee_id = self.sudo().env["hr.employee"].browse(employee.id)
date = employee_id.birthday

Check warning on line 15 in hr_birthday_calendar/models/hr_employee_public.py

View check run for this annotation

Codecov / codecov/patch

hr_birthday_calendar/models/hr_employee_public.py#L13-L15

Added lines #L13 - L15 were not covered by tests
if date:
now = now.replace(day=date.day, month=date.month)

Check warning on line 17 in hr_birthday_calendar/models/hr_employee_public.py

View check run for this annotation

Codecov / codecov/patch

hr_birthday_calendar/models/hr_employee_public.py#L17

Added line #L17 was not covered by tests
else:
now = now.replace(year=1900)

Check warning on line 19 in hr_birthday_calendar/models/hr_employee_public.py

View check run for this annotation

Codecov / codecov/patch

hr_birthday_calendar/models/hr_employee_public.py#L19

Added line #L19 was not covered by tests

employee.birthday_public = now

Check warning on line 21 in hr_birthday_calendar/models/hr_employee_public.py

View check run for this annotation

Codecov / codecov/patch

hr_birthday_calendar/models/hr_employee_public.py#L21

Added line #L21 was not covered by tests
1 change: 1 addition & 0 deletions hr_birthday_calendar/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Janik von Rotz <https://www.mint-system.ch/>
1 change: 1 addition & 0 deletions hr_birthday_calendar/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows you to view the birthdays of all employees in a calendar view.
11 changes: 11 additions & 0 deletions hr_birthday_calendar/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
To use this module, you need to:

- Go to *Employees* > Employees > Employees

- On an employee's form, in the "Private Information" tab, fill in the "Date of Birth" field > save

- Go to *Employees* > Personal

- Change the view type to calendar by clicking on the calendar icon.

Now you can view the birthdays of each day.
Binary file added hr_birthday_calendar/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions hr_birthday_calendar/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body><a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">
<img alt="License: GPL-3" src="https://img.shields.io/badge/licence-GPL--3-blue.svg" />
</a>
<section id="hr-birthday-calendar">
<h1>HR Birthday Calendar</h1>
<p>Add birthday calendar view.</p>
<p>For a detailed documentation have a look at <a href="https://www.odoo-wiki.org/">https://www.odoo-wiki.org/</a>.</p>
<img height="100" width="100" alt="Icon" src="https://raw.githubusercontent.com/Mint-System/Wiki/master/assets/icon-box.png" />
<section id="configuration">
<h2>Configuration</h2>
<ul>
<li>No additional configurations needed</li>
</ul>
<section id="maintainer">
<h3>Maintainer</h3>
<a href="https://www.mint-system.ch">
<img src="https://raw.githubusercontent.com/Mint-System/Wiki/master/assets/mint-system-logo.png" alt="" />
</a>
<p>This module is maintained by Mint System GmbH.</p>
<p>For support and more information, please visit <a href="https://www.mint-system.ch">our Website</a>.</p>
</section>
</section>
</section>
</body>
</html>
6 changes: 6 additions & 0 deletions setup/hr_birthday_calendar/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading