Skip to content

Commit

Permalink
[MIG] hr_expense_advance_clearing_consolidation: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigonevest committed Nov 9, 2023
1 parent 98c0a0b commit 09af7ef
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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:85e7b17b7868c1898b8bc12dca51d5ae2bf32f53b4fe549fa1d3f7f02daaf002
!! source digest: sha256:850c8257cdb1de590ca61c1150398d7356073ef0db75d4319a2fc442cb542f24
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion hr_expense_advance_clearing_consolidation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Hr Expense Advance Clearing Consolidation",
"summary": """
HR Expense Advance Clearing Consolidation""",
"version": "12.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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 _, fields, models
from odoo.exceptions import UserError


Expand All @@ -12,8 +12,7 @@ class HrExpenseSheet(models.Model):
string="Is Consolidated Advance", readonly=True
)

@api.multi
def _consolidate_open_advances(self):
def _consolidate_open_advances(self): # noqa: C901
if not len(self) > 1:
raise UserError(
_(
Expand Down Expand Up @@ -47,7 +46,6 @@ def _consolidate_open_advances(self):
"report that is open."
)
)

writeoff_lines = self.env["account.move.line"]
emp_advance = self.env.ref("hr_expense_advance_clearing." "product_emp_advance")

Expand Down Expand Up @@ -128,14 +126,12 @@ def _consolidate_open_advances(self):

return consolidated_advance

@api.multi
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."))

@api.multi
def _log_consolidation_open_advance(self, advances, consolidated_advance):
consolidated_advance.message_post(
body="%s %s"
Expand All @@ -146,7 +142,7 @@ def _log_consolidation_open_advance(self, advances, consolidated_advance):
)
for advance in advances:
advance.message_post(
body="%s"
body=_("%s")
% (
_("This advance was consolidated in the advance: %s (ID %s)")
% (consolidated_advance.name or "n/a", consolidated_advance.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <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:85e7b17b7868c1898b8bc12dca51d5ae2bf32f53b4fe549fa1d3f7f02daaf002
!! source digest: sha256:850c8257cdb1de590ca61c1150398d7356073ef0db75d4319a2fc442cb542f24
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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>
Expand Down

0 comments on commit 09af7ef

Please sign in to comment.