diff --git a/account_invoice_refund_line_selection/__init__.py b/account_invoice_refund_line_selection/__init__.py index 52f2c7637743..5cb1c49143f5 100644 --- a/account_invoice_refund_line_selection/__init__.py +++ b/account_invoice_refund_line_selection/__init__.py @@ -1,2 +1 @@ from . import wizards -from . import tests diff --git a/account_invoice_refund_line_selection/__manifest__.py b/account_invoice_refund_line_selection/__manifest__.py index f6d703c75f50..a5679bba19de 100644 --- a/account_invoice_refund_line_selection/__manifest__.py +++ b/account_invoice_refund_line_selection/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Account invoice refund line", - "version": "14.0.1.0.2", + "version": "15.0.1.0.0", "category": "Accounting & Finance", "summary": "This module allows the user to refund specific lines in a invoice", "author": "Creu Blanca, Odoo Community Association (OCA)", diff --git a/account_invoice_refund_line_selection/tests/test_refund_line.py b/account_invoice_refund_line_selection/tests/test_refund_line.py index 8525b6368d24..a6cfa3e2871b 100644 --- a/account_invoice_refund_line_selection/tests/test_refund_line.py +++ b/account_invoice_refund_line_selection/tests/test_refund_line.py @@ -27,7 +27,11 @@ def test_partial_refund_in_invoice(self): active_model=self.in_invoice._name, active_ids=self.in_invoice.ids, ) - .create({}) + .create( + { + "journal_id": self.in_invoice.journal_id.id, + } + ) ) self.assertEqual( reversal.selectable_invoice_lines_ids, @@ -56,7 +60,11 @@ def test_total_refund_in_invoice(self): active_model=self.in_invoice._name, active_ids=self.in_invoice.ids, ) - .create({}) + .create( + { + "journal_id": self.in_invoice.journal_id.id, + } + ) ) action = reversal.reverse_moves() refund = self.env[action["res_model"]].browse(action["res_id"]) @@ -73,7 +81,11 @@ def test_partial_refund_out_invoice(self): active_model=self.out_invoice._name, active_ids=self.out_invoice.ids, ) - .create({}) + .create( + { + "journal_id": self.out_invoice.journal_id.id, + } + ) ) self.assertEqual( reversal.selectable_invoice_lines_ids, @@ -102,7 +114,11 @@ def test_total_refund_out_invoice(self): active_model=self.out_invoice._name, active_ids=self.out_invoice.ids, ) - .create({}) + .create( + { + "journal_id": self.out_invoice.journal_id.id, + } + ) ) action = reversal.reverse_moves() refund = self.env[action["res_model"]].browse(action["res_id"]) diff --git a/account_invoice_refund_line_selection/wizards/account_move_reversal.py b/account_invoice_refund_line_selection/wizards/account_move_reversal.py index 9e0901233a0f..f9c30529da8a 100644 --- a/account_invoice_refund_line_selection/wizards/account_move_reversal.py +++ b/account_invoice_refund_line_selection/wizards/account_move_reversal.py @@ -41,7 +41,13 @@ def _prepare_default_reversal(self, move): if self.refund_method == "refund_lines": vals = res.copy() vals["line_ids"] = [ - (0, 0, li.copy_data({"move_id": False, "recompute_tax_line": True})[0]) + ( + 0, + 0, + li.with_context(include_business_fields=True).copy_data( + {"move_id": False, "recompute_tax_line": True} + )[0], + ) for li in self.line_ids ] move = self.env["account.move"].new(vals) diff --git a/account_invoice_refund_line_selection/wizards/account_move_reversal_view.xml b/account_invoice_refund_line_selection/wizards/account_move_reversal_view.xml index 41470c85060a..c01c933bce11 100644 --- a/account_invoice_refund_line_selection/wizards/account_move_reversal_view.xml +++ b/account_invoice_refund_line_selection/wizards/account_move_reversal_view.xml @@ -15,7 +15,7 @@ name="line_ids" context="{'tree_view_ref': 'account.view_move_line_tree_grouped_sales_purchases'}" > - +