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

[13.0][BKP][ADD]account_move_cancel_confirm #1825

Open
wants to merge 7 commits into
base: 13.0
Choose a base branch
from
Open
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
87 changes: 87 additions & 0 deletions account_move_cancel_confirm/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
===========================
Account Move Cancel Confirm
===========================

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

.. |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--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/16.0/account_move_cancel_confirm
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_move_cancel_confirm
: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-invoicing&target_branch=16.0
:alt: Try me on Runboat

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

When user click to cancel invoice and journal entry, a confirmation wizard will be show, with reason as optional.

For information on how to enable the feature, refer to the Configuration of the module *base_cancel_confirm*.

**Table of contents**

.. contents::
:local:

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

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

* Ecosoft

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

* Kitti U. <[email protected]>
* 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-kittiu| image:: https://github.com/kittiu.png?size=40px
:target: https://github.com/kittiu
:alt: kittiu

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

|maintainer-kittiu|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions account_move_cancel_confirm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import model
14 changes: 14 additions & 0 deletions account_move_cancel_confirm/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Account Move Cancel Confirm",
"version": "13.0.1.0.0",
"author": "Ecosoft, Odoo Community Association (OCA)",
"category": "Usability",
"license": "AGPL-3",
"website": "https://github.com/OCA/account-invoicing",
"depends": ["base_cancel_confirm", "account"],
"installable": True,
"maintainers": ["kittiu"],
}
48 changes: 48 additions & 0 deletions account_move_cancel_confirm/i18n/account_move_cancel_confirm.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_cancel_confirm
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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_cancel_confirm
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_confirm
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_confirm
msgid "A flag signify that this document is confirmed for cancellation"
msgstr ""

#. module: account_move_cancel_confirm
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_reason
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_reason
msgid "An optional cancel reason"
msgstr ""

#. module: account_move_cancel_confirm
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_confirm
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_confirm
msgid "Cancel Confirmed"
msgstr ""

#. module: account_move_cancel_confirm
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_reason
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_reason
msgid "Cancel Reason"
msgstr ""

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

#. module: account_move_cancel_confirm
#: model:ir.model,name:account_move_cancel_confirm.model_account_payment
msgid "Payments"
msgstr ""
51 changes: 51 additions & 0 deletions account_move_cancel_confirm/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_cancel_confirm
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-08-07 17:58+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\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 5.6.2\n"

#. module: account_move_cancel_confirm
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_confirm
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_confirm
msgid "A flag signify that this document is confirmed for cancellation"
msgstr "Una spunta indica che questo documento è confermato per l'annullamento"

#. module: account_move_cancel_confirm
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_reason
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_reason
msgid "An optional cancel reason"
msgstr "Un motivo di annullamento opzionale"

#. module: account_move_cancel_confirm
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_confirm
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_confirm
msgid "Cancel Confirmed"
msgstr "Annullamento confermato"

#. module: account_move_cancel_confirm
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_reason
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_reason
msgid "Cancel Reason"
msgstr "Causale annullamento"

#. module: account_move_cancel_confirm
#: model:ir.model,name:account_move_cancel_confirm.model_account_move
msgid "Journal Entry"
msgstr "Registrazione contabile"

#. module: account_move_cancel_confirm
#: model:ir.model,name:account_move_cancel_confirm.model_account_payment
msgid "Payments"
msgstr "Pagamenti"
4 changes: 4 additions & 0 deletions account_move_cancel_confirm/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import account_move
from . import account_payment
30 changes: 30 additions & 0 deletions account_move_cancel_confirm/model/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class AccountMove(models.Model):
_name = "account.move"
_inherit = ["account.move", "base.cancel.confirm"]

_has_cancel_reason = "optional" # ["no", "optional", "required"]

def button_cancel(self):
cancel_res_model = self.env.context.get("cancel_res_model", False)
cancel_res_ids = self.env.context.get("cancel_res_ids", False)
cancel_method = self.env.context.get("cancel_method", False)
# cancel from payment
if cancel_res_model == "account.payment" and cancel_method == "action_cancel":
docs = self.env[cancel_res_model].browse(cancel_res_ids)
cancel_reason = ", ".join(
docs.filtered("cancel_reason").mapped("cancel_reason")
)
self.write({"cancel_confirm": True, "cancel_reason": cancel_reason})
if not self.filtered("cancel_confirm"):
return self.open_cancel_confirm_wizard()
return super().button_cancel()

def button_draft(self):
self.clear_cancel_confirm_data()
return super().button_draft()
20 changes: 20 additions & 0 deletions account_move_cancel_confirm/model/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class AccountPayment(models.Model):
_name = "account.payment"
_inherit = ["account.payment", "base.cancel.confirm"]

_has_cancel_reason = "optional" # ["no", "optional", "required"]

def action_cancel(self):
if not self.filtered("cancel_confirm"):
return self.open_cancel_confirm_wizard()
return super().action_cancel()

def action_draft(self):
self.clear_cancel_confirm_data()
return super().action_draft()
3 changes: 3 additions & 0 deletions account_move_cancel_confirm/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Kitti U. <[email protected]>
* Jordi Masvidal <[email protected]>
* Guillem Casassas <[email protected]>
3 changes: 3 additions & 0 deletions account_move_cancel_confirm/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
When user click to cancel invoice and journal entry, a confirmation wizard will be show, with reason as optional.

For information on how to enable the feature, refer to the Configuration of the module *base_cancel_confirm*.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading