From 5a012ba36dfd78e493a4f4991b910fb494bdaa66 Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Thu, 21 Nov 2019 14:40:18 +0100 Subject: [PATCH 1/3] [12.0][ADD] stock_location_empty --- stock_location_empty/__init__.py | 1 + stock_location_empty/__manifest__.py | 18 ++++ stock_location_empty/i18n/fr.po | 90 +++++++++++++++++++ .../i18n/stock_location_empty.pot | 90 +++++++++++++++++++ stock_location_empty/models/__init__.py | 1 + stock_location_empty/models/stock_location.py | 45 ++++++++++ stock_location_empty/readme/CONTRIBUTORS.rst | 2 + stock_location_empty/readme/DESCRIPTION.rst | 2 + stock_location_empty/views/stock.xml | 62 +++++++++++++ 9 files changed, 311 insertions(+) create mode 100644 stock_location_empty/__init__.py create mode 100644 stock_location_empty/__manifest__.py create mode 100644 stock_location_empty/i18n/fr.po create mode 100644 stock_location_empty/i18n/stock_location_empty.pot create mode 100644 stock_location_empty/models/__init__.py create mode 100644 stock_location_empty/models/stock_location.py create mode 100644 stock_location_empty/readme/CONTRIBUTORS.rst create mode 100644 stock_location_empty/readme/DESCRIPTION.rst create mode 100644 stock_location_empty/views/stock.xml diff --git a/stock_location_empty/__init__.py b/stock_location_empty/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_location_empty/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_location_empty/__manifest__.py b/stock_location_empty/__manifest__.py new file mode 100644 index 000000000..a09d9ab7e --- /dev/null +++ b/stock_location_empty/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +{'name': 'Stock Location Empty', + 'version': '12.0.1.0.0', + 'author': 'Camptocamp, Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'category': 'stock', + 'depends': [ + 'stock', + ], + "website": "https://github.com/OCA/stock-logistics-warehouse", + 'data': [ + 'views/stock.xml', + ], + 'installable': True, + 'application': False, + } diff --git a/stock_location_empty/i18n/fr.po b/stock_location_empty/i18n/fr.po new file mode 100644 index 000000000..75d7db891 --- /dev/null +++ b/stock_location_empty/i18n/fr.po @@ -0,0 +1,90 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_empty +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-11-22 07:37+0000\n" +"PO-Revision-Date: 2019-11-22 09:06+0100\n" +"Last-Translator: Thierry Ducrest \n" +"Language-Team: English\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: en_US\n" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Customer" +msgstr "Client" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Customer Locations" +msgstr "Emplacements clients" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_inherit +msgid "Empty" +msgstr "Vide" + +#. module: stock_location_empty +#: model:ir.ui.menu,name:stock_location_empty.stock_location_empty_menu +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_inherit +msgid "Empty stock" +msgstr "Emplacements vides" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Internal" +msgstr "Interne" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Internal Locations" +msgstr "Emplacements internes" + +#. module: stock_location_empty +#: model:ir.model,name:stock_location_empty.model_stock_location +msgid "Inventory Locations" +msgstr "Emplacements de stock" + +#. module: stock_location_empty +#: model:ir.actions.act_window,name:stock_location_empty.action_stock_location_empty +msgid "Locations" +msgstr "Emplacements" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Parent Location" +msgstr "Emplacement parent" + +#. module: stock_location_empty +#: model:ir.model.fields,field_description:stock_location_empty.field_stock_location__stock_amount +msgid "Stock Amount" +msgstr "Quantité en stock" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_tree3 +msgid "Stock Location" +msgstr "Emplacement de stock" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Stock Locations" +msgstr "Emplacements de stock" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Vendor" +msgstr "Fournisseur" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Vendor Locations" +msgstr "Adresses du vendeur" diff --git a/stock_location_empty/i18n/stock_location_empty.pot b/stock_location_empty/i18n/stock_location_empty.pot new file mode 100644 index 000000000..fd571055f --- /dev/null +++ b/stock_location_empty/i18n/stock_location_empty.pot @@ -0,0 +1,90 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_location_empty +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-11-22 07:37+0000\n" +"PO-Revision-Date: 2019-11-22 07:37+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Customer" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Customer Locations" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_inherit +msgid "Empty" +msgstr "" + +#. module: stock_location_empty +#: model:ir.ui.menu,name:stock_location_empty.stock_location_empty_menu +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_inherit +msgid "Empty stock" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Internal" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Internal Locations" +msgstr "" + +#. module: stock_location_empty +#: model:ir.model,name:stock_location_empty.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_location_empty +#: model:ir.actions.act_window,name:stock_location_empty.action_stock_location_empty +msgid "Locations" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Parent Location" +msgstr "" + +#. module: stock_location_empty +#: model:ir.model.fields,field_description:stock_location_empty.field_stock_location__stock_amount +msgid "Stock Amount" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_tree3 +msgid "Stock Location" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Stock Locations" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Vendor" +msgstr "" + +#. module: stock_location_empty +#: model_terms:ir.ui.view,arch_db:stock_location_empty.view_location_search_empty_2 +msgid "Vendor Locations" +msgstr "" + diff --git a/stock_location_empty/models/__init__.py b/stock_location_empty/models/__init__.py new file mode 100644 index 000000000..88493e35d --- /dev/null +++ b/stock_location_empty/models/__init__.py @@ -0,0 +1 @@ +from . import stock_location diff --git a/stock_location_empty/models/stock_location.py b/stock_location_empty/models/stock_location.py new file mode 100644 index 000000000..8088ef53e --- /dev/null +++ b/stock_location_empty/models/stock_location.py @@ -0,0 +1,45 @@ +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from odoo import api, fields, models + + +class StockLocation(models.Model): + _inherit = 'stock.location' + + stock_amount = fields.Integer( + compute='_compute_location_amount', search='_search_location_amount' + ) + + @api.multi + def _search_location_amount(self, operator, value): + if operator not in ('=', '!=', '<', '<=', '>', '>='): + return [] + # pylint: disable=sql-injection + self.env.cr.execute( + """ + SELECT loc.id FROM stock_location loc + LEFT OUTER JOIN stock_quant quant ON loc.id = quant.location_id + GROUP BY loc.id + HAVING coalesce(sum(quantity), 0) %s %%s;""" + % operator, + (value,), + ) + ids = [row[0] for row in self.env.cr.fetchall()] + return [('id', 'in', ids)] + + @api.multi + def _compute_location_amount(self): + self.env.cr.execute( + """ + SELECT location_id, sum(quantity) + FROM stock_quant + WHERE location_id IN %s + GROUP BY location_id; + """, + (tuple(self.ids),), + ) + totals = dict(self.env.cr.fetchall()) + for location in self: + location.stock_amount = totals.get(location.id, 0) diff --git a/stock_location_empty/readme/CONTRIBUTORS.rst b/stock_location_empty/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..37ed81474 --- /dev/null +++ b/stock_location_empty/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Patrick Tombez +* Thierry Ducrest diff --git a/stock_location_empty/readme/DESCRIPTION.rst b/stock_location_empty/readme/DESCRIPTION.rst new file mode 100644 index 000000000..797079417 --- /dev/null +++ b/stock_location_empty/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Adds a filter for empty stock location. +Adds a new list of stock location with a stock quantity. diff --git a/stock_location_empty/views/stock.xml b/stock_location_empty/views/stock.xml new file mode 100644 index 000000000..f76c53815 --- /dev/null +++ b/stock_location_empty/views/stock.xml @@ -0,0 +1,62 @@ + + + + + stock.location.tree + stock.location + + + + + + + + + + + + + stock.location.search.inherit + stock.location + + + + + + + + + + + stock.location.search2 + stock.location + + + + + + + + + + + + + + + Locations + stock.location + ir.actions.act_window + form + + + {'search_default_in_location':1, 'search_default_stock_amount': 1} + + + + + From 7a5c1897988d35c54223d2b724c811438ee3fc8c Mon Sep 17 00:00:00 2001 From: sonhd Date: Sun, 19 Dec 2021 13:38:53 +0700 Subject: [PATCH 2/3] [IMP] stock_location_empty: black, isort, prettier --- .../odoo/addons/stock_location_empty | 1 + setup/stock_location_empty/setup.py | 6 ++ stock_location_empty/__manifest__.py | 31 ++++---- stock_location_empty/models/stock_location.py | 8 +- stock_location_empty/views/stock.xml | 76 +++++++++++++------ 5 files changed, 81 insertions(+), 41 deletions(-) create mode 120000 setup/stock_location_empty/odoo/addons/stock_location_empty create mode 100644 setup/stock_location_empty/setup.py diff --git a/setup/stock_location_empty/odoo/addons/stock_location_empty b/setup/stock_location_empty/odoo/addons/stock_location_empty new file mode 120000 index 000000000..b874f5b01 --- /dev/null +++ b/setup/stock_location_empty/odoo/addons/stock_location_empty @@ -0,0 +1 @@ +../../../../stock_location_empty \ No newline at end of file diff --git a/setup/stock_location_empty/setup.py b/setup/stock_location_empty/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_location_empty/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_location_empty/__manifest__.py b/stock_location_empty/__manifest__.py index a09d9ab7e..a86533fcd 100644 --- a/stock_location_empty/__manifest__.py +++ b/stock_location_empty/__manifest__.py @@ -1,18 +1,19 @@ # Copyright 2019 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -{'name': 'Stock Location Empty', - 'version': '12.0.1.0.0', - 'author': 'Camptocamp, Odoo Community Association (OCA)', - 'license': 'AGPL-3', - 'category': 'stock', - 'depends': [ - 'stock', - ], - "website": "https://github.com/OCA/stock-logistics-warehouse", - 'data': [ - 'views/stock.xml', - ], - 'installable': True, - 'application': False, - } +{ + "name": "Stock Location Empty", + "version": "12.0.1.0.0", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "stock", + "depends": [ + "stock", + ], + "website": "https://github.com/OCA/stock-logistics-warehouse", + "data": [ + "views/stock.xml", + ], + "installable": True, + "application": False, +} diff --git a/stock_location_empty/models/stock_location.py b/stock_location_empty/models/stock_location.py index 8088ef53e..c02b3ae7a 100644 --- a/stock_location_empty/models/stock_location.py +++ b/stock_location_empty/models/stock_location.py @@ -6,15 +6,15 @@ from odoo import api, fields, models class StockLocation(models.Model): - _inherit = 'stock.location' + _inherit = "stock.location" stock_amount = fields.Integer( - compute='_compute_location_amount', search='_search_location_amount' + compute="_compute_location_amount", search="_search_location_amount" ) @api.multi def _search_location_amount(self, operator, value): - if operator not in ('=', '!=', '<', '<=', '>', '>='): + if operator not in ("=", "!=", "<", "<=", ">", ">="): return [] # pylint: disable=sql-injection self.env.cr.execute( @@ -27,7 +27,7 @@ class StockLocation(models.Model): (value,), ) ids = [row[0] for row in self.env.cr.fetchall()] - return [('id', 'in', ids)] + return [("id", "in", ids)] @api.multi def _compute_location_amount(self): diff --git a/stock_location_empty/views/stock.xml b/stock_location_empty/views/stock.xml index f76c53815..9c137ebff 100644 --- a/stock_location_empty/views/stock.xml +++ b/stock_location_empty/views/stock.xml @@ -1,16 +1,20 @@ - + stock.location.tree stock.location - + - - - - - + + + + + @@ -21,8 +25,13 @@ - - + + @@ -32,13 +41,33 @@ stock.location - - - - - + + + + + - + @@ -48,15 +77,18 @@ stock.location ir.actions.act_window form - - - {'search_default_in_location':1, 'search_default_stock_amount': 1} + + + {'search_default_in_location':1, 'search_default_stock_amount': 1} + id="stock_location_empty_menu" + name="Empty stock" + parent="stock.menu_stock_inventory_control" + action="action_stock_location_empty" + /> From a8ceac5ce79fafd2d4b6ff14b563dfd4f39d1a3c Mon Sep 17 00:00:00 2001 From: sonhd Date: Tue, 21 Dec 2021 10:25:36 +0700 Subject: [PATCH 3/3] [14.0] [MIG] stock_location_empty: Migrate to version 14.0 --- stock_location_empty/README.rst | 83 ++++ stock_location_empty/__manifest__.py | 7 +- stock_location_empty/i18n/fr.po | 2 +- stock_location_empty/models/stock_location.py | 30 +- stock_location_empty/readme/CONTRIBUTORS.rst | 3 + stock_location_empty/readme/CREDITS.rst | 1 + .../static/description/index.html | 435 ++++++++++++++++++ stock_location_empty/tests/__init__.py | 1 + .../tests/test_stock_location_empty.py | 39 ++ stock_location_empty/views/stock.xml | 13 +- 10 files changed, 588 insertions(+), 26 deletions(-) create mode 100644 stock_location_empty/README.rst create mode 100644 stock_location_empty/readme/CREDITS.rst create mode 100644 stock_location_empty/static/description/index.html create mode 100644 stock_location_empty/tests/__init__.py create mode 100644 stock_location_empty/tests/test_stock_location_empty.py diff --git a/stock_location_empty/README.rst b/stock_location_empty/README.rst new file mode 100644 index 000000000..1d1d32216 --- /dev/null +++ b/stock_location_empty/README.rst @@ -0,0 +1,83 @@ +==================== +Stock Location Empty +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_location_empty + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_location_empty + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/153/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds a filter for empty stock location. +Adds a new list of stock location with a stock quantity. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Patrick Tombez +* Thierry Ducrest +* `Trobz `_: + + * Son Ho + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_location_empty/__manifest__.py b/stock_location_empty/__manifest__.py index a86533fcd..527ffff93 100644 --- a/stock_location_empty/__manifest__.py +++ b/stock_location_empty/__manifest__.py @@ -3,14 +3,15 @@ { "name": "Stock Location Empty", - "version": "12.0.1.0.0", + "summary": "Adds a filter for empty stock location", + "version": "14.0.1.0.0", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", - "category": "stock", + "category": "Warehouse", + "website": "https://github.com/OCA/stock-logistics-warehouse", "depends": [ "stock", ], - "website": "https://github.com/OCA/stock-logistics-warehouse", "data": [ "views/stock.xml", ], diff --git a/stock_location_empty/i18n/fr.po b/stock_location_empty/i18n/fr.po index 75d7db891..430827698 100644 --- a/stock_location_empty/i18n/fr.po +++ b/stock_location_empty/i18n/fr.po @@ -65,7 +65,7 @@ msgid "Parent Location" msgstr "Emplacement parent" #. module: stock_location_empty -#: model:ir.model.fields,field_description:stock_location_empty.field_stock_location__stock_amount +#: model:ir.model.fields,field_description:stock_location_empty.field_stock_location__stock_quantity msgid "Stock Amount" msgstr "Quantité en stock" diff --git a/stock_location_empty/models/stock_location.py b/stock_location_empty/models/stock_location.py index c02b3ae7a..6ff7e0b18 100644 --- a/stock_location_empty/models/stock_location.py +++ b/stock_location_empty/models/stock_location.py @@ -1,45 +1,45 @@ # Copyright 2018 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from psycopg2 import sql - -from odoo import api, fields, models +from odoo import fields, models class StockLocation(models.Model): _inherit = "stock.location" - stock_amount = fields.Integer( + stock_amount = fields.Float( compute="_compute_location_amount", search="_search_location_amount" ) - @api.multi def _search_location_amount(self, operator, value): if operator not in ("=", "!=", "<", "<=", ">", ">="): return [] - # pylint: disable=sql-injection - self.env.cr.execute( + query = sql.SQL( """ SELECT loc.id FROM stock_location loc LEFT OUTER JOIN stock_quant quant ON loc.id = quant.location_id GROUP BY loc.id - HAVING coalesce(sum(quantity), 0) %s %%s;""" - % operator, - (value,), + HAVING coalesce(sum(quantity), 0) {operator} %(value)s;""".format( + operator=operator + ) ) - ids = [row[0] for row in self.env.cr.fetchall()] + + self.env.cr.execute(query, {"value": value}) + res = self.env.cr.fetchall() + ids = [row[0] for row in res] return [("id", "in", ids)] - @api.multi def _compute_location_amount(self): - self.env.cr.execute( + query = sql.SQL( """ SELECT location_id, sum(quantity) FROM stock_quant - WHERE location_id IN %s + WHERE location_id IN %(values)s GROUP BY location_id; - """, - (tuple(self.ids),), + """ ) + self.env.cr.execute(query, {"values": tuple(self.ids)}) totals = dict(self.env.cr.fetchall()) for location in self: location.stock_amount = totals.get(location.id, 0) diff --git a/stock_location_empty/readme/CONTRIBUTORS.rst b/stock_location_empty/readme/CONTRIBUTORS.rst index 37ed81474..b7634598f 100644 --- a/stock_location_empty/readme/CONTRIBUTORS.rst +++ b/stock_location_empty/readme/CONTRIBUTORS.rst @@ -1,2 +1,5 @@ * Patrick Tombez * Thierry Ducrest +* `Trobz `_: + + * Son Ho diff --git a/stock_location_empty/readme/CREDITS.rst b/stock_location_empty/readme/CREDITS.rst new file mode 100644 index 000000000..ca6e4f9cd --- /dev/null +++ b/stock_location_empty/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp diff --git a/stock_location_empty/static/description/index.html b/stock_location_empty/static/description/index.html new file mode 100644 index 000000000..d6e93e289 --- /dev/null +++ b/stock_location_empty/static/description/index.html @@ -0,0 +1,435 @@ + + + + + + +Stock Location Empty + + + +
+

Stock Location Empty

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

Adds a filter for empty stock location. +Adds a new list of stock location with a stock quantity.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_location_empty/tests/__init__.py b/stock_location_empty/tests/__init__.py new file mode 100644 index 000000000..3f8c8c487 --- /dev/null +++ b/stock_location_empty/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_location_empty diff --git a/stock_location_empty/tests/test_stock_location_empty.py b/stock_location_empty/tests/test_stock_location_empty.py new file mode 100644 index 000000000..1bad22878 --- /dev/null +++ b/stock_location_empty/tests/test_stock_location_empty.py @@ -0,0 +1,39 @@ +from odoo.tests import SavepointCase + + +class TestStockLocationChildren(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.stock_input = cls.env["stock.location"].create( + { + "name": "Test", + "usage": "internal", + } + ) + cls.stock_quant1 = cls.env["stock.quant"].create( + { + "product_id": cls.env.ref("product.product_delivery_01").id, + "location_id": cls.stock_input.id, + "quantity": 60, + } + ) + cls.stock_quant1 = cls.env["stock.quant"].create( + { + "product_id": cls.env.ref("product.product_delivery_02").id, + "location_id": cls.stock_input.id, + "quantity": 50, + } + ) + + def test_stock_location_amount(self): + self.assertEqual(self.stock_input.stock_amount, 110.0) + location_record = self.env["stock.location"].search( + [("stock_amount", "=", 110.0)] + ) + self.assertEqual(location_record.stock_amount, 110) + record_search = self.env["stock.location"].search( + [("stock_amount", "in", [110, 111])] + ) + all_record = self.env["stock.location"].search([]) + self.assertEqual(record_search, all_record) diff --git a/stock_location_empty/views/stock.xml b/stock_location_empty/views/stock.xml index 9c137ebff..9d7449a8f 100644 --- a/stock_location_empty/views/stock.xml +++ b/stock_location_empty/views/stock.xml @@ -76,7 +76,6 @@ Locations stock.location ir.actions.act_window - form {'search_default_in_location':1, 'search_default_stock_amount': 1} - + + Empty stock + + + +