Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] account_move_show_reversal #2015

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions account_move_show_reversal/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
==========================
Account Move Show Reversal
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:917b5937b0cb39711f45ca2768f695430e5510bfc492f1fac50036d0ee8cb806
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-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_move_show_reversal
: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_move_show_reversal
: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|

Add a button on journal entries to easily navigate to its reversals and vice versa.

**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_move_show_reversal%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
~~~~~~~

* ForgeFlow S.L.

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

* `ForgeFlow S.L. <https://www.forgeflow.com>`__:

* Jordi Masvidal <[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.

.. |maintainer-JordiMForgeFlow| image:: https://github.com/JordiMForgeFlow.png?size=40px
:target: https://github.com/JordiMForgeFlow
:alt: JordiMForgeFlow

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-JordiMForgeFlow|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_move_show_reversal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import models
16 changes: 16 additions & 0 deletions account_move_show_reversal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Account Move Show Reversal",
"summary": "Add button to navigate between moves and their reversals.",
"version": "16.0.1.0.0",
"category": "Accounting",
"website": "https://github.com/OCA/account-financial-tools",
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
"maintainers": ["JordiMForgeFlow"],
"license": "LGPL-3",
"depends": [
"account",
],
"data": ["views/account_move.xml"],
}
3 changes: 3 additions & 0 deletions account_move_show_reversal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import account_move
57 changes: 57 additions & 0 deletions account_move_show_reversal/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2024 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models


class AccountMove(models.Model):
_inherit = "account.move"

is_reversed = fields.Boolean(compute="_compute_is_reversed")

@api.depends("reversal_move_id")
def _compute_is_reversed(self):
for rec in self:
rec.is_reversed = bool(rec.reversal_move_id)

def action_open_reversed_move(self):
self.ensure_one()

Check warning on line 18 in account_move_show_reversal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_show_reversal/models/account_move.py#L18

Added line #L18 was not covered by tests
if not self.reversed_entry_id:
return {}
return {

Check warning on line 21 in account_move_show_reversal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_show_reversal/models/account_move.py#L20-L21

Added lines #L20 - L21 were not covered by tests
"name": self.reversed_entry_id.name,
"type": "ir.actions.act_window",
"view_mode": "form",
"views": [[False, "form"]],
"res_model": "account.move",
"res_id": self.reversed_entry_id.id,
}

def action_open_reversal_moves(self):
self.ensure_one()

Check warning on line 31 in account_move_show_reversal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_show_reversal/models/account_move.py#L31

Added line #L31 was not covered by tests
if not self.reversal_move_id:
return {}

Check warning on line 33 in account_move_show_reversal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_show_reversal/models/account_move.py#L33

Added line #L33 was not covered by tests
if len(self.reversal_move_id) == 1:
return {

Check warning on line 35 in account_move_show_reversal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_show_reversal/models/account_move.py#L35

Added line #L35 was not covered by tests
"name": self.reversal_move_id.name,
"type": "ir.actions.act_window",
"view_mode": "form",
"views": [[False, "form"]],
"res_model": "account.move",
"res_id": self.reversal_move_id.id,
}
return {

Check warning on line 43 in account_move_show_reversal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_move_show_reversal/models/account_move.py#L43

Added line #L43 was not covered by tests
"name": _("Journal Entries"),
"view_mode": "tree,form",
"res_model": "account.move",
"search_view_id": [
self.env.ref("account.view_account_move_filter").id,
"search",
],
"views": [
(self.env.ref("account.view_move_tree").id, "tree"),
(False, "form"),
],
"type": "ir.actions.act_window",
"domain": [("id", "in", self.reversal_move_id.ids)],
}
3 changes: 3 additions & 0 deletions account_move_show_reversal/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `ForgeFlow S.L. <https://www.forgeflow.com>`__:

* Jordi Masvidal <[email protected]>
1 change: 1 addition & 0 deletions account_move_show_reversal/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a button on journal entries to easily navigate to its reversals and vice versa.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading