From d0927a5491342a77038af1d3ee46be4447dda7db Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Fri, 28 Feb 2025 15:44:32 +0100 Subject: [PATCH] [MIG] stock_picking_return_refund_option: Migration to 18.0 --- stock_picking_return_refund_option/README.rst | 1 + .../__manifest__.py | 4 +- .../readme/CONTRIBUTORS.md | 1 + .../static/description/index.html | 1 + ...est_stock_picking_return_refund_options.py | 48 +++++++++++-------- .../views/stock_picking_view.xml | 9 ++-- 6 files changed, 36 insertions(+), 28 deletions(-) diff --git a/stock_picking_return_refund_option/README.rst b/stock_picking_return_refund_option/README.rst index 2ed5cb4bb46..73de5cda68e 100644 --- a/stock_picking_return_refund_option/README.rst +++ b/stock_picking_return_refund_option/README.rst @@ -120,6 +120,7 @@ Contributors - Sergio Teruel - César A. Sánchez + - Carlos Roca Maintainers ----------- diff --git a/stock_picking_return_refund_option/__manifest__.py b/stock_picking_return_refund_option/__manifest__.py index 121fd0a2571..ed75bd4c039 100644 --- a/stock_picking_return_refund_option/__manifest__.py +++ b/stock_picking_return_refund_option/__manifest__.py @@ -3,11 +3,11 @@ { "name": "Stock Picking Return Refund Option", "summary": "Update the refund options in pickings", - "version": "16.0.1.0.2", + "version": "18.0.1.0.0", "development_status": "Production/Stable", "category": "Sales", "website": "https://github.com/OCA/account-invoicing", - "author": "Tecnativa, " "Odoo Community Association (OCA)", + "author": "Tecnativa, Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, diff --git a/stock_picking_return_refund_option/readme/CONTRIBUTORS.md b/stock_picking_return_refund_option/readme/CONTRIBUTORS.md index b4ba1fb457c..f87d237cda2 100644 --- a/stock_picking_return_refund_option/readme/CONTRIBUTORS.md +++ b/stock_picking_return_refund_option/readme/CONTRIBUTORS.md @@ -1,3 +1,4 @@ - [Tecnativa](https://www.tecnativa.com): - Sergio Teruel - César A. Sánchez + - Carlos Roca diff --git a/stock_picking_return_refund_option/static/description/index.html b/stock_picking_return_refund_option/static/description/index.html index b4de27b34f4..fb4dadaf0a4 100644 --- a/stock_picking_return_refund_option/static/description/index.html +++ b/stock_picking_return_refund_option/static/description/index.html @@ -465,6 +465,7 @@

Contributors

  • Tecnativa:
  • diff --git a/stock_picking_return_refund_option/tests/test_stock_picking_return_refund_options.py b/stock_picking_return_refund_option/tests/test_stock_picking_return_refund_options.py index 30058db98ef..8249dba8cee 100644 --- a/stock_picking_return_refund_option/tests/test_stock_picking_return_refund_options.py +++ b/stock_picking_return_refund_option/tests/test_stock_picking_return_refund_options.py @@ -1,6 +1,7 @@ # Copyright 2018 Tecnativa - Sergio Teruel # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo.tests.common import Form, TransactionCase, tagged +from odoo.tests import Form +from odoo.tests.common import TransactionCase, tagged @tagged("post_install", "-at_install") @@ -18,23 +19,24 @@ def setUpClass(cls): tracking_disable=True, ) ) - if not cls.env.company.chart_template_id: - # Load a CoA if there's none in current company - coa = cls.env.ref("l10n_generic_coa.configurable_chart_template", False) - if not coa: - # Load the first available CoA - coa = cls.env["account.chart.template"].search( - [("visible", "=", True)], limit=1 - ) - coa.try_loading(company=cls.env.company, install_demo=False) cls.partner = cls.env["res.partner"].create( {"name": "Test", "customer_rank": 1, "supplier_rank": 1} ) cls.product = cls.env["product.product"].create( - {"name": "test_product", "type": "product", "invoice_policy": "delivery"} + { + "name": "test_product", + "type": "consu", + "is_storable": True, + "invoice_policy": "delivery", + } ) cls.product2 = cls.env["product.product"].create( - {"name": "test_product_2", "type": "product", "invoice_policy": "delivery"} + { + "name": "test_product_2", + "type": "consu", + "is_storable": True, + "invoice_policy": "delivery", + } ) with Form(cls.env["sale.order"]) as order_form: order_form.partner_id = cls.partner @@ -50,7 +52,7 @@ def setUpClass(cls): move_line_vals_list = [] for move in cls.picking.move_ids: move_line_vals = move._prepare_move_line_vals() - move_line_vals["qty_done"] = 1 + move_line_vals["quantity"] = 1 move_line_vals_list.append(move_line_vals) cls.env["stock.move.line"].create(move_line_vals_list) cls.picking.button_validate() @@ -73,8 +75,10 @@ def return_picking_wiz(self, picking): def test_return_to_refund_values(self): return_wizard = self.return_picking_wiz(self.picking) - return_pick = self.picking.browse(return_wizard.create_returns()["res_id"]) - return_pick.move_line_ids.write({"qty_done": 1.0}) + return_pick = self.picking.browse( + return_wizard.action_create_returns()["res_id"] + ) + return_pick.move_line_ids.write({"quantity": 1.0}) return_pick.button_validate() self.assertEqual(return_pick.to_refund_lines, "no_refund") return_pick.move_ids.write({"to_refund": True}) @@ -85,8 +89,10 @@ def test_return_to_refund_values(self): def test_return_so_wo_to_refund(self): # Return some items, after SO was invoiced return_wizard = self.return_picking_wiz(self.picking) - return_pick = self.picking.browse(return_wizard.create_returns()["res_id"]) - return_pick.move_line_ids.write({"qty_done": 1.0}) + return_pick = self.picking.browse( + return_wizard.action_create_returns()["res_id"] + ) + return_pick.move_line_ids.write({"quantity": 1.0}) return_pick.button_validate() self.assertEqual(self.order.invoice_status, "invoiced") @@ -113,15 +119,17 @@ def test_return_po_wo_to_refund(self): po_order.button_confirm() picking = po_order.picking_ids[:] move_line_vals = picking.move_ids._prepare_move_line_vals() - move_line_vals["qty_done"] = 1 + move_line_vals["quantity"] = 1 self.env["stock.move.line"].create(move_line_vals) picking.button_validate() self.assertEqual(po_order.invoice_status, "to invoice") # Return the picking without refund return_wizard = self.return_picking_wiz(picking) - return_pick = self.picking.browse(return_wizard.create_returns()["res_id"]) + return_pick = self.picking.browse( + return_wizard.action_create_returns()["res_id"] + ) move_line_vals = return_pick.move_ids._prepare_move_line_vals() - move_line_vals["qty_done"] = 1 + move_line_vals["quantity"] = 1 self.env["stock.move.line"].create(move_line_vals) return_pick.button_validate() # Now set to be refunded diff --git a/stock_picking_return_refund_option/views/stock_picking_view.xml b/stock_picking_return_refund_option/views/stock_picking_view.xml index d6c5a8aa5ac..7a626d3ecd0 100644 --- a/stock_picking_return_refund_option/views/stock_picking_view.xml +++ b/stock_picking_return_refund_option/views/stock_picking_view.xml @@ -10,19 +10,16 @@ - +