diff --git a/stock_analysis_by_location_report/README.rst b/stock_analysis_by_location_report/README.rst new file mode 100644 index 000000000..79c893ae0 --- /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 +------------- +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers: (V16) Shafna K, + (V15) Aysha Shalin, + 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 +---------- +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +------------------- +HTML Description: ``__ \ No newline at end of file diff --git a/stock_analysis_by_location_report/__init__.py b/stock_analysis_by_location_report/__init__.py new file mode 100644 index 000000000..9235b04ed --- /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: Aysha Shalin (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..6ec4035a9 --- /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: Aysha Shalin (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': '15.0.1.0.0', + 'category': 'Warehouse', + 'summary': """Analyse the product or product variant stock based on + locations.""", + 'description': """This module helps to analyse the stock informations in + each location. Also enables to print the details as a PDF 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.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': 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..9f92b45a2 --- /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: Aysha Shalin (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/controllers/stock_location_report.py b/stock_analysis_by_location_report/controllers/stock_location_report.py new file mode 100644 index 000000000..cd40c189d --- /dev/null +++ b/stock_analysis_by_location_report/controllers/stock_location_report.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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..643f8d683 --- /dev/null +++ b/stock_analysis_by_location_report/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 31.05.2024 +#### Version 15.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..aeaa83683 --- /dev/null +++ b/stock_analysis_by_location_report/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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_template +from . import stock_location_product +from . import stock_location_product_variant 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..024c1ef3d --- /dev/null +++ b/stock_analysis_by_location_report/models/product_template.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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 + + +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/stock_location_product.py b/stock_analysis_by_location_report/models/stock_location_product.py new file mode 100644 index 000000000..d265c2705 --- /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: Aysha Shalin (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 ProductPivotReport(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..af500b835 --- /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: Aysha Shalin (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 ProductPivotReport(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..9f92b45a2 --- /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: Aysha Shalin (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..1a771cb87 --- /dev/null +++ b/stock_analysis_by_location_report/report/stock_location_report.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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'])): + 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..000cf6cf7 --- /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 + + \ No newline at end of file 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..4589a6f67 --- /dev/null +++ b/stock_analysis_by_location_report/report/stock_location_report_templates.xml @@ -0,0 +1,52 @@ + + + + + \ No newline at end of file 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..8874c93fc --- /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_variant,access.stock.location.product.variant,model_stock_location_product_variant,base.group_user,1,1,1,1 +access_stock_location_product,access.stock.location.product,model_stock_location_product,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 \ No newline at end of file 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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/categories.png b/stock_analysis_by_location_report/static/description/assets/misc/categories.png new file mode 100755 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 100755 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 100755 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 100755 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 100755 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 100755 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/features.png b/stock_analysis_by_location_report/static/description/assets/misc/features.png new file mode 100755 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 100755 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/pictures.png b/stock_analysis_by_location_report/static/description/assets/misc/pictures.png new file mode 100755 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 100755 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 100755 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.png b/stock_analysis_by_location_report/static/description/assets/misc/star.png new file mode 100755 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.png b/stock_analysis_by_location_report/static/description/assets/misc/support.png new file mode 100755 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/whatsapp.png b/stock_analysis_by_location_report/static/description/assets/misc/whatsapp.png new file mode 100755 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/modules/export_stockinfo_xls.png b/stock_analysis_by_location_report/static/description/assets/modules/export_stockinfo_xls.png new file mode 100644 index 000000000..34bb30083 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/export_stockinfo_xls.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/inventory_barcode_scanning.png b/stock_analysis_by_location_report/static/description/assets/modules/inventory_barcode_scanning.png new file mode 100644 index 000000000..147d13977 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/inventory_barcode_scanning.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/inventory_stock_dashboard_odoo.png b/stock_analysis_by_location_report/static/description/assets/modules/inventory_stock_dashboard_odoo.png new file mode 100644 index 000000000..39edc8a45 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/inventory_stock_dashboard_odoo.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/product_barcode.png b/stock_analysis_by_location_report/static/description/assets/modules/product_barcode.png new file mode 100644 index 000000000..4a21e937e Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/product_barcode.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/product_brand_inventory.png b/stock_analysis_by_location_report/static/description/assets/modules/product_brand_inventory.png new file mode 100644 index 000000000..d4bc8daf1 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/product_brand_inventory.png differ diff --git a/stock_analysis_by_location_report/static/description/assets/modules/stock_last_purchase_price.png b/stock_analysis_by_location_report/static/description/assets/modules/stock_last_purchase_price.png new file mode 100644 index 000000000..86fe35515 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/modules/stock_last_purchase_price.png 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..92cbf0c86 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/2.png b/stock_analysis_by_location_report/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..ae37eafba 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..9032b4c94 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..619de498a 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..5cc067aad 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..7c52d0aeb 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..25760df47 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..30cc69482 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/hero.gif b/stock_analysis_by_location_report/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..7529cba5a Binary files /dev/null and b/stock_analysis_by_location_report/static/description/assets/screenshots/hero.gif differ diff --git a/stock_analysis_by_location_report/static/description/banner.png b/stock_analysis_by_location_report/static/description/banner.png new file mode 100644 index 000000000..641484028 Binary files /dev/null and b/stock_analysis_by_location_report/static/description/banner.png 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..86fe74a9b 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..10e451d9a --- /dev/null +++ b/stock_analysis_by_location_report/static/description/index.html @@ -0,0 +1,619 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Stock Analysis By Location Report +

+

+ This Module helps to Analyse the Product Quantities and + Movements across Various Locations. +

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

+ Explore This Module

+
+ + + +
+
+ +
+

+ 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. +
+
+ + +
+
+ +
+

+ Features +

+
+
+
+
+ + Location wise Inventory Analysis +
+
+ + Real Time Updates +
+
+ + Generate Reports of Stock based on Location +
+
+
+ + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

+ Stock Location Reports +

+

+ A new Menu is added to get the View of Stock Locations and also + to get the Reports. + +

+
+

+ Product Stock Location Report +

+

+ By Clicking on the Products, you can get the Pivot view for the + Stock of Products based on Location +

+ +
+
+

+ Product Variant Stock Location Report +

+

+ By Clicking on the Product Variants, you can get the Pivot view for the + Stock of Products Variants based on Location +

+ +
+
+

+ Stock Location PDF & Excel Report Wizard +

+

+ When you click on Stock Location Reports MenuItem, a Wizard + will be open to select the Required Options. +

+ +
+
+

+ Stock Location PDF Report of Product +

+

+ By Choosing the Product as Report Type and Clicking on Print PDF Button, + you can get PDF Reporting of Product's Report based on Location. + Below is the Sample Report. +

+ +
+
+

+ XLSX Report Of Product +

+

+ By Clicking on Print XLSX Button, you can get the Product's Stock Report based on Location + in Excel Format. +

+ +
+
+

+ Stock Location PDF Report Of Product Variants +

+

+ By Choosing the Product Variant as Report Type and Clicking on Print PDF Button, + you can get PDF Reporting of Product Variant's Report based on Location. + Below is the Sample Report. +

+ +
+
+

+ XLSX Report Of Product Variants +

+

+ By Clicking on Print XLSX Button, you can get the Product + Variant's Stock Report based on Location in Excel Format. +

+ +
+
+
+ + +
+
+ +
+

+ Related Products +

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

+ Our Services

+
+
+
+
+
+ +
+
+ Odoo Customization
+
+
+
+ +
+
+ Odoo Implementation
+
+
+
+ +
+
+ Odoo Support
+
+
+
+ +
+
+ Hire Odoo Developer
+
+
+
+ +
+
+ Odoo Integration
+
+
+
+ +
+
+ Odoo Migration
+
+
+
+ +
+
+ Odoo Consultancy
+
+
+
+ +
+
+ Odoo Implementation
+
+
+
+ +
+
+ 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 86068 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file 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..e51e374fd --- /dev/null +++ b/stock_analysis_by_location_report/static/src/js/stock_report.js @@ -0,0 +1,21 @@ +/** @odoo-module */ +/** + * registers a new handler to generate xlsx report + */ +import { registry } from "@web/core/registry"; +import framework from 'web.framework'; +import session from 'web.session'; +registry.category("ir.actions.report handlers").add("xlsx", async (action) => { + if (action.report_type === 'xlsx') { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/report_excel', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + } +}); \ No newline at end of file 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..e5bd01048 --- /dev/null +++ b/stock_analysis_by_location_report/views/menus.xml @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file 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..1536ad425 --- /dev/null +++ b/stock_analysis_by_location_report/views/product_template_views.xml @@ -0,0 +1,31 @@ + + + + + product.template.view.form.inherit.stock.analysis.location.report + product.template + + + + + + + + + + + + + product.product.view.form.inherit.stock.analysis.by.location.report + product.product + + + + + + + + + + + \ No newline at end of file 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..0172a7501 --- /dev/null +++ b/stock_analysis_by_location_report/views/stock_location_product_variant_views.xml @@ -0,0 +1,40 @@ + + + + + Product Variants: Stock Location Report + stock.location.product.variant + + + + + + + + + + + + + + Product Variants: Stock Location Report + stock.location.product.variant + + + + + + + + + + + + + + Product Variants: Stock Location Report + stock.location.product.variant + tree,form,pivot + + + \ No newline at end of file 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..6cc60dc5c --- /dev/null +++ b/stock_analysis_by_location_report/views/stock_location_product_views.xml @@ -0,0 +1,40 @@ + + + + + Product: Stock Location Report + stock.location.product + + + + + + + + + + + + + + Product: Stock Location Report + 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..9f92b45a2 --- /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: Aysha Shalin (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..ed4e6eda9 --- /dev/null +++ b/stock_analysis_by_location_report/wizard/stock_location_report.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (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']): + grouped_data[product_id] = list(group) + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + grey_cell_format = workbook.add_format( + {'bold': True, 'bg_color': '#D3D3D3'}) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px', + 'bg_color': 'gray'}) + txt_head = workbook.add_format({'font_size': '10px', 'align': 'left', + 'bold': True}) + sheet.set_column(0, 0, 20) + sheet.set_column(1, 1, 10) + sheet.set_column(2, 2, 10) + 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..5e3668089 --- /dev/null +++ b/stock_analysis_by_location_report/wizard/stock_location_report_views.xml @@ -0,0 +1,37 @@ + + + + + stock.location.report.view.form.inherit.stock.analysis.location.report + stock.location.report + +
+ + + + + + + + +
+
+
+
+
+ + + Stock Location PDF & Excel Report + stock.location.report + form + + new + +
\ No newline at end of file