diff --git a/stock_report_quantity_by_location/README.rst b/stock_report_quantity_by_location/README.rst new file mode 100644 index 0000000..7d90d83 --- /dev/null +++ b/stock_report_quantity_by_location/README.rst @@ -0,0 +1,76 @@ +================================= +Stock Report Quantity By Location +================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/11.0/stock_report_quantity_by_location + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-11-0/stock-logistics-reporting-11-0-stock_report_quantity_by_location + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/151/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds an additional reporting on Inventory side where warehouse +location quantities are shown by all stockable products. + +**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 +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Eficent Business and IT Consulting Services, S.L. (https://www.eficent.com) + * Jordi Ballester Alomar + * Hector Villarreal + +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-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_report_quantity_by_location/__init__.py b/stock_report_quantity_by_location/__init__.py new file mode 100644 index 0000000..5cb1c49 --- /dev/null +++ b/stock_report_quantity_by_location/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/stock_report_quantity_by_location/__manifest__.py b/stock_report_quantity_by_location/__manifest__.py new file mode 100644 index 0000000..e064702 --- /dev/null +++ b/stock_report_quantity_by_location/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Stock Report Quantity By Location", + "summary": "Stock Report Quantity By Location", + "version": "11.0.1.0.0", + "author": "Eficent, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-reporting", + "category": "Warehouse Management", + "license": "AGPL-3", + "depends": [ + "product", + "stock", + ], + "data": [ + 'wizards/stock_report_quantity_by_location_views.xml', + ], + "installable": True, +} diff --git a/stock_report_quantity_by_location/readme/CONTRIBUTORS.rst b/stock_report_quantity_by_location/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..01f149a --- /dev/null +++ b/stock_report_quantity_by_location/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Eficent Business and IT Consulting Services, S.L. (https://www.eficent.com) + * Jordi Ballester Alomar + * Hector Villarreal \ No newline at end of file diff --git a/stock_report_quantity_by_location/readme/DESCRIPTION.rst b/stock_report_quantity_by_location/readme/DESCRIPTION.rst new file mode 100644 index 0000000..a3ccc04 --- /dev/null +++ b/stock_report_quantity_by_location/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds an additional reporting on Inventory side where warehouse +location quantities are shown by all stockable products. \ No newline at end of file diff --git a/stock_report_quantity_by_location/static/description/index.html b/stock_report_quantity_by_location/static/description/index.html new file mode 100644 index 0000000..4e14965 --- /dev/null +++ b/stock_report_quantity_by_location/static/description/index.html @@ -0,0 +1,400 @@ + + + + + + +Stock Report Quantity By Location + + + +
+

Stock Report Quantity By Location

+ + +

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

+

This module adds an additional reporting on Inventory side where warehouse +location quantities are shown by all stockable products.

+

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

+
    +
  • Eficent
  • +
+
+
+

Contributors

+ +
+
+

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-reporting project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_report_quantity_by_location/tests/__init__.py b/stock_report_quantity_by_location/tests/__init__.py new file mode 100644 index 0000000..8d06776 --- /dev/null +++ b/stock_report_quantity_by_location/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_report_quantity_by_location diff --git a/stock_report_quantity_by_location/tests/test_stock_report_quantity_by_location.py b/stock_report_quantity_by_location/tests/test_stock_report_quantity_by_location.py new file mode 100644 index 0000000..aaf17da --- /dev/null +++ b/stock_report_quantity_by_location/tests/test_stock_report_quantity_by_location.py @@ -0,0 +1,22 @@ +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestStockReportQuantityByLocation(SavepointCase): + + @classmethod + def setUpClass(cls): + super(TestStockReportQuantityByLocation, cls).setUpClass() + cls.stock_loc = cls.env.ref('stock.stock_location_stock') + + def test_wizard(self): + self.wizard = self.env[ + 'stock.report.quantity.by.location.prepare'].create( + {'location_ids': [(4, self.stock_loc.id)]}) + wiz_creator = self.wizard.open() + wizard_lines = self.env['stock.report.quantity.by.location'].search( + wiz_creator['domain']) + self.assertFalse( + any(wiz.location_id != self.stock_loc for wiz in wizard_lines)) diff --git a/stock_report_quantity_by_location/wizards/__init__.py b/stock_report_quantity_by_location/wizards/__init__.py new file mode 100644 index 0000000..6e08ce7 --- /dev/null +++ b/stock_report_quantity_by_location/wizards/__init__.py @@ -0,0 +1 @@ +from . import stock_report_quantity_by_location diff --git a/stock_report_quantity_by_location/wizards/stock_report_quantity_by_location.py b/stock_report_quantity_by_location/wizards/stock_report_quantity_by_location.py new file mode 100644 index 0000000..9663fc1 --- /dev/null +++ b/stock_report_quantity_by_location/wizards/stock_report_quantity_by_location.py @@ -0,0 +1,77 @@ +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models, _ + + +class StockReportByLocationPrepare(models.TransientModel): + _name = 'stock.report.quantity.by.location.prepare' + _description = 'Stock Report Quantity By Location Prepare' + + location_ids = fields.Many2many(comodel_name='stock.location', + string='Locations', + required=True) + + def open(self): + self.ensure_one() + self._compute_stock_report_by_location() + action = { + 'type': 'ir.actions.act_window', + 'view_mode': 'pivot,tree', + 'name': _('Stock Report by Location'), + 'context': {'search_default_quantity_gt_zero': 1, + 'group_by_no_leaf': 1, 'group_by': []}, + 'res_model': 'stock.report.quantity.by.location', + 'domain': [('wiz_id', '=', self.id)], + } + return action + + def _compute_stock_report_by_location(self): + self.ensure_one() + recs = [] + for loc in self.location_ids: + quant_groups = self.env['stock.quant'].read_group( + [('location_id', 'child_of', [loc.id])], + ['quantity', 'product_id'], + ['product_id']) + mapping = dict( + [(quant_group['product_id'][0], + quant_group['quantity']) + for quant_group in quant_groups] + ) + products = self.env['product.product'].search( + [('type', '=', 'product')]) + for product in products: + r = self.env['stock.report.quantity.by.location'].create({ + 'product_id': product.id, + 'product_category_id': product.categ_id.id, + 'uom_id': product.uom_id.id, + 'quantity': mapping.get(product.id, 0.0), + 'location_id': loc.id, + 'wiz_id': self.id, + 'default_code': product.default_code, + }) + recs.append(r.id) + return recs + + +class StockReportQuantityByLocation(models.TransientModel): + _name = 'stock.report.quantity.by.location' + _description = 'Stock Report By Location' + + wiz_id = fields.Many2one( + comodel_name='stock.report.quantity.by.location.prepare') + product_id = fields.Many2one( + comodel_name='product.product', + required=True, + ) + product_category_id = fields.Many2one( + comodel_name='product.category', + string='Product Category', + ) + location_id = fields.Many2one( + comodel_name='stock.location', + required=True, + ) + quantity = fields.Float() + uom_id = fields.Many2one(comodel_name='product.uom', string='Product UoM',) + default_code = fields.Char('Internal Reference',) diff --git a/stock_report_quantity_by_location/wizards/stock_report_quantity_by_location_views.xml b/stock_report_quantity_by_location/wizards/stock_report_quantity_by_location_views.xml new file mode 100644 index 0000000..d84f000 --- /dev/null +++ b/stock_report_quantity_by_location/wizards/stock_report_quantity_by_location_views.xml @@ -0,0 +1,79 @@ + + + + + Stock Report Quantity By Location Prepare + stock.report.quantity.by.location.prepare + +
+ + + + + +
+
+
+
+
+ + Inventory By Location + stock.report.quantity.by.location.prepare + form + form + + new + + + + + Stock Report Quantity By Location Form + stock.report.quantity.by.location + + + + + + + + + + + + Stock Report Quantity By Location Pivot + stock.report.quantity.by.location + + + + + + + + + + + stock.report.quantity.by.location.search + stock.report.quantity.by.location + + + + + + + + + + + + + + +
+