Skip to content

Commit

Permalink
Merge pull request #72 from kmee/fix-pre-commit
Browse files Browse the repository at this point in the history
Fix pre commit
  • Loading branch information
mileo authored Nov 27, 2024
2 parents ff91196 + 6147637 commit 119da71
Show file tree
Hide file tree
Showing 49 changed files with 2,320 additions and 284 deletions.
36 changes: 26 additions & 10 deletions account_payment_currency_rate/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Payment Currency Rate
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:482a98c97598b037e5884b089480b693c62cd6f2bd3cc5cdbacd981cd1e6b9b9
!! source digest: sha256:d6e707c252f7cf4d8970346285f54f93b610994ea8b34e60368e95db3206c596
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -16,11 +16,17 @@ Account Payment Currency Rate
.. |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-KMEE%2Fkmee--odoo--addons-lightgray.png?logo=github
:target: https://github.com/KMEE/kmee-odoo-addons/tree/16.0/account_payment_currency_rate
:alt: KMEE/kmee-odoo-addons

|badge1| |badge2| |badge3|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fkmee--odoo--addons-lightgray.png?logo=github
:target: https://github.com/OCA/kmee-odoo-addons/tree/16.0/account_payment_currency_rate
:alt: OCA/kmee-odoo-addons
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/kmee-odoo-addons-16-0/kmee-odoo-addons-16-0-account_payment_currency_rate
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/kmee-odoo-addons&target_branch=16.0
:alt: Try me on Runboat

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

[ This file must be max 2-3 paragraphs, and is required. ]

Expand Down Expand Up @@ -91,10 +97,10 @@ fragment is included. ]
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/KMEE/kmee-odoo-addons/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/kmee-odoo-addons/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/KMEE/kmee-odoo-addons/issues/new?body=module:%20account_payment_currency_rate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/kmee-odoo-addons/issues/new?body=module:%20account_payment_currency_rate%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.

Expand Down Expand Up @@ -124,6 +130,16 @@ The development of this module has been financially supported by:
Maintainers
-----------

This module is part of the `KMEE/kmee-odoo-addons <https://github.com/KMEE/kmee-odoo-addons/tree/16.0/account_payment_currency_rate>`_ project on GitHub.
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/kmee-odoo-addons <https://github.com/OCA/kmee-odoo-addons/tree/16.0/account_payment_currency_rate>`_ project on GitHub.

You are welcome to contribute.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
19 changes: 13 additions & 6 deletions account_payment_currency_rate/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Account Payment Currency Rate</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:482a98c97598b037e5884b089480b693c62cd6f2bd3cc5cdbacd981cd1e6b9b9
!! source digest: sha256:d6e707c252f7cf4d8970346285f54f93b610994ea8b34e60368e95db3206c596
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/KMEE/kmee-odoo-addons/tree/16.0/account_payment_currency_rate"><img alt="KMEE/kmee-odoo-addons" src="https://img.shields.io/badge/github-KMEE%2Fkmee--odoo--addons-lightgray.png?logo=github" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/kmee-odoo-addons/tree/16.0/account_payment_currency_rate"><img alt="OCA/kmee-odoo-addons" src="https://img.shields.io/badge/github-OCA%2Fkmee--odoo--addons-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/kmee-odoo-addons-16-0/kmee-odoo-addons-16-0-account_payment_currency_rate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/kmee-odoo-addons&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>[ This file must be max 2-3 paragraphs, and is required. ]</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -448,10 +448,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">16.0.1.0.0 (2024-05-20)</a></h2>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-7">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/KMEE/kmee-odoo-addons/issues">GitHub Issues</a>.
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/kmee-odoo-addons/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/KMEE/kmee-odoo-addons/issues/new?body=module:%20account_payment_currency_rate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/kmee-odoo-addons/issues/new?body=module:%20account_payment_currency_rate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -479,8 +479,15 @@ <h2><a class="toc-backref" href="#toc-entry-11">Other credits</a></h2>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-12">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/KMEE/kmee-odoo-addons/tree/16.0/account_payment_currency_rate">KMEE/kmee-odoo-addons</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/kmee-odoo-addons/tree/16.0/account_payment_currency_rate">OCA/kmee-odoo-addons</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
Expand Down
138 changes: 138 additions & 0 deletions hr_holidays_allocation_plan/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
===========================
Hr Holidays Allocation Plan
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:28e06d0befe5bbee9feb107b3e55f9c76d377d3814e1819ba8f50f4e5da3acbe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fkmee--odoo--addons-lightgray.png?logo=github
:target: https://github.com/OCA/kmee-odoo-addons/tree/16.0/hr_holidays_allocation_plan
:alt: OCA/kmee-odoo-addons
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/kmee-odoo-addons-16-0/kmee-odoo-addons-16-0-hr_holidays_allocation_plan
: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/kmee-odoo-addons&target_branch=16.0
:alt: Try me on Runboat

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

[ This file must be max 2-3 paragraphs, and is required.

The goal of this document is to explain quickly the features of this
module: “what” this module does and “what” it is for. ]

This module adds advanced functionality for managing vacation allocation
plans in Odoo. It allows for the automatic creation of new allocations
based on predefined plans, ensuring that a newly hired employee has
their accrual plans set up automatically.

**Table of contents**

.. contents::
:local:

Configuration
=============

[ This file is not always required; it should explain **how to configure
the module before using it**; it is aimed at users with administration
privileges.

Please be detailed on the path to configuration (eg: do you need to
activate developer mode?), describe step by step configurations and the
use of screenshots is strongly recommended.]

To configure this module, you need to do nothing

Usage
=====

[ This file is required and contains the instructions on **“how”** to
use the module for end-users.

If the module does not have a visible impact on the user interface, just
add the following sentence:

This module does not impact the user interface.

If that’s not the case, please make sure that every usage step is
covered and remember that images speak more than words!]

To use this module, go to the leave module settings and create a record
in allocation plans. Define the rules for the allocations to be created
and whether they can be updated automatically, i.e., adding new
employees who have an active contract and match the filtering rules.

Follow the workflow steps to put the rule into execution. If you do not
want to leave it running automatically, click the buttons again to
update the data.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/kmee-odoo-addons/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/kmee-odoo-addons/issues/new?body=module:%20hr_holidays_allocation_plan%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
-------

* KMEE

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

- Luis Felipe Mileo [email protected] (https://kmee.com.br)

Other credits
-------------

[ This file is optional and contains additional credits, other than
authors, contributors, and maintainers. ]

The development of this module has been financially supported by:

- KMEE

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.

.. |maintainer-mileo| image:: https://github.com/mileo.png?size=40px
:target: https://github.com/mileo
:alt: mileo

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-mileo|

This module is part of the `OCA/kmee-odoo-addons <https://github.com/OCA/kmee-odoo-addons/tree/16.0/hr_holidays_allocation_plan>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
33 changes: 19 additions & 14 deletions hr_holidays_allocation_plan/models/hr_leave_allocation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 2024 KMEE
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models
from dateutil.relativedelta import relativedelta

from odoo import fields, models


class HrLeaveAllocation(models.Model):

Expand Down Expand Up @@ -155,12 +156,12 @@ class HrLeaveAllocationPlan(models.Model):
"\n- By Employee Tag: all employees of the specific employee group category",
)

allocation_type = fields.Selection([
('regular', 'Regular / Fixed'),
allocation_type = fields.Selection(
[
("regular", "Regular / Fixed"),
("accrual", "Accrual"),
('recurrent', 'Recurrent Allocation'),
("recurrent", "Recurrent Allocation"),
],
string="Allocation Type",
required=True,
default="accrual",
readonly=True,
Expand Down Expand Up @@ -237,7 +238,6 @@ class HrLeaveAllocationPlan(models.Model):
)

recurring_renewal_frequency = fields.Integer(
string="Recurring Renewal Frequency",
default=1,
)

Expand All @@ -246,7 +246,6 @@ class HrLeaveAllocationPlan(models.Model):
)

immediate_allocation = fields.Boolean(
string="Immediate Allocation",
default=False,
)

Expand Down Expand Up @@ -304,12 +303,16 @@ def action_run_update(self):
if not allocations_to_renew:
continue

running_contracts = self.env["hr.contract"].search(
[
("employee_id", "=", employee.id),
("state", "=", "open"),
],
).mapped("date_start")
running_contracts = (
self.env["hr.contract"]
.search(
[
("employee_id", "=", employee.id),
("state", "=", "open"),
],
)
.mapped("date_start")
)

if not running_contracts:
continue
Expand All @@ -334,7 +337,9 @@ def action_run_update(self):
date_from = max([record.date_from, oldest_running_contract])
if allocation_type == "recurrent":
allocation_type = "regular"
date_from = oldest_running_contract.replace(year=fields.Date.today().year)
date_from = oldest_running_contract.replace(
year=fields.Date.today().year
)
date_to = date_from + relativedelta(
years=record.recurring_renewal_frequency
)
Expand Down
Loading

0 comments on commit 119da71

Please sign in to comment.