Skip to content

Commit 79e5d3e

Browse files
committed
Merge PR OCA#1898 into 17.0
Signed-off-by AaronHForgeFlow
2 parents 71ce13f + 89494be commit 79e5d3e

15 files changed

+802
-0
lines changed
+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
===========================
2+
Account Move Cancel Confirm
3+
===========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:6d9331c29140b523ccb8fc453786dcfb6f74b4037119c36c0fe65d26b0eb1dea
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
20+
:target: https://github.com/OCA/account-invoicing/tree/17.0/account_move_cancel_confirm
21+
:alt: OCA/account-invoicing
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-account_move_cancel_confirm
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
When user click to cancel invoice and journal entry, a confirmation
32+
wizard will be show, with reason as optional.
33+
34+
For information on how to enable the feature, refer to the Configuration
35+
of the module *base_cancel_confirm*.
36+
37+
**Table of contents**
38+
39+
.. contents::
40+
:local:
41+
42+
Bug Tracker
43+
===========
44+
45+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
46+
In case of trouble, please check there if your issue has already been reported.
47+
If you spotted it first, help us to smash it by providing a detailed and welcomed
48+
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_move_cancel_confirm%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
49+
50+
Do not contact contributors directly about support or help with technical issues.
51+
52+
Credits
53+
=======
54+
55+
Authors
56+
-------
57+
58+
* Ecosoft
59+
60+
Contributors
61+
------------
62+
63+
- Kitti U. <kittiu@ecosoft.co.th>
64+
- Jordi Masvidal <jordi.masvidal@forgeflow.com>
65+
66+
Maintainers
67+
-----------
68+
69+
This module is maintained by the OCA.
70+
71+
.. image:: https://odoo-community.org/logo.png
72+
:alt: Odoo Community Association
73+
:target: https://odoo-community.org
74+
75+
OCA, or the Odoo Community Association, is a nonprofit organization whose
76+
mission is to support the collaborative development of Odoo features and
77+
promote its widespread use.
78+
79+
.. |maintainer-kittiu| image:: https://github.com/kittiu.png?size=40px
80+
:target: https://github.com/kittiu
81+
:alt: kittiu
82+
83+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
84+
85+
|maintainer-kittiu|
86+
87+
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/17.0/account_move_cancel_confirm>`_ project on GitHub.
88+
89+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from . import model
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
{
5+
"name": "Account Move Cancel Confirm",
6+
"version": "17.0.1.0.0",
7+
"author": "Ecosoft, Odoo Community Association (OCA)",
8+
"category": "Usability",
9+
"license": "AGPL-3",
10+
"website": "https://github.com/OCA/account-invoicing",
11+
"depends": ["base_cancel_confirm", "account"],
12+
"installable": True,
13+
"maintainers": ["kittiu"],
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * account_move_cancel_confirm
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: account_move_cancel_confirm
17+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_confirm
18+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_confirm
19+
msgid "A flag signify that this document is confirmed for cancellation"
20+
msgstr ""
21+
22+
#. module: account_move_cancel_confirm
23+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_reason
24+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_reason
25+
msgid "An optional cancel reason"
26+
msgstr ""
27+
28+
#. module: account_move_cancel_confirm
29+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_confirm
30+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_confirm
31+
msgid "Cancel Confirmed"
32+
msgstr ""
33+
34+
#. module: account_move_cancel_confirm
35+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_reason
36+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_reason
37+
msgid "Cancel Reason"
38+
msgstr ""
39+
40+
#. module: account_move_cancel_confirm
41+
#: model:ir.model,name:account_move_cancel_confirm.model_account_move
42+
msgid "Journal Entry"
43+
msgstr ""
44+
45+
#. module: account_move_cancel_confirm
46+
#: model:ir.model,name:account_move_cancel_confirm.model_account_payment
47+
msgid "Payments"
48+
msgstr ""
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * account_move_cancel_confirm
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2024-08-07 17:58+0000\n"
10+
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 5.6.2\n"
18+
19+
#. module: account_move_cancel_confirm
20+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_confirm
21+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_confirm
22+
msgid "A flag signify that this document is confirmed for cancellation"
23+
msgstr "Una spunta indica che questo documento è confermato per l'annullamento"
24+
25+
#. module: account_move_cancel_confirm
26+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_move__cancel_reason
27+
#: model:ir.model.fields,help:account_move_cancel_confirm.field_account_payment__cancel_reason
28+
msgid "An optional cancel reason"
29+
msgstr "Un motivo di annullamento opzionale"
30+
31+
#. module: account_move_cancel_confirm
32+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_confirm
33+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_confirm
34+
msgid "Cancel Confirmed"
35+
msgstr "Annullamento confermato"
36+
37+
#. module: account_move_cancel_confirm
38+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_move__cancel_reason
39+
#: model:ir.model.fields,field_description:account_move_cancel_confirm.field_account_payment__cancel_reason
40+
msgid "Cancel Reason"
41+
msgstr "Causale annullamento"
42+
43+
#. module: account_move_cancel_confirm
44+
#: model:ir.model,name:account_move_cancel_confirm.model_account_move
45+
msgid "Journal Entry"
46+
msgstr "Registrazione contabile"
47+
48+
#. module: account_move_cancel_confirm
49+
#: model:ir.model,name:account_move_cancel_confirm.model_account_payment
50+
msgid "Payments"
51+
msgstr "Pagamenti"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2+
3+
from . import account_move
4+
from . import account_payment
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import models
5+
6+
7+
class AccountMove(models.Model):
8+
_name = "account.move"
9+
_inherit = ["account.move", "base.cancel.confirm"]
10+
11+
_has_cancel_reason = "optional" # ["no", "optional", "required"]
12+
13+
def button_cancel(self):
14+
cancel_res_model = self.env.context.get("cancel_res_model", False)
15+
cancel_res_ids = self.env.context.get("cancel_res_ids", False)
16+
cancel_method = self.env.context.get("cancel_method", False)
17+
# cancel from payment
18+
if cancel_res_model == "account.payment" and cancel_method == "action_cancel":
19+
docs = self.env[cancel_res_model].browse(cancel_res_ids)
20+
cancel_reason = ", ".join(
21+
docs.filtered("cancel_reason").mapped("cancel_reason")
22+
)
23+
self.write({"cancel_confirm": True, "cancel_reason": cancel_reason})
24+
if not self.filtered("cancel_confirm"):
25+
return self.open_cancel_confirm_wizard()
26+
return super().button_cancel()
27+
28+
def button_draft(self):
29+
self.clear_cancel_confirm_data()
30+
return super().button_draft()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import models
5+
6+
7+
class AccountPayment(models.Model):
8+
_name = "account.payment"
9+
_inherit = ["account.payment", "base.cancel.confirm"]
10+
11+
_has_cancel_reason = "optional" # ["no", "optional", "required"]
12+
13+
def action_cancel(self):
14+
if not self.filtered("cancel_confirm"):
15+
return self.open_cancel_confirm_wizard()
16+
return super().action_cancel()
17+
18+
def action_draft(self):
19+
self.clear_cancel_confirm_data()
20+
return super().action_draft()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Kitti U. \<<kittiu@ecosoft.co.th>\>
2+
- Jordi Masvidal \<<jordi.masvidal@forgeflow.com>\>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
When user click to cancel invoice and journal entry, a confirmation
2+
wizard will be show, with reason as optional.
3+
4+
For information on how to enable the feature, refer to the Configuration
5+
of the module *base_cancel_confirm*.
Loading

0 commit comments

Comments
 (0)