-
-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
14 changed files
with
711 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 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", | ||
copy=False, | ||
default=False, | ||
readonly=False, | ||
store=True, | ||
) | ||
reversal_id = fields.Many2one( | ||
"account.move", compute="_compute_reversal_id", string="Reversal Entry" | ||
) | ||
|
||
@api.depends("reversal_move_id") | ||
def _compute_to_be_reversed(self): | ||
# Although the field is stored, and as there is a default value, | ||
# we don't need to provide a value for every record. | ||
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._get_reversal_id() | ||
|
||
@api.constrains("to_be_reversed", "reversal_move_id") | ||
def check_to_be_reversed(self): | ||
for move in self: | ||
if move.to_be_reversed and move._get_reversal_id(): | ||
raise MoveAlreadyReversedValidationError( | ||
_( | ||
"The move has already been reversed, " | ||
"so you are not allowed to mark it as to be reversed." | ||
) | ||
) | ||
|
||
def _get_reversal_id(self): | ||
# Although theoretically a o2o, reversal_move_id is technically a o2m, | ||
# which does not prevent having more than one record. That is why we are using | ||
# a slicing in order to get the first record or an empty recordset. | ||
self.ensure_one() | ||
return self.reversal_move_id[:1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Stéphane Bidoul <[email protected]> | ||
* Laurent Stukkens <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.