Skip to content

Commit

Permalink
Merge PR #568 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Aug 31, 2023
2 parents afed064 + fb7e9d2 commit 30f303a
Show file tree
Hide file tree
Showing 17 changed files with 819 additions and 0 deletions.
88 changes: 88 additions & 0 deletions account_move_reconcile_forbid_cancel/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
====================================
Account Move Reconcile Forbid Cancel
====================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--reconcile-lightgray.png?logo=github
:target: https://github.com/OCA/account-reconcile/tree/15.0/account_move_reconcile_forbid_cancel
:alt: OCA/account-reconcile
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-reconcile-15-0/account-reconcile-15-0-account_move_reconcile_forbid_cancel
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/98/15.0
:alt: Try me on Runbot

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

This module restricts to cancel or reset to draft any invoice/journal entry that
has been reconciled (aka paid).

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

#. Go to *Invoicing > Customers > Invoices*
#. Access an invoice that has a payment.
#. Click on the 'Reset to Draft' button and you will get an error
message to prevent you from resetting the invoice to draft state because
it has already an associated payment.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-reconcile/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_move_reconcile_forbid_cancel%0Aversion:%2015.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>`_:

* Ernesto Tejeda
* Pedro M. Baeza

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-reconcile <https://github.com/OCA/account-reconcile/tree/15.0/account_move_reconcile_forbid_cancel>`_ 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_reconcile_forbid_cancel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
12 changes: 12 additions & 0 deletions account_move_reconcile_forbid_cancel/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2022 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Account Move Reconcile Forbid Cancel",
"version": "16.0.1.0.0",
"category": "Finance",
"website": "https://github.com/OCA/account-reconcile",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["account"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_reconcile_forbid_cancel
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_move_reconcile_forbid_cancel
#: model:ir.model,name:account_move_reconcile_forbid_cancel.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_move_reconcile_forbid_cancel
#: code:addons/account_move_reconcile_forbid_cancel/models/account_move.py:0
#, python-format
msgid "You cannot cancel reconciled entries."
msgstr ""

#. module: account_move_reconcile_forbid_cancel
#: code:addons/account_move_reconcile_forbid_cancel/models/account_move.py:0
#, python-format
msgid "You cannot reset to draft reconciled entries."
msgstr ""
38 changes: 38 additions & 0 deletions account_move_reconcile_forbid_cancel/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_reconcile_forbid_cancel
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-20 14:20+0000\n"
"PO-Revision-Date: 2022-06-29 14:50+0000\n"
"Last-Translator: Ernesto Tejeda <[email protected]>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: account_move_reconcile_forbid_cancel
#: model:ir.model,name:account_move_reconcile_forbid_cancel.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_move_reconcile_forbid_cancel
#: code:addons/account_move_reconcile_forbid_cancel/models/account_move.py:0
#, python-format
msgid "You cannot cancel reconciled entries."
msgstr "No puede cancelar asientos conciliados"

#. module: account_move_reconcile_forbid_cancel
#: code:addons/account_move_reconcile_forbid_cancel/models/account_move.py:0
#, python-format
msgid "You cannot reset to draft reconciled entries."
msgstr "No puede cambiar a borrador asientos conciliados"

#~ msgid "Journal Entries"
#~ msgstr "Asientos contables"
34 changes: 34 additions & 0 deletions account_move_reconcile_forbid_cancel/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_reconcile_forbid_cancel
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-17 22:25+0000\n"
"Last-Translator: Douglas Custódio <[email protected]>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: account_move_reconcile_forbid_cancel
#: model:ir.model,name:account_move_reconcile_forbid_cancel.model_account_move
msgid "Journal Entry"
msgstr "Lançamento de Diário"

#. module: account_move_reconcile_forbid_cancel
#: code:addons/account_move_reconcile_forbid_cancel/models/account_move.py:0
#, python-format
msgid "You cannot cancel reconciled entries."
msgstr "Você não pode cancelar lançamentos reconciliados."

#. module: account_move_reconcile_forbid_cancel
#: code:addons/account_move_reconcile_forbid_cancel/models/account_move.py:0
#, python-format
msgid "You cannot reset to draft reconciled entries."
msgstr "Você não pode redefinir para rascunho lançamentos reconciliados."
3 changes: 3 additions & 0 deletions account_move_reconcile_forbid_cancel/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import account_move
29 changes: 29 additions & 0 deletions account_move_reconcile_forbid_cancel/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, models, tools
from odoo.exceptions import ValidationError


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

def button_draft(self):
if not self.env.context.get("skip_reconcile_forbid_cancel") and (
not tools.config["test_enable"]
or self.env.context.get("test_reconcile_forbid_cancel")
):
if self._get_reconciled_amls():
raise ValidationError(
_("You cannot reset to draft reconciled entries.")
)
return super().button_draft()

def button_cancel(self):
if not self.env.context.get("skip_reconcile_forbid_cancel") and (
not tools.config["test_enable"]
or self.env.context.get("test_reconcile_forbid_cancel")
):
if self._get_reconciled_amls():
raise ValidationError(_("You cannot cancel reconciled entries."))
return super().button_cancel()
4 changes: 4 additions & 0 deletions account_move_reconcile_forbid_cancel/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Ernesto Tejeda
* Pedro M. Baeza
2 changes: 2 additions & 0 deletions account_move_reconcile_forbid_cancel/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module restricts to cancel or reset to draft any invoice/journal entry that
has been reconciled (aka paid).
7 changes: 7 additions & 0 deletions account_move_reconcile_forbid_cancel/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
To use this module, you need to:

#. Go to *Invoicing > Customers > Invoices*
#. Access an invoice that has a payment.
#. Click on the 'Reset to Draft' button and you will get an error
message to prevent you from resetting the invoice to draft state because
it has already an associated payment.
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 30f303a

Please sign in to comment.