Skip to content

Commit

Permalink
[IMP] hr_expense_cancel: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ilo committed May 15, 2024
1 parent e79cfa6 commit 03f0d6e
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 91 deletions.
72 changes: 37 additions & 35 deletions hr_expense_cancel/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ Hr expense cancel
: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_cancel
:target: https://github.com/OCA/hr-expense/tree/17.0/hr_expense_cancel
: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_cancel
:target: https://translation.odoo-community.org/projects/hr-expense-17-0/hr-expense-17-0-hr_expense_cancel
: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 allows you to cancel and correct expenses. It adds a cancel button
on the expense sheet that undo reconciliations and delete payments and journal
entries.
This module allows you to cancel and correct expenses. It adds a cancel
button on the expense sheet that undo reconciliations and delete
payments and journal entries.

**Table of contents**

Expand All @@ -40,63 +40,65 @@ entries.
Installation
============

It's assumed that for each expense sheet, the *payments* that are reconciled
with their *journal entry* were created and reconciled by the *Expense Tracker*
module automatically. Therefore, when this module is installed, these payments
will automatically be associated with said expense sheet so that they can be
deleted in case the expense sheet is canceled.
It's assumed that for each expense sheet, the *payments* that are
reconciled with their *journal entry* were created and reconciled by the
*Expense Tracker* module automatically. Therefore, when this module is
installed, these payments will automatically be associated with said
expense sheet so that they can be deleted in case the expense sheet is
canceled.

Usage
=====

To use this module, you need to:

#. Go to *Expenses -> My Expenses -> Expenses to Submit* and create a new
*Expense* with *Employee (to reimburse)* checked on the field *Payment By*
#. Click on *Submit to Manager* button
#. Click on *Approve* button
#. Click on *Post Journal Entries* button
#. Click on *Register Payment* button, fill in the data of the wizard and
click on *Validate* button
#. After that, the *Expense report* will have an associated journal entry
reconciled with a payment
#. Click on *Cancel* button
#. The *Expense report* will be set to *Submitted* state; the journal entry and
the payment will be deleted
1. Go to *Expenses -> My Expenses -> Expenses to Submit* and create a
new *Expense* with *Employee (to reimburse)* checked on the field
*Payment By*
2. Click on *Submit to Manager* button
3. Click on *Approve* button
4. Click on *Post Journal Entries* button
5. Click on *Register Payment* button, fill in the data of the wizard
and click on *Validate* button
6. After that, the *Expense report* will have an associated journal
entry reconciled with a payment
7. Click on *Cancel* button
8. The *Expense report* will be set to *Submitted* state; the journal
entry and the payment will be deleted

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_cancel%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_cancel%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

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

* `Tecnativa <https://www.tecnativa.com>`_:
- `Tecnativa <https://www.tecnativa.com>`__:

* Pedro M. Baeza
* Ernesto Tejeda
* Stefan Ungureanu
- Pedro M. Baeza
- Ernesto Tejeda
- Stefan Ungureanu

* Danh Vo <https://github.com/danhvophuong>
* Saran Lim. <saranl@ecosoft.co.th>
* Manuel Regidor <manuel.regidor@sygel.es>
- Danh Vo <https://github.com/danhvophuong>
- Saran Lim. <saranl@ecosoft.co.th>
- Manuel Regidor <manuel.regidor@sygel.es>

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

This module is maintained by the OCA.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 3 additions & 2 deletions hr_expense_cancel/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Hr expense cancel",
"version": "16.0.1.0.2",
"version": "17.0.1.0.2",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr-expense",
"license": "AGPL-3",
Expand All @@ -12,7 +12,8 @@
# with it's corresponding expense sheet.
# So when you want to cancel payments associated to a expense_sheet,
# you need to know which payments are related with your expense sheet.
# And that information is not available by inheriting hr_expense alone, we need the module
# And that information is not available by inheriting hr_expense alone,
# we need the module
"depends": ["hr_expense_payment"],
"data": ["views/hr_expense_views.xml"],
"installable": True,
Expand Down
4 changes: 2 additions & 2 deletions hr_expense_cancel/models/hr_expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def action_cancel(self):
for sheet in self:
account_move = sheet.account_move_id
sheet.account_move_id = False
payments = sheet.payment_ids.filtered(lambda l: l.state != "cancel")
payments = sheet.payment_ids.filtered(lambda line: line.state != "cancel")
# case : cancel invoice from hr_expense
self._remove_reconcile_hr_invoice(account_move)
# If the sheet is paid then remove payments
Expand All @@ -38,7 +38,7 @@ def _remove_reconcile_hr_invoice(self, account_move):
aml = self.env["account.move.line"].search(
[("full_reconcile_id", "in", reconcile.ids)]
)
exp_move_line = aml.filtered(lambda l: l.move_id.id != account_move.id)
exp_move_line = aml.filtered(lambda line: line.move_id.id != account_move.id)
# set state to cancel
exp_move_line.move_id.button_draft()
exp_move_line.move_id.button_cancel()
Expand Down
3 changes: 3 additions & 0 deletions hr_expense_cancel/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
7 changes: 7 additions & 0 deletions hr_expense_cancel/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- [Tecnativa](https://www.tecnativa.com):
- Pedro M. Baeza
- Ernesto Tejeda
- Stefan Ungureanu
- Danh Vo \<<https://github.com/danhvophuong>\>
- Saran Lim. \<<saranl@ecosoft.co.th>\>
- Manuel Regidor \<<manuel.regidor@sygel.es>\>
9 changes: 0 additions & 9 deletions hr_expense_cancel/readme/CONTRIBUTORS.rst

This file was deleted.

3 changes: 3 additions & 0 deletions hr_expense_cancel/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module allows you to cancel and correct expenses. It adds a cancel
button on the expense sheet that undo reconciliations and delete
payments and journal entries.
3 changes: 0 additions & 3 deletions hr_expense_cancel/readme/DESCRIPTION.rst

This file was deleted.

6 changes: 6 additions & 0 deletions hr_expense_cancel/readme/INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
It's assumed that for each expense sheet, the *payments* that are
reconciled with their *journal entry* were created and reconciled by the
*Expense Tracker* module automatically. Therefore, when this module is
installed, these payments will automatically be associated with said
expense sheet so that they can be deleted in case the expense sheet is
canceled.
5 changes: 0 additions & 5 deletions hr_expense_cancel/readme/INSTALL.rst

This file was deleted.

15 changes: 15 additions & 0 deletions hr_expense_cancel/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
To use this module, you need to:

1. Go to *Expenses -\> My Expenses -\> Expenses to Submit* and create a
new *Expense* with *Employee (to reimburse)* checked on the field
*Payment By*
2. Click on *Submit to Manager* button
3. Click on *Approve* button
4. Click on *Post Journal Entries* button
5. Click on *Register Payment* button, fill in the data of the wizard
and click on *Validate* button
6. After that, the *Expense report* will have an associated journal
entry reconciled with a payment
7. Click on *Cancel* button
8. The *Expense report* will be set to *Submitted* state; the journal
entry and the payment will be deleted
14 changes: 0 additions & 14 deletions hr_expense_cancel/readme/USAGE.rst

This file was deleted.

43 changes: 22 additions & 21 deletions hr_expense_cancel/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -369,10 +368,10 @@ <h1 class="title">Hr expense cancel</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dd9d0bd40b90578c3646bf029a19cfa4dd593fee766bc787e401c069918694dd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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_cancel"><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_cancel"><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 allows you to cancel and correct expenses. It adds a cancel button
on the expense sheet that undo reconciliations and delete payments and journal
entries.</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_cancel"><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_cancel"><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 allows you to cancel and correct expenses. It adds a cancel
button on the expense sheet that undo reconciliations and delete
payments and journal entries.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -389,36 +388,38 @@ <h1 class="title">Hr expense cancel</h1>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<p>It’s assumed that for each expense sheet, the <em>payments</em> that are reconciled
with their <em>journal entry</em> were created and reconciled by the <em>Expense Tracker</em>
module automatically. Therefore, when this module is installed, these payments
will automatically be associated with said expense sheet so that they can be
deleted in case the expense sheet is canceled.</p>
<p>It’s assumed that for each expense sheet, the <em>payments</em> that are
reconciled with their <em>journal entry</em> were created and reconciled by the
<em>Expense Tracker</em> module automatically. Therefore, when this module is
installed, these payments will automatically be associated with said
expense sheet so that they can be deleted in case the expense sheet is
canceled.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Expenses -&gt; My Expenses -&gt; Expenses to Submit</em> and create a new
<em>Expense</em> with <em>Employee (to reimburse)</em> checked on the field <em>Payment By</em></li>
<li>Go to <em>Expenses -&gt; My Expenses -&gt; Expenses to Submit</em> and create a
new <em>Expense</em> with <em>Employee (to reimburse)</em> checked on the field
<em>Payment By</em></li>
<li>Click on <em>Submit to Manager</em> button</li>
<li>Click on <em>Approve</em> button</li>
<li>Click on <em>Post Journal Entries</em> button</li>
<li>Click on <em>Register Payment</em> button, fill in the data of the wizard and
click on <em>Validate</em> button</li>
<li>After that, the <em>Expense report</em> will have an associated journal entry
reconciled with a payment</li>
<li>Click on <em>Register Payment</em> button, fill in the data of the wizard
and click on <em>Validate</em> button</li>
<li>After that, the <em>Expense report</em> will have an associated journal
entry reconciled with a payment</li>
<li>Click on <em>Cancel</em> button</li>
<li>The <em>Expense report</em> will be set to <em>Submitted</em> state; the journal entry and
the payment will be deleted</li>
<li>The <em>Expense report</em> will be set to <em>Submitted</em> state; the journal
entry and the payment will be deleted</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">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_cancel%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_cancel%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 @@ -438,7 +439,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Stefan Ungureanu</li>
</ul>
</li>
<li>Danh Vo &lt;<a class="reference external" href="https://github.com/danhvophuong">https://github.com/danhvophuong</a>&gt;</li>
<li>Danh Vo &lt;<a class="reference external" href="https://github.com/danhvophuong">https://github.com/danhvophuong</a>&gt;</li>
<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>
</ul>
Expand All @@ -450,7 +451,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">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_cancel">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_cancel">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

0 comments on commit 03f0d6e

Please sign in to comment.