diff --git a/stock_analysis_by_location_report/README.rst b/stock_analysis_by_location_report/README.rst new file mode 100644 index 000000000..ec90de191 --- /dev/null +++ b/stock_analysis_by_location_report/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Stock Analysis By Location Report +================================ +* Analyse the product or product variant stock based on locations. + +Configuration +============ + - www.odoo.com/documentation/17.0/setup/install.html + - Install our custom addon + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License v3.0 (AGPL v3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developer: (V17) NIHALA KP, Contact: odoo@cybrosys.com + + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +-------- +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com" + +Further Information +----------- +HTML Description: ``__ diff --git a/stock_analysis_by_location_report/__init__.py b/stock_analysis_by_location_report/__init__.py new file mode 100644 index 000000000..17c9de3fc --- /dev/null +++ b/stock_analysis_by_location_report/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import controllers +from . import models +from . import report +from . import wizard diff --git a/stock_analysis_by_location_report/__manifest__.py b/stock_analysis_by_location_report/__manifest__.py new file mode 100644 index 000000000..75fe59d54 --- /dev/null +++ b/stock_analysis_by_location_report/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': 'Stock Analysis By Location Report', + 'version': '17.0.1.0.0', + 'category': 'Warehouse', + 'summary': 'To view each products stock in each location', + 'description': """This module helps to get the stock positions in each """ + """location. Also helps to get the details as a """ + """PDF report or Excel Report.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'stock', 'product'], + 'data': [ + 'security/ir.model.access.csv', + 'views/stock_location_product_views.xml', + 'views/stock_location_product_variant_views.xml', + 'views/product_template_views.xml', + 'report/stock_location_report.xml', + 'report/stock_location_report_templates.xml', + 'wizard/stock_location_report_views.xml', + 'views/menus.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'stock_analysis_by_location_report/static/src/js/stock_report.js' + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/stock_analysis_by_location_report/controllers/__init__.py b/stock_analysis_by_location_report/controllers/__init__.py new file mode 100644 index 000000000..850d1bc51 --- /dev/null +++ b/stock_analysis_by_location_report/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import stock_analysis_by_location_report diff --git a/stock_analysis_by_location_report/controllers/stock_analysis_by_location_report.py b/stock_analysis_by_location_report/controllers/stock_analysis_by_location_report.py new file mode 100644 index 000000000..6633e0744 --- /dev/null +++ b/stock_analysis_by_location_report/controllers/stock_analysis_by_location_report.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.tools import html_escape + + +class StockLocationXLSVReport(http.Controller): + """To create the route for xlsx report""" + @http.route('/report_excel', type='http', auth='user', methods=['POST'], + csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name): + """To generate the response""" + report_obj = request.env[model].with_user(request.session.uid) + options = json.loads(options) + token = 'dummy-because-api-expects-one' + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', + content_disposition(report_name + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(options, response) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = http.serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/stock_analysis_by_location_report/doc/RELEASE_NOTES.md b/stock_analysis_by_location_report/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..f03bc6b15 --- /dev/null +++ b/stock_analysis_by_location_report/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 23.05.2024 +#### Version 17.0.1.0.0 +#### ADD +- Initial commit for Stock Analysis By Location Report diff --git a/stock_analysis_by_location_report/models/__init__.py b/stock_analysis_by_location_report/models/__init__.py new file mode 100644 index 000000000..b825919b7 --- /dev/null +++ b/stock_analysis_by_location_report/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import product_product +from . import product_template +from . import stock_location_product +from . import stock_location_product_variant diff --git a/stock_analysis_by_location_report/models/product_product.py b/stock_analysis_by_location_report/models/product_product.py new file mode 100644 index 000000000..e9d2058b5 --- /dev/null +++ b/stock_analysis_by_location_report/models/product_product.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models, _ + + +class ProductProduct(models.Model): + """Inherited product template to add additional fields and compute methods + for quantity computation""" + _inherit = 'product.product' + + qty_incoming = fields.Float(string='Incoming Qty', + compute='_compute_quantities', store=True) + qty_outgoing = fields.Float(string='Outgoing Qty', + compute='_compute_quantities', store=True) + qty_avail = fields.Float(string='Available Qty', + compute='_compute_quantities', store=True) + qty_virtual = fields.Float(string='Virtual Qty', + compute='_compute_quantities', store=True) + + def _compute_quantities_dict(self, lot_id, owner_id, package_id, + from_date=False, to_date=False): + """Function for computing the incoming, outgoing,available, and virtual + quantities for the product""" + res = super()._compute_quantities_dict(lot_id, owner_id, package_id, + from_date=False, to_date=False) + for product in self.with_context(prefetch_fields=False): + product_id = product.id + product.qty_incoming = res[product_id]['incoming_qty'] + product.qty_outgoing = res[product_id]['outgoing_qty'] + product.qty_avail = res[product_id]['qty_available'] + product.qty_virtual = res[product_id]['virtual_available'] + return res diff --git a/stock_analysis_by_location_report/models/product_template.py b/stock_analysis_by_location_report/models/product_template.py new file mode 100644 index 000000000..95a689caa --- /dev/null +++ b/stock_analysis_by_location_report/models/product_template.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models, _ + + +class ProductTemplate(models.Model): + """Inherited product template to add additional fields and compute methods + for quantity computation""" + _inherit = 'product.template' + + qty_incoming = fields.Float(string='Incoming Qty', + compute='_compute_quantities', store=True, + help='Incoming quantity of the product') + qty_outgoing = fields.Float(string='Outgoing Qty', + compute='_compute_quantities', store=True, + help='Outgoing quantity of the product') + qty_avail = fields.Float(string='Available Qty', + compute='_compute_quantities', store=True, + help='Available quantity of the product') + qty_virtual = fields.Float(string='Virtual Qty', + compute='_compute_quantities', store=True, + help='Virtual quantity of the product') + + def _compute_quantities(self): + """Function for computing the incoming, outgoing,available, and virtual + quantities for the product template""" + res = super()._compute_quantities() + for template in self: + template.qty_incoming = template.incoming_qty + template.qty_outgoing = template.outgoing_qty + template.qty_avail = template.qty_available + template.qty_virtual = template.virtual_available + return res diff --git a/stock_analysis_by_location_report/models/stock_location_product.py b/stock_analysis_by_location_report/models/stock_location_product.py new file mode 100644 index 000000000..76544892f --- /dev/null +++ b/stock_analysis_by_location_report/models/stock_location_product.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models, tools + + +class StockLocationProduct(models.Model): + """ Model for generating pivot view based on product locations""" + _name = 'stock.location.product' + _description = "Product Location Report" + _auto = False + + product_id = fields.Many2one('product.template', string="Product", + help='Name of the product') + location_id = fields.Many2one('stock.location', string='Location', + help='Choose the location') + on_hand_qty = fields.Integer(string='On Hand Quantity', + help='On hand quantity of the product') + qty_incoming = fields.Integer(string='Incoming Quantity', + help='Incoming quantity of the product') + qty_outgoing = fields.Integer(string='Outgoing Quantity', + help='Outgoing quantity of the product') + forecast_qty = fields.Integer(string='Forecast Quantity', + help='Forecasted quantity of the product') + + def init(self): + """Initialize the view. Drops the existing view if it exists and + creates a new view with the following columns for the Product model""" + tools.drop_view_if_exists(self._cr, self._table) + self._cr.execute(''' CREATE OR REPLACE VIEW %s AS ( + SELECT row_number() OVER () AS id, + product_template.id AS product_id, + stock_location.id AS location_id, + SUM(stock_quant.quantity) AS on_hand_qty, + SUM(stock_quant.quantity + + product_template.qty_incoming - product_template.qty_outgoing) + AS forecast_qty, + SUM(product_template.qty_incoming) AS qty_incoming, + SUM(product_template.qty_outgoing) AS qty_outgoing + FROM product_template + INNER JOIN product_product ON + product_product.product_tmpl_id = product_template.id + INNER JOIN stock_quant ON stock_quant.product_id = product_product.id + INNER JOIN stock_location ON + stock_quant.location_id = stock_location.id + WHERE stock_location.usage = 'internal' + GROUP BY product_template.id, stock_location.id)''' % (self._table,)) diff --git a/stock_analysis_by_location_report/models/stock_location_product_variant.py b/stock_analysis_by_location_report/models/stock_location_product_variant.py new file mode 100644 index 000000000..71929ae21 --- /dev/null +++ b/stock_analysis_by_location_report/models/stock_location_product_variant.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models, tools + + +class StockLocationProductVariant(models.Model): + """ Model for generating pivot view for product variants based on product + locations""" + _name = 'stock.location.product.variant' + _description = "Product Variant Location Report" + _auto = False + + product_id = fields.Many2one('product.product', string="Product", + help='Name of the product') + location_id = fields.Many2one('stock.location', string='Location', + help='Choose the location') + on_hand_qty = fields.Integer(string='On Hand Quantity', + help='On hand quantity of the product') + qty_incoming = fields.Integer(string='Incoming Quantity', + help='Incoming quantity of the product') + qty_outgoing = fields.Integer(string='Outgoing Quantity', + help='Outgoing quantity of the product') + forecast_qty = fields.Integer(string='Forecast Quantity', + help='Forecasted quantity of the product') + + def init(self): + """Initialize the view. Drops the existing view if it exists and + creates a new view with the following columns for the Product variant + model""" + tools.drop_view_if_exists(self._cr, self._table) + self._cr.execute(''' CREATE OR REPLACE VIEW %s AS ( + select row_number() OVER () as id, + stock_quant.product_id, + stock_quant.location_id, + stock_quant.quantity on_hand_qty, + (stock_quant.quantity + + product_product.qty_incoming - product_product.qty_outgoing) + AS forecast_qty, + product_product.qty_incoming, + product_product.qty_outgoing from product_product + inner JOIN stock_quant on stock_quant.product_id = product_product.id + inner join product_template on + product_product.product_tmpl_id = product_template.id + inner join stock_location on + stock_quant.location_id = stock_location.id + where stock_location.usage = 'internal')''' % (self._table,)) diff --git a/stock_analysis_by_location_report/report/__init__.py b/stock_analysis_by_location_report/report/__init__.py new file mode 100644 index 000000000..9cddb9409 --- /dev/null +++ b/stock_analysis_by_location_report/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import stock_location_report diff --git a/stock_analysis_by_location_report/report/stock_location_report.py b/stock_analysis_by_location_report/report/stock_location_report.py new file mode 100644 index 000000000..6fd98307b --- /dev/null +++ b/stock_analysis_by_location_report/report/stock_location_report.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import api, models +from odoo.tools import groupby + + +class StockLocationReport(models.AbstractModel): + """To generate report based on query and get report values""" + _name = "report.stock_analysis_by_location_report.report_stock_location" + + @api.model + def _get_report_values(self, docids, data=None): + """ To get the report values based on the user giving conditions""" + value = self.query_data(data['report_type'], data['product_id'], + data['product_variant_id']) + grouped_data = {} + for product_id, group in ( + groupby(value, key=lambda x: x['product']['en_US'])): + grouped_data[product_id] = list(group) + return { + 'grouped_data': grouped_data, + 'var': value + } + + def query_data(self, report_type, product_id, product_variant_id): + """ To fetch values from database using query""" + + if report_type == 'product': + query = """SELECT row_number() OVER () AS id, + product_template.name AS product, + stock_location.complete_name AS location, + SUM(stock_quant.quantity) AS on_hand_qty, + SUM(stock_quant.quantity + + product_template.qty_incoming - product_template.qty_outgoing) + AS forecast_qty, + SUM(product_template.qty_incoming) AS qty_incoming, + SUM(product_template.qty_outgoing) AS qty_outgoing + FROM product_template + INNER JOIN product_product ON + product_product.product_tmpl_id = product_template.id + INNER JOIN stock_quant ON + stock_quant.product_id = product_product.id + INNER JOIN stock_location ON + stock_quant.location_id = stock_location.id + WHERE stock_location.usage = 'internal' + GROUP BY product_template.id, stock_location.id""" + if product_id: + query = """SELECT row_number() OVER () AS id, + product_template.name AS product, + stock_location.complete_name AS location, + SUM(stock_quant.quantity) AS on_hand_qty, + SUM(stock_quant.quantity + + product_template.qty_incoming - product_template.qty_outgoing) + AS forecast_qty, + SUM(product_template.qty_incoming) AS qty_incoming, + SUM(product_template.qty_outgoing) AS qty_outgoing + FROM product_template + INNER JOIN product_product ON + product_product.product_tmpl_id = product_template.id + INNER JOIN stock_quant ON + stock_quant.product_id = product_product.id + INNER JOIN stock_location ON + stock_quant.location_id = stock_location.id + WHERE stock_location.usage = 'internal' + and product_template.id=%(product_id)s + GROUP BY product_template.id, stock_location.id""" + else: + query = """select product_template.name as Product, + stock_location.complete_name as Location, + stock_quant.quantity on_hand_qty, + (stock_quant.quantity + + product_product.qty_incoming - product_product.qty_outgoing) + AS forecast_qty, product_product.qty_incoming, + product_product.qty_outgoing from product_product + inner JOIN stock_quant on + stock_quant.product_id = product_product.id + inner join product_template + on product_product.product_tmpl_id = product_template.id + inner join stock_location on + stock_quant.location_id = stock_location.id + where stock_location.usage = 'internal'""" + if product_variant_id: + query += """ and product_id=%(product_variant_id)s""" + self.env.cr.execute(query, + {'report_type': report_type, + 'product_id': product_id, + 'product_variant_id': product_variant_id, + }) + return self.env.cr.dictfetchall() diff --git a/stock_analysis_by_location_report/report/stock_location_report.xml b/stock_analysis_by_location_report/report/stock_location_report.xml new file mode 100644 index 000000000..24047fec6 --- /dev/null +++ b/stock_analysis_by_location_report/report/stock_location_report.xml @@ -0,0 +1,13 @@ + + + + + Stock Location Report + stock.move + qweb-pdf + stock_analysis_by_location_report.report_stock_location + stock_analysis_by_location_report.report_stock_location + 'Stock Location Report - %s' + report + + diff --git a/stock_analysis_by_location_report/report/stock_location_report_templates.xml b/stock_analysis_by_location_report/report/stock_location_report_templates.xml new file mode 100644 index 000000000..bd68156e2 --- /dev/null +++ b/stock_analysis_by_location_report/report/stock_location_report_templates.xml @@ -0,0 +1,70 @@ + + + + + diff --git a/stock_analysis_by_location_report/security/ir.model.access.csv b/stock_analysis_by_location_report/security/ir.model.access.csv new file mode 100644 index 000000000..cd4c32383 --- /dev/null +++ b/stock_analysis_by_location_report/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_stock_location_product,access.stock.location.product,model_stock_location_product,base.group_user,1,1,1,1 +access_stock_location_product_variant,access.stock.location.product.variant,model_stock_location_product_variant,base.group_user,1,1,1,1 +access_stock_location_report,access.stock.location.report,model_stock_location_report,base.group_user,1,1,1,1 diff --git a/stock_analysis_by_location_report/static/description/assets/icons/check.png b/stock_analysis_by_location_report/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/check.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/chevron.png b/stock_analysis_by_location_report/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/chevron.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/cogs.png b/stock_analysis_by_location_report/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/cogs.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/consultation.png b/stock_analysis_by_location_report/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/consultation.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/ecom-black.png b/stock_analysis_by_location_report/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/ecom-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/education-black.png b/stock_analysis_by_location_report/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/education-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/hotel-black.png b/stock_analysis_by_location_report/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/hotel-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/license.png b/stock_analysis_by_location_report/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/license.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/lifebuoy.png b/stock_analysis_by_location_report/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/lifebuoy.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/manufacturing-black.png b/stock_analysis_by_location_report/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/manufacturing-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/pos-black.png b/stock_analysis_by_location_report/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/pos-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/puzzle.png b/stock_analysis_by_location_report/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/puzzle.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/restaurant-black.png b/stock_analysis_by_location_report/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/restaurant-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/service-black.png b/stock_analysis_by_location_report/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/service-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/trading-black.png b/stock_analysis_by_location_report/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/trading-black.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/training.png b/stock_analysis_by_location_report/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/training.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/update.png b/stock_analysis_by_location_report/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/update.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/user.png b/stock_analysis_by_location_report/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/user.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/icons/wrench.png b/stock_analysis_by_location_report/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/icons/wrench.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/Cybrosys R.png b/stock_analysis_by_location_report/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/Cybrosys R.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/categories.png b/stock_analysis_by_location_report/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/categories.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/check-box.png b/stock_analysis_by_location_report/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/check-box.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/compass.png b/stock_analysis_by_location_report/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/compass.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/corporate.png b/stock_analysis_by_location_report/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/corporate.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/customer-support.png b/stock_analysis_by_location_report/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/customer-support.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/cybrosys-logo.png b/stock_analysis_by_location_report/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/cybrosys-logo.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/email.svg b/stock_analysis_by_location_report/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/features.png b/stock_analysis_by_location_report/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/features.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/logo.png b/stock_analysis_by_location_report/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/logo.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/phone.svg b/stock_analysis_by_location_report/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/pictures.png b/stock_analysis_by_location_report/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/pictures.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/pie-chart.png b/stock_analysis_by_location_report/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/pie-chart.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/right-arrow.png b/stock_analysis_by_location_report/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/right-arrow.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/star (1) 2.svg b/stock_analysis_by_location_report/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/star.png b/stock_analysis_by_location_report/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/star.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/support (1) 1.svg b/stock_analysis_by_location_report/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/support-email.svg b/stock_analysis_by_location_report/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/support.png b/stock_analysis_by_location_report/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/support.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/tick-mark.svg b/stock_analysis_by_location_report/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/whatsapp 1.svg b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.png b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.svg b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stock_analysis_by_location_report/static/description/assets/modules/1.png b/stock_analysis_by_location_report/static/description/assets/modules/1.png new file mode 100644 index 000000000..e9948d8a7 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/1.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/2.png b/stock_analysis_by_location_report/static/description/assets/modules/2.png new file mode 100644 index 000000000..0e311ca87 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/2.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/3.jpg b/stock_analysis_by_location_report/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..a68431b9d Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/3.jpg differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/4.jpg b/stock_analysis_by_location_report/static/description/assets/modules/4.jpg new file mode 100644 index 000000000..fd64cf8ca Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/4.jpg differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/5.png b/stock_analysis_by_location_report/static/description/assets/modules/5.png new file mode 100644 index 000000000..cb17cf612 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/5.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/6.jpg b/stock_analysis_by_location_report/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..115e1eee1 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/6.jpg differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/1.png b/stock_analysis_by_location_report/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..4eeca6316 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/1.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/10.png b/stock_analysis_by_location_report/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..95f2e62fb Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/10.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/11.png b/stock_analysis_by_location_report/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..6848a5312 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/11.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/12.png b/stock_analysis_by_location_report/static/description/assets/screenshots/12.png new file mode 100644 index 000000000..d032a7e41 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/12.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/2.png b/stock_analysis_by_location_report/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..880f6ac92 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/2.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/3.png b/stock_analysis_by_location_report/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..a4a99e17c Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/3.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/4.png b/stock_analysis_by_location_report/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..fa1b55345 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/4.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/5.png b/stock_analysis_by_location_report/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..9ffdefab8 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/5.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/6.png b/stock_analysis_by_location_report/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..069925784 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/6.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/7.png b/stock_analysis_by_location_report/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..73c7c223b Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/7.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/8.png b/stock_analysis_by_location_report/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..b1b4aa647 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/8.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/9.png b/stock_analysis_by_location_report/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..19b28b29d Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/9.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/screenshots/hero-v17.gif b/stock_analysis_by_location_report/static/description/assets/screenshots/hero-v17.gif new file mode 100644 index 000000000..bdaf31d01 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/hero-v17.gif differ diff --git a/stock_analysis_by_location_report/static/description/banner.jpg b/stock_analysis_by_location_report/static/description/banner.jpg new file mode 100644 index 000000000..60620669b Binary files /dev/null and b/stock_analysis_by_location_report/static/description/banner.jpg differ diff --git a/stock_analysis_by_location_report/static/description/icon.png b/stock_analysis_by_location_report/static/description/icon.png new file mode 100644 index 000000000..c7f8476a1 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/icon.png differ diff --git a/stock_analysis_by_location_report/static/description/index.html b/stock_analysis_by_location_report/static/description/index.html new file mode 100644 index 000000000..aa1a737f0 --- /dev/null +++ b/stock_analysis_by_location_report/static/description/index.html @@ -0,0 +1,768 @@ + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Stock Analysis By Location Report

+

+ This Module Helps To Analyse The Product Quantities And + Movements Across Various Locations.

+ +
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Overview

+

This module + helps to provide an overview of Inventory Levels + and Movements based on Locations.It enables + Stakeholders to Analyze Stock Availability, + Incoming and Outgoing Quantities, and Virtual + Quantities across various Stock Locations, + aiding in Strategic Decision-making regarding + Inventory Management, Replenishment, and + Distribution.

+
+
+
+
+
+
+ +
+
+
+
+
+ + +
+
+

+ A new menu has been added to access the view of stock locations and reports.

+
+
+
+
+
+
+ +
+
+

+ By clicking on "Products," you can access the pivot view for product stock based on location.

+
+
+
+
+
+
+ +
+
+

+ By clicking on "Product Variants," you can access the pivot view for the stock of product variants based on location.

+
+
+
+
+
+
+ +
+
+ +
+
+

+ When you click on the "Stock Location Reports" menu item, a wizard will open for selecting the required options.

+
+
+
+
+
+
+ +
+
+

+ By selecting "Product" as the report type and clicking on the "Print PDF" button, you can generate a PDF report of product information based on location. Below is a sample report.

+
+
+
+
+
+
+ +
+
+ +
+
+

+ By selecting "Product" as the report type and choosing a specific product, then clicking on the "Print PDF" button, you can generate a PDF report of the specific product's information based on location. Below is a sample report.

+
+
+
+
+
+
+ +
+
+ +
+
+

+ By clicking on the "Print XLSX" button, you can obtain the product's stock report based on location in Excel format.

+
+
+
+
+
+
+ +
+
+ +
+
+

+ By selecting the specific product variant as the report type and clicking on the "Print XLSX" button, you can generate an XLSX report of the specific product variant's information based on location. Below is the sample report.

+
+
+
+ +
+ +
+
+
    +
  • + Location wise + Inventory Analysis +
  • +
  • + Real Time + Updates +
  • +
  • + Generate + Reports of Stock based on Location +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on: 22nd April 2024 +
+

+ + Initial Commit for Stock Analysis By Location + Report

+
+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Licensing Consultancy

+
+
+
+
+
+
+

+ Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

+ Education

+

A platform for educational management

+
+
+
+
+ +

+ Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & + Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service + Management

+

Keep track of services and invoice

+
+
+
+
+ +

+ Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel + Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

+ Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got + questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to + us on WhatsApp!

+
+91 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/stock_analysis_by_location_report/static/src/js/stock_report.js b/stock_analysis_by_location_report/static/src/js/stock_report.js new file mode 100644 index 000000000..42533a80a --- /dev/null +++ b/stock_analysis_by_location_report/static/src/js/stock_report.js @@ -0,0 +1,22 @@ +/** @odoo-module */ +/** + * registers a new handler to generate xlsx report + */ +import { registry } from "@web/core/registry"; +import { BlockUI } from "@web/core/ui/block_ui"; +import { session } from "@web/session"; +import { download } from "@web/core/network/download"; +registry.category("ir.actions.report handlers").add("xlsx", async (action) => { + if (action.report_type === 'xlsx') { + BlockUI; + var def = $.Deferred(); + await download({ + url: '/report_excel', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: this.unblockUI, + }); + return def; + } +}); diff --git a/stock_analysis_by_location_report/views/menus.xml b/stock_analysis_by_location_report/views/menus.xml new file mode 100644 index 000000000..e16723d4a --- /dev/null +++ b/stock_analysis_by_location_report/views/menus.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/stock_analysis_by_location_report/views/product_template_views.xml b/stock_analysis_by_location_report/views/product_template_views.xml new file mode 100644 index 000000000..177aa17ef --- /dev/null +++ b/stock_analysis_by_location_report/views/product_template_views.xml @@ -0,0 +1,31 @@ + + + + + product.template.view.form.inherit.stock.analysis.by.location.report + product.template + + + + + + + + + + + + + product.product.view.form.inherit.stock.analysis.by.location.report + product.product + + + + + + + + + + + diff --git a/stock_analysis_by_location_report/views/stock_location_product_variant_views.xml b/stock_analysis_by_location_report/views/stock_location_product_variant_views.xml new file mode 100644 index 000000000..21d49994a --- /dev/null +++ b/stock_analysis_by_location_report/views/stock_location_product_variant_views.xml @@ -0,0 +1,41 @@ + + + + + stock.location.product.variant.view.pivot + stock.location.product.variant + + + + + + + + + + + + + + stock_location_product_variant_view_tree + stock.location.product.variant + + + + + + + + + + + + + + Product Variants: Stock Location Report + stock.location.product.variant + tree,form,pivot + + + diff --git a/stock_analysis_by_location_report/views/stock_location_product_views.xml b/stock_analysis_by_location_report/views/stock_location_product_views.xml new file mode 100644 index 000000000..0a1167ab5 --- /dev/null +++ b/stock_analysis_by_location_report/views/stock_location_product_views.xml @@ -0,0 +1,40 @@ + + + + + stock.location.product.view.pivot + stock.location.product + + + + + + + + + + + + + + stock_location_product_view_tree + stock.location.product + + + + + + + + + + + + + + Product: Stock Location Report + stock.location.product + tree,form,pivot + + + diff --git a/stock_analysis_by_location_report/wizard/__init__.py b/stock_analysis_by_location_report/wizard/__init__.py new file mode 100644 index 000000000..9cddb9409 --- /dev/null +++ b/stock_analysis_by_location_report/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import stock_location_report diff --git a/stock_analysis_by_location_report/wizard/stock_location_report.py b/stock_analysis_by_location_report/wizard/stock_location_report.py new file mode 100644 index 000000000..f5f5fd95b --- /dev/null +++ b/stock_analysis_by_location_report/wizard/stock_location_report.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Nihala KP(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +import io +import json +from odoo import fields, models, _ +from odoo.tools import date_utils, groupby + +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class StockLocation(models.TransientModel): + """Transient model to give the input values for the + generation of report values""" + _name = "stock.location.report" + _description = "Stock Location Report Wizard" + + report_type = fields.Selection([ + ('product', 'Products'), + ('product_variant', 'Product Variant') + ], string="Report Type", default='product', + help="Choose the product type") + product_variant_id = fields.Many2one('product.product', + string="Product Variant", + help="choose the product variant of " + "which the detail should be" + " known") + product_id = fields.Many2one('product.template', string="Product", + help="choose the product of which the detail " + "should be known") + + def action_pdf_report(self): + """ To pass values in wizard""" + data = { + 'model_id': self.id, + 'report_type': self.report_type, + 'product_id': self.product_id.id, + 'product_variant_id': self.product_variant_id.id, + } + return self.env.ref( + 'stock_analysis_by_location_report.stock_by_location_report').report_action( + None, data=data) + + def action_xlsx_report(self): + """ To print the XLSX report type""" + query = self.env[ + 'report.stock_analysis_by_location_report.report_stock_location' + ].query_data( + self.report_type, self.product_id.id, self.product_variant_id.id) + data = { + 'report_type': self.report_type, + 'product_id': self.product_id.id, + 'product_variant_id': self.product_variant_id.id, + 'var': query + } + return { + 'type': 'ir.actions.report', + 'data': {'model': 'stock.location.report', + 'options': json.dumps(data, + default=date_utils.json_default), + 'output_format': 'xlsx', + 'report_name': 'Stock Location Report', + }, + 'report_type': 'xlsx', + } + + def get_xlsx_report(self, data, response): + """To get the report values for xlsx report""" + query_result = data['var'] + grouped_data = {} + for product_id, group in groupby(query_result, + key=lambda x: x['product']['en_US']): + grouped_data[product_id] = list(group) + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + cell_format = workbook.add_format( + {'font_size': '12px', 'bold': True, 'align': 'center'}) + grey_cell_format = workbook.add_format( + {'bold': True, 'bg_color': '#D3D3D3', 'align': 'center'}) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px', + 'bg_color': 'gray', }) + txt = workbook.add_format({'font_size': '10px', 'align': 'left'}) + txt_head = workbook.add_format({'font_size': '10px', 'align': 'left', + 'bold': True}) + sheet.set_column(0, 0, 25) + sheet.set_column(1, 1, 25) + sheet.set_column(2, 2, 15) + sheet.set_column(3, 3, 15) + sheet.set_column(4, 4, 15) + sheet.set_column(5, 5, 15) + sheet.merge_range('A1:B1', 'Report Date:' + str(fields.Date.today()), + txt_head) + sheet.merge_range('A2:F3', 'STOCK LOCATION REPORT', head) + sheet.write('A6', 'Product', grey_cell_format) + sheet.write('B6', 'Location', grey_cell_format) + sheet.write('C6', 'Onhand Qty', grey_cell_format) + sheet.write('D6', 'Incoming Qty', grey_cell_format) + sheet.write('E6', 'Outgoing Qty', grey_cell_format) + sheet.write('F6', 'Forecast Qty', grey_cell_format) + row = 6 + for product_id, product_data in grouped_data.items(): + for data in product_data: + sheet.write(row, 0, product_id) + sheet.write(row, 1, data['location']) + sheet.write(row, 2, data['on_hand_qty']) + sheet.write(row, 3, data['qty_incoming']) + sheet.write(row, 4, data['qty_outgoing']) + sheet.write(row, 5, data['forecast_qty']) + row += 1 + sheet.write(row, 0, 'Total:', grey_cell_format) + sheet.write(row, 1, '', grey_cell_format) + sheet.write(row, 2, sum(x['on_hand_qty'] for x in product_data), + grey_cell_format) + sheet.write(row, 3, sum(x['qty_incoming'] for x in product_data), + grey_cell_format) + sheet.write(row, 4, sum(x['qty_outgoing'] for x in product_data), + grey_cell_format) + sheet.write(row, 5, sum(x['forecast_qty'] for x in product_data), + grey_cell_format) + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/stock_analysis_by_location_report/wizard/stock_location_report_views.xml b/stock_analysis_by_location_report/wizard/stock_location_report_views.xml new file mode 100644 index 000000000..fecd10833 --- /dev/null +++ b/stock_analysis_by_location_report/wizard/stock_location_report_views.xml @@ -0,0 +1,35 @@ + + + + + stock.location.report.view + stock.location.report + +
+ + + + + + + +
+
+
+
+
+ + + Stock Location PDF & Excel Report + stock.location.report + form + + new + +