Skip to content

Commit

Permalink
[IMP] hr_expense_advance_clearing_consolidation: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigonevest committed Nov 9, 2023
1 parent 67f444b commit 98c0a0b
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 99 deletions.
12 changes: 6 additions & 6 deletions hr_expense_advance_clearing_consolidation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Hr Expense Advance Clearing Consolidation
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7b87b9b5cd2a4d9107cde631255eda39d0f52201c6489ac57d064c7e781688d4
!! source digest: sha256:85e7b17b7868c1898b8bc12dca51d5ae2bf32f53b4fe549fa1d3f7f02daaf002
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Hr Expense Advance Clearing Consolidation
: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/12.0/hr_expense_advance_clearing_consolidation
:target: https://github.com/OCA/hr/tree/14.0/hr_expense_advance_clearing_consolidation
:alt: OCA/hr
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_advance_clearing_consolidation
:target: https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_expense_advance_clearing_consolidation
: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=12.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -41,7 +41,7 @@ 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_expense_advance_clearing_consolidation%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_expense_advance_clearing_consolidation%0Aversion:%2014.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 @@ -73,6 +73,6 @@ 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/12.0/hr_expense_advance_clearing_consolidation>`_ project on GitHub.
This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/14.0/hr_expense_advance_clearing_consolidation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
20 changes: 10 additions & 10 deletions hr_expense_advance_clearing_consolidation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
'name': 'Hr Expense Advance Clearing Consolidation',
'summary': """
"name": "Hr Expense Advance Clearing Consolidation",
"summary": """
HR Expense Advance Clearing Consolidation""",
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'author': 'Escodoo,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/hr',
'depends': [
'hr_expense_advance_clearing',
"version": "12.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr",
"depends": [
"hr_expense_advance_clearing",
],
'data': [
'views/hr_expense_sheet_view.xml',
"data": [
"views/hr_expense_sheet_view.xml",
],
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Copyright 2022 - TODAY, Marcel Savegnago <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models, _
from odoo import _, api, fields, models
from odoo.exceptions import UserError


class HrExpenseSheet(models.Model):
_inherit = 'hr.expense.sheet'
_inherit = "hr.expense.sheet"

is_consolidated_advance = fields.Boolean(
string='Is Consolidated Advance',
readonly=True
string="Is Consolidated Advance", readonly=True
)

@api.multi
Expand All @@ -35,11 +34,11 @@ def _consolidate_open_advances(self):
if any(rec.state != "done" for rec in self):
raise UserError(_("You cannot consolidate advances that are not paid."))

if self.env['hr.expense.sheet'].search(
if self.env["hr.expense.sheet"].search(
[
('advance', '=', False),
('state', '!=', 'done'),
('advance_sheet_id', 'in', self.ids)
("advance", "=", False),
("state", "!=", "done"),
("advance_sheet_id", "in", self.ids),
]
):
raise UserError(
Expand Down Expand Up @@ -134,12 +133,22 @@ def consolidate_open_advances(self):
if self.env.user.has_group("account.group_account_manager"):
self._consolidate_open_advances()
else:
raise UserError(
_("You do not have permission to perform this action.")
)
raise UserError(_("You do not have permission to perform this action."))

@api.multi
def _log_consolidation_open_advance(self, advances, consolidated_advance):
consolidated_advance.message_post(body='%s %s' % (_("Consolidated advances:"), ", ".join('%s (ID %s)' % (p.name or 'n/a', p.id) for p in advances)))
consolidated_advance.message_post(
body="%s %s"
% (
_("Consolidated advances:"),
", ".join("%s (ID %s)" % (p.name or "n/a", p.id) for p in advances),
)
)
for advance in advances:
advance.message_post(body='%s' % (_("This advance was consolidated in the advance: %s (ID %s)") % (consolidated_advance.name or 'n/a', consolidated_advance.id)))
advance.message_post(
body="%s"
% (
_("This advance was consolidated in the advance: %s (ID %s)")
% (consolidated_advance.name or "n/a", consolidated_advance.id)
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Hr Expense Advance Clearing Consolidation</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7b87b9b5cd2a4d9107cde631255eda39d0f52201c6489ac57d064c7e781688d4
!! source digest: sha256:85e7b17b7868c1898b8bc12dca51d5ae2bf32f53b4fe549fa1d3f7f02daaf002
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/hr/tree/12.0/hr_expense_advance_clearing_consolidation"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_advance_clearing_consolidation"><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/hr&amp;target_branch=12.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></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/hr/tree/14.0/hr_expense_advance_clearing_consolidation"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-14-0/hr-14-0-hr_expense_advance_clearing_consolidation"><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/hr&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds the possibility to consolidate open advances, creating a new advance with the sum of the residual value of all consolidated advances.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -388,7 +388,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr/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/OCA/hr/issues/new?body=module:%20hr_expense_advance_clearing_consolidation%0Aversion:%2012.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/hr/issues/new?body=module:%20hr_expense_advance_clearing_consolidation%0Aversion:%2014.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 All @@ -415,7 +415,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<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/hr/tree/12.0/hr_expense_advance_clearing_consolidation">OCA/hr</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/14.0/hr_expense_advance_clearing_consolidation">OCA/hr</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>
Expand Down
Loading

0 comments on commit 98c0a0b

Please sign in to comment.