summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2020-07-29 10:22:48 +0000
committerNicolas Martinelli <nim@odoo.com>2020-07-29 15:20:02 +0000
commit5eea4c014a2a04b0e84af196bead8a2070fe7170 (patch)
treecbe2728fe2b2e02d67e7d06795221ab63e31b83d
parent7d010ee8a54e3e60324bedeba2098303b17c97ed (diff)
[FIX] account, stock_account: clean anglo-saxon lines
- Configure a Product Category Automated + FIFO - Create a product in this category - Create a PO for 10 units, receive the units, bill the PO and pay - Sell 1 unit of the product and deliver it - Create an invoice for the order - Without paying the invoice, create a credit note with the option 'Full refund and draft invoice' - Post new invoice The anglo-saxon lines are counted twice. This happens because the lines already exist in the newly created draft invoice. For the sake of simplicity of the fix, we clean-up the invoice after creation. opw-2300536 closes odoo/odoo#55158 X-original-commit: 02d857b8aa75962f535ab4cd69ff8e2a6ef3fb48 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
-rw-r--r--addons/account/wizard/account_move_reversal.py5
-rw-r--r--addons/stock_account/wizard/__init__.py1
-rw-r--r--addons/stock_account/wizard/account_move_reversal.py11
3 files changed, 17 insertions, 0 deletions
diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py
index b53d50fd513..aa9b0779950 100644
--- a/addons/account/wizard/account_move_reversal.py
+++ b/addons/account/wizard/account_move_reversal.py
@@ -71,6 +71,9 @@ class AccountMoveReversal(models.TransientModel):
'auto_post': True if reverse_date > fields.Date.context_today(self) else False,
}
+ def _reverse_moves_post_hook(self, moves):
+ return
+
def reverse_moves(self):
self.ensure_one()
moves = self.move_ids
@@ -100,6 +103,8 @@ class AccountMoveReversal(models.TransientModel):
return
self.new_move_ids = new_moves
+ if new_moves:
+ self._reverse_moves_post_hook(new_moves)
# Create action.
action = {
diff --git a/addons/stock_account/wizard/__init__.py b/addons/stock_account/wizard/__init__.py
index b920576a240..e705e076976 100644
--- a/addons/stock_account/wizard/__init__.py
+++ b/addons/stock_account/wizard/__init__.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from . import account_move_reversal
from . import stock_quantity_history
from . import stock_picking_return
from . import stock_valuation_layer_revaluation
diff --git a/addons/stock_account/wizard/account_move_reversal.py b/addons/stock_account/wizard/account_move_reversal.py
new file mode 100644
index 00000000000..a9ad68c7ff1
--- /dev/null
+++ b/addons/stock_account/wizard/account_move_reversal.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+from odoo import models
+
+
+class AccountMoveReversal(models.TransientModel):
+ _inherit = "account.move.reversal"
+
+ def _reverse_moves_post_hook(self, moves):
+ if self.refund_method == "modify":
+ moves.mapped("line_ids").filtered(lambda line: line.is_anglo_saxon_line).unlink()
+ return super()._reverse_moves_post_hook(moves)