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] sale_credit_note_reversal: module to create reversals from sales credit notes #1808

Open
wants to merge 1 commit into
base: 16.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
93 changes: 93 additions & 0 deletions sale_credit_note_reversal/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
=========================
Sale Credit Note Reversal
=========================

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

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

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

Allow to revert a credit note. Standard Odoo does not allow it.
When reverting the credit note from the journal entry Standard Odoo
does not link it to the Sales order, because the reversal is not an
invoice. This module just ensure the reveral is a customer invoice,
so it counts as invoice in the sales order.

This also serves when the posting credit notes by mistake. For example,
when adding a negative quantity in the sale line and creating Odoo will
actually create a credit note, then, if other lines with positive quantites
are added nothing changes, and the invoice will be still a credit note.

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

An integration with sale_line_refund_to_invoice_qty module will be very useful.
The reverted credit note does not add quantity to the qty_invoiced. The credit
note does also not update the qty_to_invoice in the normal case, so at least
this reversal is consistent.

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

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

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

* Aaron Henriquez <[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.

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_credit_note_reversal>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_credit_note_reversal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions sale_credit_note_reversal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Sale Credit Note Reversal",
"summary": """Allow to revert a credit note""",
"version": "16.0.1.0.0",
"category": "Sales",
"website": "https://github.com/OCA/account-invoicing",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["sale_management"],
"data": [
"views/account_move_views.xml",
],
}
1 change: 1 addition & 0 deletions sale_credit_note_reversal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move
17 changes: 17 additions & 0 deletions sale_credit_note_reversal/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models


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

def _reverse_moves(self, default_values_list=None, cancel=False):
reversed_moves = super()._reverse_moves(
default_values_list=default_values_list, cancel=cancel
)
for move in reversed_moves:
if move.reversed_entry_id.move_type == "out_refund":
# convert from entry to out_invoice
move.move_type = "out_invoice"
return reversed_moves
1 change: 1 addition & 0 deletions sale_credit_note_reversal/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Aaron Henriquez <[email protected]>
10 changes: 10 additions & 0 deletions sale_credit_note_reversal/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Allow to revert a credit note. Standard Odoo does not allow it.
When reverting the credit note from the journal entry Standard Odoo
does not link it to the Sales order, because the reversal is not an
invoice. This module just ensure the reveral is a customer invoice,
so it counts as invoice in the sales order.

This also serves when the posting credit notes by mistake. For example,
when adding a negative quantity in the sale line and creating Odoo will
actually create a credit note, then, if other lines with positive quantites
are added nothing changes, and the invoice will be still a credit note.
4 changes: 4 additions & 0 deletions sale_credit_note_reversal/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
An integration with sale_line_refund_to_invoice_qty module will be very useful.
The reverted credit note does not add quantity to the qty_invoiced. The credit
note does also not update the qty_to_invoice in the normal case, so at least
this reversal is consistent.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading