From 37e7275c28a7181890a8bf7da45b0e8822ddcc42 Mon Sep 17 00:00:00 2001 From: hveficent Date: Wed, 24 Apr 2019 13:48:16 +0200 Subject: [PATCH 1/4] [12.0][IMP] stock_orderpoint_move_link: View transfers on orderpoint --- stock_orderpoint_move_link/README.rst | 1 + stock_orderpoint_move_link/__init__.py | 2 +- stock_orderpoint_move_link/__manifest__.py | 2 +- stock_orderpoint_move_link/models/__init__.py | 3 ++- stock_orderpoint_move_link/models/stock.py | 2 +- .../models/stock_move.py | 2 +- .../models/stock_warehouse_orderpoint.py | 19 +++++++++++++++++++ .../readme/CONTRIBUTORS.rst | 1 + .../tests/test_stock_orderpoint_move_link.py | 18 ++++++++++++++---- .../views/stock_move_views.xml | 16 ++++++++++++++++ 10 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 stock_orderpoint_move_link/models/stock_warehouse_orderpoint.py diff --git a/stock_orderpoint_move_link/README.rst b/stock_orderpoint_move_link/README.rst index 7629d0122..a8df3129f 100644 --- a/stock_orderpoint_move_link/README.rst +++ b/stock_orderpoint_move_link/README.rst @@ -56,6 +56,7 @@ Contributors * Jordi Ballester Alomar * Kitti Upariphutthiphong +* Héctor Villarreal Ortega Maintainers ~~~~~~~~~~~ diff --git a/stock_orderpoint_move_link/__init__.py b/stock_orderpoint_move_link/__init__.py index dc045bf6a..2fb88af91 100644 --- a/stock_orderpoint_move_link/__init__.py +++ b/stock_orderpoint_move_link/__init__.py @@ -1,3 +1,3 @@ -# Copyright 2017 Eficent Business and IT Consulting Services, S.L. +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from . import models diff --git a/stock_orderpoint_move_link/__manifest__.py b/stock_orderpoint_move_link/__manifest__.py index f537b9752..85a39fc02 100644 --- a/stock_orderpoint_move_link/__manifest__.py +++ b/stock_orderpoint_move_link/__manifest__.py @@ -1,4 +1,4 @@ -# Copyright 2017 Eficent Business and IT Consulting Services, S.L. +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). { diff --git a/stock_orderpoint_move_link/models/__init__.py b/stock_orderpoint_move_link/models/__init__.py index 197db3d45..7f2c64d3c 100644 --- a/stock_orderpoint_move_link/models/__init__.py +++ b/stock_orderpoint_move_link/models/__init__.py @@ -1,4 +1,5 @@ -# Copyright 2017 Eficent Business and IT Consulting Services, S.L. +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from . import stock from . import stock_move +from . import stock_warehouse_orderpoint diff --git a/stock_orderpoint_move_link/models/stock.py b/stock_orderpoint_move_link/models/stock.py index b1706a75f..937fdf2c8 100644 --- a/stock_orderpoint_move_link/models/stock.py +++ b/stock_orderpoint_move_link/models/stock.py @@ -1,4 +1,4 @@ -# Copyright 2017 Eficent Business, IT Consulting Services, S.L., Ecosoft +# Copyright 2019 Eficent Business, IT Consulting Services, S.L., Ecosoft # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import models diff --git a/stock_orderpoint_move_link/models/stock_move.py b/stock_orderpoint_move_link/models/stock_move.py index 7c5f8f309..29c989783 100644 --- a/stock_orderpoint_move_link/models/stock_move.py +++ b/stock_orderpoint_move_link/models/stock_move.py @@ -1,4 +1,4 @@ -# Copyright 2017 Eficent Business, IT Consulting Services, S.L. +# Copyright 2019 Eficent Business, IT Consulting Services, S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import fields, models diff --git a/stock_orderpoint_move_link/models/stock_warehouse_orderpoint.py b/stock_orderpoint_move_link/models/stock_warehouse_orderpoint.py new file mode 100644 index 000000000..4d0d4c4fe --- /dev/null +++ b/stock_orderpoint_move_link/models/stock_warehouse_orderpoint.py @@ -0,0 +1,19 @@ +# Copyright 2019 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class StockWarehouseOrderpoint(models.Model): + _inherit = 'stock.warehouse.orderpoint' + + @api.multi + def action_view_stock_picking(self): + action = self.env.ref('stock.action_picking_tree_all') + result = action.read()[0] + result['context'] = {} + picking_ids = self.env['stock.move'].search( + [('orderpoint_ids', 'in', self.id)]).mapped('picking_id') + result['domain'] = "[('id','in',%s)]" % picking_ids.ids + return result diff --git a/stock_orderpoint_move_link/readme/CONTRIBUTORS.rst b/stock_orderpoint_move_link/readme/CONTRIBUTORS.rst index 7ac2aa759..7906762c1 100644 --- a/stock_orderpoint_move_link/readme/CONTRIBUTORS.rst +++ b/stock_orderpoint_move_link/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Jordi Ballester Alomar * Kitti Upariphutthiphong +* Héctor Villarreal Ortega diff --git a/stock_orderpoint_move_link/tests/test_stock_orderpoint_move_link.py b/stock_orderpoint_move_link/tests/test_stock_orderpoint_move_link.py index d479712da..e50166db0 100644 --- a/stock_orderpoint_move_link/tests/test_stock_orderpoint_move_link.py +++ b/stock_orderpoint_move_link/tests/test_stock_orderpoint_move_link.py @@ -1,6 +1,6 @@ # Copyright 2019 Eficent Business and IT Consulting Services S.L. # License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - +import ast from odoo.tests.common import SavepointCase @@ -16,6 +16,7 @@ class TestStockOrderpointMoveLink(SavepointCase): cls.route_obj = cls.env['stock.location.route'] cls.group_obj = cls.env['procurement.group'] cls.move_obj = cls.env['stock.move'] + cls.picking_obj = cls.env['stock.picking'] cls.warehouse = cls.env.ref('stock.warehouse0') cls.stock_loc = cls.env.ref('stock.stock_location_stock') @@ -26,7 +27,7 @@ class TestStockOrderpointMoveLink(SavepointCase): 'usage': 'internal', 'location_id': cls.warehouse.view_location_id.id, }) - test_route = cls.route_obj.create({ + cls.test_route = cls.route_obj.create({ 'name': 'Stock -> Test 1', 'product_selectable': True, 'rule_ids': [(0, 0, { @@ -45,7 +46,7 @@ class TestStockOrderpointMoveLink(SavepointCase): 'usage': 'internal', 'location_id': cls.warehouse.view_location_id.id, }) - test_route_2 = cls.route_obj.create({ + cls.test_route_2 = cls.route_obj.create({ 'name': 'Test 1 -> Test 2', 'product_selectable': True, 'rule_ids': [(0, 0, { @@ -61,7 +62,7 @@ class TestStockOrderpointMoveLink(SavepointCase): }) # Prepare Products: - routes = test_route_2 + test_route + routes = cls.test_route_2 + cls.test_route cls.product = cls.product_obj.create({ 'name': 'Test Product', 'route_ids': [(6, 0, routes.ids)], @@ -83,3 +84,12 @@ class TestStockOrderpointMoveLink(SavepointCase): move = self.move_obj.search([ ('orderpoint_ids', '=', self.orderpoint_need_loc.id)]) self.assertTrue(len(move), 2) + + def test_02_stock_orderpoint_move_link_action_view(self): + sp_orderpoint = self.move_obj.search( + [('orderpoint_ids', 'in', self.orderpoint_need_loc.id)]).mapped( + 'picking_id') + result = self.orderpoint_need_loc.action_view_stock_picking() + sp_action = self.picking_obj.search( + ast.literal_eval(result['domain'])) + self.assertEquals(sp_orderpoint, sp_action) diff --git a/stock_orderpoint_move_link/views/stock_move_views.xml b/stock_orderpoint_move_link/views/stock_move_views.xml index 7975bdedc..82eae7fb5 100644 --- a/stock_orderpoint_move_link/views/stock_move_views.xml +++ b/stock_orderpoint_move_link/views/stock_move_views.xml @@ -25,4 +25,20 @@ + + stock.warehouse.orderpoint.move.form + stock.warehouse.orderpoint + + +
+ +
+
+
+ From dd217f995d4f72b5da23787056a3a5c0404d8974 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 26 Aug 2019 11:03:38 +0000 Subject: [PATCH 2/4] [UPD] Update stock_orderpoint_move_link.pot --- .../i18n/stock_orderpoint_move_link.pot | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stock_orderpoint_move_link/i18n/stock_orderpoint_move_link.pot b/stock_orderpoint_move_link/i18n/stock_orderpoint_move_link.pot index 7a0a5cf83..4b29e1043 100644 --- a/stock_orderpoint_move_link/i18n/stock_orderpoint_move_link.pot +++ b/stock_orderpoint_move_link/i18n/stock_orderpoint_move_link.pot @@ -18,6 +18,11 @@ msgstr "" msgid "Linked Reordering Rules" msgstr "" +#. module: stock_orderpoint_move_link +#: model:ir.model,name:stock_orderpoint_move_link.model_stock_warehouse_orderpoint +msgid "Minimum Inventory Rule" +msgstr "" + #. module: stock_orderpoint_move_link #: model:ir.model,name:stock_orderpoint_move_link.model_stock_move msgid "Stock Move" @@ -28,3 +33,8 @@ msgstr "" msgid "Stock Rule" msgstr "" +#. module: stock_orderpoint_move_link +#: model_terms:ir.ui.view,arch_db:stock_orderpoint_move_link.view_warehouse_orderpoint_move_form +msgid "Transfers" +msgstr "" + From f91714e40b1e2b7d9b1d4d3275b6baf108788fa6 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 26 Aug 2019 13:07:41 +0000 Subject: [PATCH 3/4] [UPD] README.rst --- stock_orderpoint_move_link/static/description/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/stock_orderpoint_move_link/static/description/index.html b/stock_orderpoint_move_link/static/description/index.html index ccf5cc3bd..145969309 100644 --- a/stock_orderpoint_move_link/static/description/index.html +++ b/stock_orderpoint_move_link/static/description/index.html @@ -403,6 +403,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
From 22f8a46a1702467de8acd7f93bb4c055574f6380 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 26 Aug 2019 13:07:42 +0000 Subject: [PATCH 4/4] stock_orderpoint_move_link 12.0.1.1.0 --- stock_orderpoint_move_link/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stock_orderpoint_move_link/__manifest__.py b/stock_orderpoint_move_link/__manifest__.py index 85a39fc02..faa44c025 100644 --- a/stock_orderpoint_move_link/__manifest__.py +++ b/stock_orderpoint_move_link/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Orderpoint Move Link", "summary": "Link Reordering rules to stock moves", - "version": "12.0.1.0.0", + "version": "12.0.1.1.0", "license": "LGPL-3", "website": "https://github.com/stock-logistics-warehouse", "author": "Eficent, Odoo Community Association (OCA)",