Skip to content

Commit

Permalink
[MIG] hr_expense_payment: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Nov 29, 2023
1 parent cd6d62c commit bd305c2
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 29 deletions.
27 changes: 15 additions & 12 deletions hr_expense_payment/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ HR Expense Payment
: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--expense-lightgray.png?logo=github
:target: https://github.com/OCA/hr-expense/tree/16.0/hr_expense_payment
:target: https://github.com/OCA/hr-expense/tree/17.0/hr_expense_payment
:alt: OCA/hr-expense
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_payment
:target: https://translation.odoo-community.org/projects/hr-expense-17-0/hr-expense-17-0-hr_expense_payment
: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-expense&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr-expense&target_branch=17.0
:alt: Try me on Runboat

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

This module allow payment link to expense.
After you register payment on expense sheet, it will link between expense sheet and payment.
This module allow payment link to expense. After you register payment on
expense sheet, it will link between expense sheet and payment.

**Table of contents**

Expand All @@ -42,27 +42,30 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-expense/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-expense/issues/new?body=module:%20hr_expense_payment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/hr-expense/issues/new?body=module:%20hr_expense_payment%0Aversion:%2017.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
~~~~~~~
-------

* Tecnativa
* Ecosoft

Contributors
~~~~~~~~~~~~
------------

* Saran Lim. <[email protected]>
* Manuel Regidor <[email protected]>
- Saran Lim. <[email protected]>
- Manuel Regidor <[email protected]>
- `APSL <https://apsl.tech>`__:

- Antoni Marroig <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -74,6 +77,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-expense <https://github.com/OCA/hr-expense/tree/16.0/hr_expense_payment>`_ project on GitHub.
This module is part of the `OCA/hr-expense <https://github.com/OCA/hr-expense/tree/17.0/hr_expense_payment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion hr_expense_payment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "HR Expense Payment",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Human Resources",
"author": "Tecnativa, Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
Expand Down
8 changes: 4 additions & 4 deletions hr_expense_payment/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
def post_init_hook(env):
"""Trying to fill the source expense sheet in payments"""
env = api.Environment(cr, SUPERUSER_ID, {})
env = api.Environment(env.cr, SUPERUSER_ID, {})
sheets = env["hr.expense.sheet"].search([("payment_mode", "=", "own_account")])
for sheet in sheets:
amls = sheet.account_move_id.mapped("line_ids")
amls = sheet.account_move_ids.mapped("line_ids")
reconcile = amls.mapped("full_reconcile_id")
aml_payment = reconcile.mapped("reconciled_line_ids").filtered(
lambda r: r not in amls
lambda r, amls=amls: r not in amls
)
payment = aml_payment.mapped("payment_id")
payment.write({"expense_sheet_ids": sheet.ids})
3 changes: 3 additions & 0 deletions hr_expense_payment/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions hr_expense_payment/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Saran Lim. \<<[email protected]>\>
- Manuel Regidor \<<[email protected]>\>
- [APSL](<https://apsl.tech>):
- Antoni Marroig \<<[email protected]>\>
2 changes: 0 additions & 2 deletions hr_expense_payment/readme/CONTRIBUTORS.rst

This file was deleted.

2 changes: 2 additions & 0 deletions hr_expense_payment/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allow payment link to expense. After you register payment on
expense sheet, it will link between expense sheet and payment.
2 changes: 0 additions & 2 deletions hr_expense_payment/readme/DESCRIPTION.rst

This file was deleted.

14 changes: 9 additions & 5 deletions hr_expense_payment/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ <h1 class="title">HR Expense Payment</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ac7e648ccab4a185220724c03ed8bf8607f6797b4bc6b87bae95de648b7b5b6a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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-expense/tree/16.0/hr_expense_payment"><img alt="OCA/hr-expense" src="https://img.shields.io/badge/github-OCA%2Fhr--expense-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-expense-16-0/hr-expense-16-0-hr_expense_payment"><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-expense&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 module allow payment link to expense.
After you register payment on expense sheet, it will link between expense sheet and payment.</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-expense/tree/17.0/hr_expense_payment"><img alt="OCA/hr-expense" src="https://img.shields.io/badge/github-OCA%2Fhr--expense-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-expense-17-0/hr-expense-17-0-hr_expense_payment"><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-expense&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allow payment link to expense. After you register payment on
expense sheet, it will link between expense sheet and payment.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -389,7 +389,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-expense/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-expense/issues/new?body=module:%20hr_expense_payment%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/hr-expense/issues/new?body=module:%20hr_expense_payment%0Aversion:%2017.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 @@ -406,6 +406,10 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Saran Lim. &lt;<a class="reference external" href="mailto:saranl&#64;ecosoft.co.th">saranl&#64;ecosoft.co.th</a>&gt;</li>
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
<li><a class="reference external" href="https://apsl.tech">APSL</a>:<ul>
<li>Antoni Marroig &lt;<a class="reference external" href="mailto:toni.marroig1&#64;gmail.com">toni.marroig1&#64;gmail.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -415,7 +419,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-expense/tree/16.0/hr_expense_payment">OCA/hr-expense</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr-expense/tree/17.0/hr_expense_payment">OCA/hr-expense</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
4 changes: 2 additions & 2 deletions hr_expense_payment/tests/test_hr_expense_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def setUp(self):
"journal_id": self.expense_journal.id,
}
)
self.expense_sheet.approve_expense_sheets()
self.expense_sheet.action_approve_expense_sheets()

self.expense = self.env["hr.expense"].create(
{
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_post_init_hook(self):

self.assertFalse(payment)
self.assertFalse(payment.expense_sheet_ids)
post_init_hook(self.env.cr, self.registry)
post_init_hook(self.env)

self.assertEqual(len(self.expense_sheet.payment_ids), 1)

Expand Down
2 changes: 1 addition & 1 deletion hr_expense_payment/wizard/account_payment_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _create_payment_vals_from_batch(self, batch_result):
)
sheet_ids = self.env["hr.expense.sheet"].browse(expense_sheet_ids)
sheet_id = sheet_ids.filtered(
lambda l: l.account_move_id.id == move_line_ids.move_id.id
lambda x: x.account_move_id.id == move_line_ids.move_id.id
)
payment_vals.update(expense_sheet_ids=sheet_id.ids)
return payment_vals

0 comments on commit bd305c2

Please sign in to comment.