From d31d0e19e48684ecb9101ed63714061cbf6a9527 Mon Sep 17 00:00:00 2001 From: Oihane Crucelaegui Date: Wed, 11 Sep 2024 14:28:49 +0200 Subject: [PATCH] [FIX] sale_order_line_inventory: button causes permission fail --- sale_order_line_inventory/README.rst | 6 +++--- sale_order_line_inventory/__manifest__.py | 4 ++-- .../models/sale_order_line.py | 10 +--------- sale_order_line_inventory/tests/__init__.py | 1 - .../tests/test_sale_order_line_inventory.py | 18 ------------------ .../views/sale_order_view.xml | 1 + .../odoo/addons/sale_order_line_inventory | 1 + setup/sale_order_line_inventory/setup.py | 6 ++++++ 8 files changed, 14 insertions(+), 33 deletions(-) delete mode 100644 sale_order_line_inventory/tests/__init__.py delete mode 100644 sale_order_line_inventory/tests/test_sale_order_line_inventory.py create mode 120000 setup/sale_order_line_inventory/odoo/addons/sale_order_line_inventory create mode 100644 setup/sale_order_line_inventory/setup.py diff --git a/sale_order_line_inventory/README.rst b/sale_order_line_inventory/README.rst index ac743589..9a5ace4b 100644 --- a/sale_order_line_inventory/README.rst +++ b/sale_order_line_inventory/README.rst @@ -3,7 +3,7 @@ :alt: License: AGPL-3 ========================= -Sale order line inventory +Sale Order Line Inventory ========================= * New button on sales order lines to go to your stock. @@ -12,7 +12,7 @@ Bug Tracker =========== Bugs are tracked on `GitHub Issues -`_. In case of trouble, please +`_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback. @@ -24,4 +24,4 @@ Contributors * Ana Juaristi * Alfredo de la Fuente -Do not contact contributors directly about support or help with technicasc.es> +Do not contact contributors directly about support or help with technical issues. diff --git a/sale_order_line_inventory/__manifest__.py b/sale_order_line_inventory/__manifest__.py index f8406613..572900a6 100644 --- a/sale_order_line_inventory/__manifest__.py +++ b/sale_order_line_inventory/__manifest__.py @@ -4,10 +4,10 @@ { "name": "Sale Order Line Inventory", "version": "16.0.1.0.0", - "category": "Banking addons", + "category": "Sales", "license": "AGPL-3", "author": "AvanzOSC", - "website": "https://github.com/avanzosc/odoo-addons", + "website": "https://github.com/avanzosc/sale-addons", "depends": ["sale_stock"], "data": [ "views/sale_order_view.xml", diff --git a/sale_order_line_inventory/models/sale_order_line.py b/sale_order_line_inventory/models/sale_order_line.py index 25abeb5f..9e6daf6e 100644 --- a/sale_order_line_inventory/models/sale_order_line.py +++ b/sale_order_line_inventory/models/sale_order_line.py @@ -9,12 +9,4 @@ class SaleOrderLine(models.Model): def show_product_inventory(self): self.ensure_one() - action = self.env.ref("stock.action_view_quants").read()[0] - action.update( - { - "context": { - "search_default_product_id": self.product_id.product_tmpl_id.id - } - } - ) - return action + return self.product_id.action_open_quants() diff --git a/sale_order_line_inventory/tests/__init__.py b/sale_order_line_inventory/tests/__init__.py deleted file mode 100644 index ddf271b5..00000000 --- a/sale_order_line_inventory/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import test_sale_order_line_inventory diff --git a/sale_order_line_inventory/tests/test_sale_order_line_inventory.py b/sale_order_line_inventory/tests/test_sale_order_line_inventory.py deleted file mode 100644 index c237230f..00000000 --- a/sale_order_line_inventory/tests/test_sale_order_line_inventory.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2020 Alfredo de la Fuente - AvanzOSC -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import odoo.tests.common as common - - -@common.at_install(False) -@common.post_install(True) -class TestSaleOrderLineInventory(common.SavepointCase): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.sale_line = cls.env["sale.order.line"].search([], limit=1) - - def test_sale_order_line_inventory(self): - result = self.sale_line.show_product_inventory() - context = result.get("context") - lit = "'search_default_product_id': {}".format(self.sale_line.product_id.id) - self.assertIn(lit, context) diff --git a/sale_order_line_inventory/views/sale_order_view.xml b/sale_order_line_inventory/views/sale_order_view.xml index 45080289..b03d5cb1 100644 --- a/sale_order_line_inventory/views/sale_order_view.xml +++ b/sale_order_line_inventory/views/sale_order_view.xml @@ -12,6 +12,7 @@ name="show_product_inventory" type="object" string="Inventory" + icon="fa-cubes" /> diff --git a/setup/sale_order_line_inventory/odoo/addons/sale_order_line_inventory b/setup/sale_order_line_inventory/odoo/addons/sale_order_line_inventory new file mode 120000 index 00000000..1381d930 --- /dev/null +++ b/setup/sale_order_line_inventory/odoo/addons/sale_order_line_inventory @@ -0,0 +1 @@ +../../../../sale_order_line_inventory \ No newline at end of file diff --git a/setup/sale_order_line_inventory/setup.py b/setup/sale_order_line_inventory/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/sale_order_line_inventory/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)