Skip to content
Snippets Groups Projects
Commit 6044da7611c2 authored by Etienne Ferriere's avatar Etienne Ferriere
Browse files

On invoice refunding with new invoice, ensure that the new invoice is opened in

a form view corresponding to its invoice type.
parent ceb5fe5f2455
No related branches found
No related tags found
1 merge request!50On invoice refunding with new invoice, ensure that the new invoice is opened in
Pipeline #116226 passed with warnings
This commit is part of merge request !50. Comments created here will be created in the context of that merge request.
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
Changelog Changelog
========= =========
13.0.1.6.1
----------
On invoice refunding with new invoice, ensure that the new invoice is opened in
a form view corresponding to its invoice type.
13.0.1.6.0 13.0.1.6.0
---------- ----------
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"name": "Accounting Periods", "name": "Accounting Periods",
"license": "AGPL-3", "license": "AGPL-3",
"summary": "Add period accounting concept", "summary": "Add period accounting concept",
"version": "13.0.1.6.0", "version": "13.0.1.6.1",
"category": "Accounting/Accounting", "category": "Accounting/Accounting",
"author": "XCG Consulting", "author": "XCG Consulting",
"website": "https://odoo.consulting/", "website": "https://odoo.consulting/",
......
from . import account_period_close # noqa: F401 from . import account_move_reversal, account_period_close # noqa: F401
##############################################################################
#
# Accounting periods, for Odoo
# Copyright (C) 2024 XCG Consulting <http://odoo.consulting>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models
class AccountMoveReversal(models.TransientModel):
"""Override to:
- On invoice refunding with new invoice, ensure that the new invoice is
opened in a form view corresponding to its invoice type.
"""
_inherit = "account.move.reversal"
def reverse_moves(self):
"""Override to:
- On invoice refunding with new invoice, ensure that the new invoice is
opened in a form view corresponding to its invoice type.
"""
action = super().reverse_moves()
# On invoice refunding with new invoice, ensure that the new invoice is
# opened in a form view corresponding to its invoice type.
if self.refund_method == "modify":
if "res_id" in action:
first_invoice_id = action["res_id"]
else:
first_invoice_id = action["domain"][0][2][0]
first_invoice = self.env["account.move"].browse(first_invoice_id)
action["context"] = dict(default_type=first_invoice.type)
return action
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment