Skip to content

Commit

Permalink
[ADD] account_reversal_usability
Browse files Browse the repository at this point in the history
This commit adds the account_reversal_usability module which purpose is to
improve the usability of the move line reverse functionality by adding:

* a field that allows tagging a move line as needing to be reversed.
  The value of the field gets automatically set to False once a reversed
  entry is made.
* a filter in the search view that allows selecting the moves that are
  flagged as needing to be reversed.
* the reverse move in the form view
  • Loading branch information
IT-Ideas committed Nov 4, 2023
1 parent f6adbe2 commit f51b290
Show file tree
Hide file tree
Showing 14 changed files with 698 additions and 0 deletions.
81 changes: 81 additions & 0 deletions account_reversal_usability/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
==========================
Account Reversal Usability
==========================

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

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

This module purpose is to improve the usability of the move line reverse functionality by adding:

* a field that allows tagging a move line as needing to be reversed. The value of the field gets automatically set to False once a reversed entry is made.
* a filter in the search view that allows selecting the moves that are flagged as needing to be reversed.
* the reverse move in the form view

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/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/account-financial-tools/issues/new?body=module:%20account_reversal_usability%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
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* Stéphane Bidoul <[email protected]>
* Laurent Stukkens <[email protected]>

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.

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/16.0/account_reversal_usability>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_reversal_usability/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions account_reversal_usability/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Account Reversal Usability",
"summary": """
This module purpose is to improve the usability of the move line reverse functionality
by adding:
* a field that allows tagging a move line as needing to be reversed. The value of
the field gets automatically set to False once a reversed entry is made.
* a filter in the search view that allows selecting the moves that are flagged as
needing to be reversed.
* the reverse move in the form view""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": [
"account",
],
"data": [
"views/account_move.xml",
],
"demo": [],
}
1 change: 1 addition & 0 deletions account_reversal_usability/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move
42 changes: 42 additions & 0 deletions account_reversal_usability/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from setuptools.config._validate_pyproject import ValidationError

from odoo import _, api, fields, models


class MoveAlreadyReversedValidationError(ValidationError):
pass


class AccountMove(models.Model):

_inherit = "account.move"

to_be_reversed = fields.Boolean(
compute="_compute_to_be_reversed", store=True, readonly=False, copy=False
)
reversal_id = fields.Many2one(
"account.move", compute="_compute_reversal_id", string="Reversal Entry"
)

@api.depends("reversal_move_id")
def _compute_to_be_reversed(self):
self.filtered("reversal_move_id").to_be_reversed = False

@api.depends("reversal_move_id")
def _compute_reversal_id(self):
for move in self:
move.reversal_id = move.reversal_move_id[:1]

@api.constrains("to_be_reversed", "reversal_id")
def check_to_be_reversed(self):
for move in self:
if move.to_be_reversed and move.reversal_id:
raise MoveAlreadyReversedValidationError(
_(
"The move has already been reversed. "
"So you are can't mark it as to be reversed."
)
)
2 changes: 2 additions & 0 deletions account_reversal_usability/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Stéphane Bidoul <[email protected]>
* Laurent Stukkens <[email protected]>
5 changes: 5 additions & 0 deletions account_reversal_usability/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module purpose is to improve the usability of the move line reverse functionality by adding:

* a field that allows tagging a move line as needing to be reversed. The value of the field gets automatically set to False once a reversed entry is made.
* a filter in the search view that allows selecting the moves that are flagged as needing to be reversed.
* the reverse move in the form view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f51b290

Please sign in to comment.