diff --git a/warehouse_reports/README.rst b/warehouse_reports/README.rst new file mode 100755 index 000000000..4e69e1b6f --- /dev/null +++ b/warehouse_reports/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Warehouse Reports +================= +PDF and Excel report of the Stock Move,Product,Transfer and Stock Valuation + +Configuration +============= +No additional configuration required + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +Developer: (V17) Nivedhya T, 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: ``__ diff --git a/warehouse_reports/__init__.py b/warehouse_reports/__init__.py new file mode 100755 index 000000000..ec580c610 --- /dev/null +++ b/warehouse_reports/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import controllers +from . import models +from . import wizards diff --git a/warehouse_reports/__manifest__.py b/warehouse_reports/__manifest__.py new file mode 100755 index 000000000..d433fdbb2 --- /dev/null +++ b/warehouse_reports/__manifest__.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "Warehouse Reports", + "version": "17.0.1.0.0", + "category": "Warehouse", + "summary": "All warehouse related PDF and Excel reports", + "description": "User is able to print Pdf and Excel report of Stock move," + "Transfer,Product,Stock valuation.All warehouse related PDF" + "and Excel report", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base','stock', 'stock_account'], + 'data': [ + 'security/ir.model.access.csv', + 'wizards/stock_valuation_report_views.xml', + 'wizards/stock_move_report_views.xml', + 'report/ir_action_reports.xml', + 'report/stock_valuation_report_templates.xml', + 'report/stock_transfer_report_templates.xml', + 'report/stock_move_report_templates.xml', + 'report/stock_product_report_templates.xml', + 'wizards/stock_product_report_views.xml', + 'wizards/stock_transfer_report_views.xml', + 'views/warehouse_reports_menus.xml' + ], + 'assets': + { + 'web.assets_backend': [ + 'warehouse_reports/static/src/js/stock_excel_report.js' + ], + }, + 'images': [ + 'static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/warehouse_reports/controllers/__init__.py b/warehouse_reports/controllers/__init__.py new file mode 100755 index 000000000..f3dde810d --- /dev/null +++ b/warehouse_reports/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import warehouse_reports + diff --git a/warehouse_reports/controllers/warehouse_reports.py b/warehouse_reports/controllers/warehouse_reports.py new file mode 100755 index 000000000..f6bbdc7b9 --- /dev/null +++ b/warehouse_reports/controllers/warehouse_reports.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.http import serialize_exception as _serialize_exception +from odoo.tools import html_escape + + +class XLSXReportController(http.Controller): + """XlsxReport generating controller""" + @http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False) + def get_report_xlsx(self, model, options, output_format, **kw): + """ + Generate an XLSX report based on the provided data and return it as a + response. + """ + uid = request.session.uid + report_obj = request.env[model].with_user(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('Excel Report' + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(options, response) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = _serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/warehouse_reports/doc/RELEASE_NOTES.md b/warehouse_reports/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..260a0998d --- /dev/null +++ b/warehouse_reports/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 26.08.2024 +#### Version 17.0.1.0.0 +#### ADD +- Initial commit for Warehouse Reports diff --git a/warehouse_reports/models/__init__.py b/warehouse_reports/models/__init__.py new file mode 100755 index 000000000..f17c5aae2 --- /dev/null +++ b/warehouse_reports/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import product_product +from . import stock_picking_type diff --git a/warehouse_reports/models/product_product.py b/warehouse_reports/models/product_product.py new file mode 100755 index 000000000..d6cfa1d2a --- /dev/null +++ b/warehouse_reports/models/product_product.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class ProductProduct(models.Model): + """ Make some of the product fields as storable to database""" + _inherit = 'product.product' + + outgoing_qty = fields.Float(string="Outgoing quantity", + help="Quantity selling", readonly=True, + store=True) + incoming_qty = fields.Float(string="Incoming quantity", + help="Quantity buying", readonly=True, + store=True) + free_qty = fields.Float(string="Free quantity", + help="Balance quantity", readonly=True, + store=True) + qty_available = fields.Float(string='Quantity available', + help='Available quantity', + readonly=True, store=True) diff --git a/warehouse_reports/models/stock_picking_type.py b/warehouse_reports/models/stock_picking_type.py new file mode 100755 index 000000000..b0099d0d8 --- /dev/null +++ b/warehouse_reports/models/stock_picking_type.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class StockPicking(models.Model): + """ Adding field and make it storable in the database""" + _inherit = "stock.picking.type" + + display_name = fields.Char(string="Display name", + help='Name which is to display', + readonly=False, store=True) diff --git a/warehouse_reports/report/ir_action_reports.xml b/warehouse_reports/report/ir_action_reports.xml new file mode 100755 index 000000000..b6ad8d201 --- /dev/null +++ b/warehouse_reports/report/ir_action_reports.xml @@ -0,0 +1,43 @@ + + + + + Stock Valuation Report + stock.valuation.report + qweb-pdf + warehouse_reports.report_stock_valuation + warehouse_reports.report_stock_valuation + + report + + + + Stock Move Report + stock.move.report + qweb-pdf + warehouse_reports.report_stock_move + warehouse_reports.report_stock_move + + report + + + + Stock Transfer Report + stock.transfer.report + qweb-pdf + warehouse_reports.report_stock_transfer + warehouse_reports.report_stock_transfer + + report + + + + Stock Product Report + stock.product.report + qweb-pdf + warehouse_reports.report_stock_product + warehouse_reports.report_stock_product + + report + + diff --git a/warehouse_reports/report/stock_move_report_templates.xml b/warehouse_reports/report/stock_move_report_templates.xml new file mode 100755 index 000000000..e9f9b9a34 --- /dev/null +++ b/warehouse_reports/report/stock_move_report_templates.xml @@ -0,0 +1,98 @@ + + + + + diff --git a/warehouse_reports/report/stock_product_report_templates.xml b/warehouse_reports/report/stock_product_report_templates.xml new file mode 100755 index 000000000..92c5077de --- /dev/null +++ b/warehouse_reports/report/stock_product_report_templates.xml @@ -0,0 +1,93 @@ + + + + + diff --git a/warehouse_reports/report/stock_transfer_report_templates.xml b/warehouse_reports/report/stock_transfer_report_templates.xml new file mode 100755 index 000000000..66665cdd9 --- /dev/null +++ b/warehouse_reports/report/stock_transfer_report_templates.xml @@ -0,0 +1,113 @@ + + + + + diff --git a/warehouse_reports/report/stock_valuation_report_templates.xml b/warehouse_reports/report/stock_valuation_report_templates.xml new file mode 100755 index 000000000..07e552766 --- /dev/null +++ b/warehouse_reports/report/stock_valuation_report_templates.xml @@ -0,0 +1,103 @@ + + + + + diff --git a/warehouse_reports/security/ir.model.access.csv b/warehouse_reports/security/ir.model.access.csv new file mode 100755 index 000000000..3ab07d587 --- /dev/null +++ b/warehouse_reports/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_stock_valuation_report,access.stock.valuation.report,model_stock_valuation_report,base.group_user,1,1,1,1 +access_stock_move_report,access.stock.move.report,model_stock_move_report,base.group_user,1,1,1,1 +access_stock_transfer_report,access.stock.transfer.report,model_stock_transfer_report,base.group_user,1,1,1,1 +access_stock_product_report,access.stock.product.report,model_stock_product_report,base.group_user,1,1,1,1 diff --git a/warehouse_reports/static/description/assets/icons/check.png b/warehouse_reports/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/check.png differ diff --git a/warehouse_reports/static/description/assets/icons/chevron.png b/warehouse_reports/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/chevron.png differ diff --git a/warehouse_reports/static/description/assets/icons/cogs.png b/warehouse_reports/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/cogs.png differ diff --git a/warehouse_reports/static/description/assets/icons/consultation.png b/warehouse_reports/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/consultation.png differ diff --git a/warehouse_reports/static/description/assets/icons/ecom-black.png b/warehouse_reports/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/ecom-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/education-black.png b/warehouse_reports/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/education-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/hotel-black.png b/warehouse_reports/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/hotel-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/license.png b/warehouse_reports/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/license.png differ diff --git a/warehouse_reports/static/description/assets/icons/lifebuoy.png b/warehouse_reports/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/lifebuoy.png differ diff --git a/warehouse_reports/static/description/assets/icons/manufacturing-black.png b/warehouse_reports/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/manufacturing-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/pos-black.png b/warehouse_reports/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/pos-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/puzzle.png b/warehouse_reports/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/puzzle.png differ diff --git a/warehouse_reports/static/description/assets/icons/restaurant-black.png b/warehouse_reports/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/restaurant-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/service-black.png b/warehouse_reports/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/service-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/trading-black.png b/warehouse_reports/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/trading-black.png differ diff --git a/warehouse_reports/static/description/assets/icons/training.png b/warehouse_reports/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/training.png differ diff --git a/warehouse_reports/static/description/assets/icons/update.png b/warehouse_reports/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/update.png differ diff --git a/warehouse_reports/static/description/assets/icons/user.png b/warehouse_reports/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/user.png differ diff --git a/warehouse_reports/static/description/assets/icons/wrench.png b/warehouse_reports/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/warehouse_reports/static/description/assets/icons/wrench.png differ diff --git a/warehouse_reports/static/description/assets/misc/Cybrosys R.png b/warehouse_reports/static/description/assets/misc/Cybrosys R.png new file mode 100755 index 000000000..da4058087 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/Cybrosys R.png differ diff --git a/warehouse_reports/static/description/assets/misc/categories.png b/warehouse_reports/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/categories.png differ diff --git a/warehouse_reports/static/description/assets/misc/check-box.png b/warehouse_reports/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/check-box.png differ diff --git a/warehouse_reports/static/description/assets/misc/compass.png b/warehouse_reports/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/compass.png differ diff --git a/warehouse_reports/static/description/assets/misc/corporate.png b/warehouse_reports/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/corporate.png differ diff --git a/warehouse_reports/static/description/assets/misc/customer-support.png b/warehouse_reports/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/customer-support.png differ diff --git a/warehouse_reports/static/description/assets/misc/cybrosys-logo.png b/warehouse_reports/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/cybrosys-logo.png differ diff --git a/warehouse_reports/static/description/assets/misc/email.svg b/warehouse_reports/static/description/assets/misc/email.svg new file mode 100755 index 000000000..15291cdc3 --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/warehouse_reports/static/description/assets/misc/features.png b/warehouse_reports/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/features.png differ diff --git a/warehouse_reports/static/description/assets/misc/logo.png b/warehouse_reports/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/logo.png differ diff --git a/warehouse_reports/static/description/assets/misc/phone.svg b/warehouse_reports/static/description/assets/misc/phone.svg new file mode 100755 index 000000000..b7bd7f251 --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/warehouse_reports/static/description/assets/misc/pictures.png b/warehouse_reports/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/pictures.png differ diff --git a/warehouse_reports/static/description/assets/misc/pie-chart.png b/warehouse_reports/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/pie-chart.png differ diff --git a/warehouse_reports/static/description/assets/misc/right-arrow.png b/warehouse_reports/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/right-arrow.png differ diff --git a/warehouse_reports/static/description/assets/misc/star (1) 2.svg b/warehouse_reports/static/description/assets/misc/star (1) 2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/warehouse_reports/static/description/assets/misc/star.png b/warehouse_reports/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/star.png differ diff --git a/warehouse_reports/static/description/assets/misc/support (1) 1.svg b/warehouse_reports/static/description/assets/misc/support (1) 1.svg new file mode 100755 index 000000000..7d37a8f30 --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/warehouse_reports/static/description/assets/misc/support-email.svg b/warehouse_reports/static/description/assets/misc/support-email.svg new file mode 100755 index 000000000..eb70370d6 --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/warehouse_reports/static/description/assets/misc/support.png b/warehouse_reports/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/support.png differ diff --git a/warehouse_reports/static/description/assets/misc/tick-mark.svg b/warehouse_reports/static/description/assets/misc/tick-mark.svg new file mode 100755 index 000000000..2dbb40187 --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/warehouse_reports/static/description/assets/misc/whatsapp 1.svg b/warehouse_reports/static/description/assets/misc/whatsapp 1.svg new file mode 100755 index 000000000..0bfaf8fc6 --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/warehouse_reports/static/description/assets/misc/whatsapp.png b/warehouse_reports/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/warehouse_reports/static/description/assets/misc/whatsapp.png differ diff --git a/warehouse_reports/static/description/assets/misc/whatsapp.svg b/warehouse_reports/static/description/assets/misc/whatsapp.svg new file mode 100755 index 000000000..b618aea1d --- /dev/null +++ b/warehouse_reports/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/warehouse_reports/static/description/assets/modules/1.png b/warehouse_reports/static/description/assets/modules/1.png new file mode 100755 index 000000000..612be4b77 Binary files /dev/null and b/warehouse_reports/static/description/assets/modules/1.png differ diff --git a/warehouse_reports/static/description/assets/modules/2.png b/warehouse_reports/static/description/assets/modules/2.png new file mode 100755 index 000000000..69d47fc7d Binary files /dev/null and b/warehouse_reports/static/description/assets/modules/2.png differ diff --git a/warehouse_reports/static/description/assets/modules/3.jpg b/warehouse_reports/static/description/assets/modules/3.jpg new file mode 100755 index 000000000..96f7cf8b9 Binary files /dev/null and b/warehouse_reports/static/description/assets/modules/3.jpg differ diff --git a/warehouse_reports/static/description/assets/modules/4.jpg b/warehouse_reports/static/description/assets/modules/4.jpg new file mode 100755 index 000000000..097d94b44 Binary files /dev/null and b/warehouse_reports/static/description/assets/modules/4.jpg differ diff --git a/warehouse_reports/static/description/assets/modules/5.jpg b/warehouse_reports/static/description/assets/modules/5.jpg new file mode 100755 index 000000000..0cbac311c Binary files /dev/null and b/warehouse_reports/static/description/assets/modules/5.jpg differ diff --git a/warehouse_reports/static/description/assets/modules/6.png b/warehouse_reports/static/description/assets/modules/6.png new file mode 100755 index 000000000..2cd293552 Binary files /dev/null and b/warehouse_reports/static/description/assets/modules/6.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot1.png b/warehouse_reports/static/description/assets/screenshots/Screenshot1.png new file mode 100755 index 000000000..3ef6b45a2 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot1.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot10.png b/warehouse_reports/static/description/assets/screenshots/Screenshot10.png new file mode 100644 index 000000000..1a886fc78 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot10.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot11.png b/warehouse_reports/static/description/assets/screenshots/Screenshot11.png new file mode 100644 index 000000000..a6f1495c8 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot11.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot12.png b/warehouse_reports/static/description/assets/screenshots/Screenshot12.png new file mode 100644 index 000000000..11756759a Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot12.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot13.png b/warehouse_reports/static/description/assets/screenshots/Screenshot13.png new file mode 100644 index 000000000..b6036154a Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot13.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot14.png b/warehouse_reports/static/description/assets/screenshots/Screenshot14.png new file mode 100644 index 000000000..299a3f724 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot14.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot15.png b/warehouse_reports/static/description/assets/screenshots/Screenshot15.png new file mode 100644 index 000000000..9dee6125b Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot15.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot2.png b/warehouse_reports/static/description/assets/screenshots/Screenshot2.png new file mode 100755 index 000000000..7f156a32a Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot2.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot3.png b/warehouse_reports/static/description/assets/screenshots/Screenshot3.png new file mode 100755 index 000000000..bfffe85ad Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot3.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot4.png b/warehouse_reports/static/description/assets/screenshots/Screenshot4.png new file mode 100755 index 000000000..4ae6a5b68 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot4.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot5.png b/warehouse_reports/static/description/assets/screenshots/Screenshot5.png new file mode 100644 index 000000000..8309820f2 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot5.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot6.png b/warehouse_reports/static/description/assets/screenshots/Screenshot6.png new file mode 100644 index 000000000..da2432636 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot6.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot7.png b/warehouse_reports/static/description/assets/screenshots/Screenshot7.png new file mode 100644 index 000000000..12c39fe5b Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot7.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot8.png b/warehouse_reports/static/description/assets/screenshots/Screenshot8.png new file mode 100644 index 000000000..0399b9c17 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot8.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/Screenshot9.png b/warehouse_reports/static/description/assets/screenshots/Screenshot9.png new file mode 100644 index 000000000..662f2f39f Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/Screenshot9.png differ diff --git a/warehouse_reports/static/description/assets/screenshots/hero-v17.gif b/warehouse_reports/static/description/assets/screenshots/hero-v17.gif new file mode 100644 index 000000000..38701a437 Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/hero-v17.gif differ diff --git a/warehouse_reports/static/description/assets/screenshots/screenshot0.png b/warehouse_reports/static/description/assets/screenshots/screenshot0.png new file mode 100755 index 000000000..c9bd096ab Binary files /dev/null and b/warehouse_reports/static/description/assets/screenshots/screenshot0.png differ diff --git a/warehouse_reports/static/description/banner.jpg b/warehouse_reports/static/description/banner.jpg new file mode 100644 index 000000000..ed0195a43 Binary files /dev/null and b/warehouse_reports/static/description/banner.jpg differ diff --git a/warehouse_reports/static/description/icon.png b/warehouse_reports/static/description/icon.png new file mode 100644 index 000000000..9b00c8220 Binary files /dev/null and b/warehouse_reports/static/description/icon.png differ diff --git a/warehouse_reports/static/description/index.html b/warehouse_reports/static/description/index.html new file mode 100755 index 000000000..039c26c6f --- /dev/null +++ b/warehouse_reports/static/description/index.html @@ -0,0 +1,874 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+
+

+ Warehouse Reports +

+

+ PDF and Excel Report of the Stock Move,Product,Transfer and Stock Valuation

+ +
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Community & Enterprise Support. +

+
+
+
+
+
+
+ +
+
+

+ Warehouse reports.

+
+
+
+
+
+
+ +
+
+

+ Print both excel and pdf report of different stock models.

+
+
+
+
+
+
+ +
+
+

+ Various filter option for getting data in the report.

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

+ Warehouse Report Menu.

+

+ Go to Inventory -> Warehouse Report -> + by clicking warehouse report we can get warehouse report submenus

+
+
+ + +
+
+
+
+
+
+

+ Stock Report

+

+ Go to Inventory -> Warehouse Report -> + by clicking Warehouse Report we can get warehouse report submenus click on Stock Report +

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

+ Stock Excel and Pdf Report

+

+ By clicking PRINT XLS or PRINT PDF by adding the filters we can get pdf/excel report +

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

+ Stock Transfer Report

+

+ Go to Inventory -> Warehouse Report -> + by clicking warehouse report we can get warehouse report submenus click on the Stock Transfer Report +

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

+ Stock Transfer Pdf and Excel Reports

+

+ By clicking PRINT XLS or PRINT PDF by adding the filters we can get stock transfer pdf/excel report +

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

+ Stock Move Report

+

+ Go to Inventory -> Warehouse Report -> + by clicking Warehouse Report we can get warehouse report submenus click on the Stock Move Report +

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

+ Stock Move Pdf and Excel Report

+

+ By clicking PRINT XLS or PRINT PDF by adding the filters we can get stock move pdf/excel report +

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

+ Stock Valuation Pdf and Excel Reports

+

+ By clicking PRINT XLS or PRINT PDF by adding the filters we can get stock valuation pdf/excel report +

+
+
+ + +
+
+ +
+
+ +
+
+
+ +
+
+
    +
  • + Community & Enterprise Support. +
  • +
  • + Warehouse reports. +
  • +
  • + Print both excel and pdf report of different stock models. +
  • +
  • + Various filter option for getting data in the report. +
  • +
  • + Easy way to get product stock information. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:16th August 2024 +
+

+ Initial commit for Warehouse Reports.

+
+
+
+
+
+
+
+

+ 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/warehouse_reports/static/src/js/stock_excel_report.js b/warehouse_reports/static/src/js/stock_excel_report.js new file mode 100755 index 000000000..ab29ad267 --- /dev/null +++ b/warehouse_reports/static/src/js/stock_excel_report.js @@ -0,0 +1,16 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { BlockUI } from "@web/core/ui/block_ui"; +import { download } from "@web/core/network/download"; + +registry.category("ir.actions.report handlers").add("qwerty_xlsx", async(action) => { + if (action.report_type === 'xlsx') { + BlockUI; + await download({ + url: '/xlsx_reports', + data: action.data, + complete: () => unblockUI, + error: (error) => self.call('crash_manager', 'rpc_error', error), + }); + } +}); \ No newline at end of file diff --git a/warehouse_reports/views/warehouse_reports_menus.xml b/warehouse_reports/views/warehouse_reports_menus.xml new file mode 100755 index 000000000..29cbcfd9b --- /dev/null +++ b/warehouse_reports/views/warehouse_reports_menus.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/warehouse_reports/wizards/__init__.py b/warehouse_reports/wizards/__init__.py new file mode 100755 index 000000000..f083dd2f6 --- /dev/null +++ b/warehouse_reports/wizards/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import stock_move_report +from . import stock_product_report +from . import stock_transfer_report +from . import stock_valuation_report diff --git a/warehouse_reports/wizards/stock_move_report.py b/warehouse_reports/wizards/stock_move_report.py new file mode 100755 index 000000000..1efe5bd5c --- /dev/null +++ b/warehouse_reports/wizards/stock_move_report.py @@ -0,0 +1,322 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import io +import json +import xlsxwriter +from odoo import fields, models +from odoo.tools import date_utils + + +class StockMoveReport(models.TransientModel): + """ Wizard for printing stock move report.We can filter data by + product,location,product category etc.""" + _name = "stock.move.report" + _description = "Stock Move Report" + + product_id = fields.Many2one('product.product', string='Product', + help='To pick the product') + location_id = fields.Many2one('stock.location', string='Location', + help='Pick stock location') + product_category_id = fields.Many2one('product.category', + string='Product Category', required=True, + help='To pick product_category') + from_date = fields.Datetime(string="Date from", + help='Stock move start from date', + required=True, default=fields.Datetime.now()) + to_date = fields.Datetime(string='To date', help='Stock move end date', + required=True, default=fields.Datetime.now()) + company_id = fields.Many2one('res.company', string="Company", + help="For adding company details", + default=lambda self: self.env.company) + + def action_print_pdf_report(self): + """ Function to print pdf report data filtered and passed to + the template""" + state = {'draft': 'New', 'cancel': 'cancelled', + 'waiting': 'Waiting Another Move', + 'confirmed': 'Waiting Availability', + 'partially_available': 'Partially Available', + 'assigned': 'Available', 'done': 'Done'} + lang = f"'{self.env.context['lang']}'" + query = """ WITH RECURSIVE CategoryHierarchy AS (SELECT id,name, + parent_id,complete_name FROM product_category WHERE + id = '{}' UNION ALL SELECT c.id, c.name, c.parent_id, + c.complete_name FROM product_category c JOIN + CategoryHierarchy ch ON c.parent_id = ch.id) + SELECT stock_move.date, stock_move.reference, + product_template.name, stock_location.complete_name, + product_category.complete_name as category_name, + stock_move.product_uom_qty,res_company.name, + stock_move.state,product_template.name->>{} as product_name + FROM stock_move JOIN product_product ON + stock_move.product_id = product_product.id + JOIN stock_location ON + stock_move.location_id = stock_location.id + JOIN product_template ON + product_product.product_tmpl_id = product_template.id + JOIN product_category ON + product_template.categ_id = product_category.id + JOIN res_company ON + stock_move.company_id = res_company.id WHERE + product_category.id IN (SELECT id FROM CategoryHierarchy)""".format( + self.product_category_id.id, lang) + product_id = self.product_id.id + location_id = self.location_id.id + company_id = self.company_id.id + from_date = self.from_date + to_date = self.to_date + if self.product_id and self.location_id and self.company_id and \ + self.from_date and self.to_date: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' + and stock_move.date >='{}' and + stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, from_date, + to_date)) + elif self.product_id and self.location_id and self.company_id and self.from_date: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' + and stock_move.date >='{}' and + stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, + from_date, to_date)) + elif self.product_id and self.location_id and self.company_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' and stock_move.date >='{}' and + stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, + from_date, to_date)) + elif self.product_id and self.location_id and self.company_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' + and stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, from_date, + to_date)) + elif self.company_id and self.location_id: + self.env.cr.execute( + """{}and stock_move.company_id = '{}' and stock_move.location_id = '{}' + and stock_move.date <='{}' and stock_move.date<'{}'""".format( + query, company_id, location_id, from_date, + to_date)) + elif self.product_id and self.location_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}'""".format( + query, product_id, location_id, from_date, to_date)) + elif self.product_id and self.company_id.id: + self.env.cr.execute( + """{} and stock_move.company_id={} and product_template.id={} and + stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, + company_id, product_id, from_date, to_date)) + elif self.product_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, product_id, from_date, to_date)) + elif self.company_id: + self.env.cr.execute( + """{}and stock_move.company_id='{}' and + stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, company_id, from_date, to_date)) + else: + self.env.cr.execute("""{}""".format(query)) + stock_move = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'location': self.location_id.complete_name, + 'Product Category': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_move': stock_move, + 'status': state + } + return self.env.ref( + 'warehouse_reports.stock_move_report').report_action( + None, data=data) + + def action_print_xls_report(self): + """ Function to filter and pass values to the Excel report template""" + lang = f"'{self.env.context['lang']}'" + query = """ WITH RECURSIVE CategoryHierarchy AS (SELECT id,name, + parent_id,complete_name FROM product_category WHERE + id = '{}' UNION ALL SELECT c.id, c.name, c.parent_id, + c.complete_name FROM product_category c JOIN + CategoryHierarchy ch ON c.parent_id = ch.id) + SELECT stock_move.date, stock_move.reference, + product_template.name, stock_location.complete_name, + product_category.complete_name as category_name, + stock_move.product_uom_qty,res_company.name, + stock_move.state,product_template.name->>{} as product_name + FROM stock_move JOIN product_product ON + stock_move.product_id = product_product.id + JOIN stock_location ON + stock_move.location_id = stock_location.id + JOIN product_template ON + product_product.product_tmpl_id = product_template.id + JOIN product_category ON + product_template.categ_id = product_category.id + JOIN res_company ON + stock_move.company_id = res_company.id WHERE + product_category.id IN (SELECT id FROM CategoryHierarchy)""".format( + self.product_category_id.id, lang) + product_id = self.product_id.id + location_id = self.location_id.id + company_id = self.company_id.id + from_date = self.from_date + to_date = self.to_date + if self.product_id and self.location_id and self.company_id and \ + self.from_date and self.to_date: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' + and stock_move.date >='{}' and + stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, from_date, + to_date)) + elif self.product_id and self.location_id and self.company_id and self.from_date: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' + and stock_move.date >='{}' and + stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, + from_date, to_date)) + elif self.product_id and self.location_id and self.company_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' and stock_move.date >='{}' and + stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, + from_date, to_date)) + elif self.product_id and self.location_id and self.company_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}' and stock_move.company_id = '{}' + and stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, product_id, location_id, company_id, from_date, + to_date)) + elif self.company_id and self.location_id: + self.env.cr.execute( + """{}and stock_move.company_id = '{}' and stock_move.location_id = '{}' + and stock_move.date <='{}' and stock_move.date<'{}'""".format( + query, company_id, location_id, from_date, + to_date)) + elif self.product_id and self.location_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.location_id ='{}'""".format( + query, product_id, location_id, from_date, to_date)) + elif self.product_id and self.company_id.id: + self.env.cr.execute( + """{} and stock_move.company_id={} and product_template.id={} and + stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, + company_id, product_id, from_date, to_date)) + elif self.product_id: + self.env.cr.execute( + """{}and stock_move.product_id='{}' and + stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, product_id, from_date, to_date)) + elif self.company_id: + self.env.cr.execute( + """{}and stock_move.company_id='{}' and + stock_move.date >='{}' and stock_move.date<'{}'""".format( + query, company_id, from_date, to_date)) + else: + self.env.cr.execute("""{}""".format(query)) + stock_move = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'location': self.location_id.complete_name, + 'Product Category': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_move': stock_move + } + return { + 'type': 'ir.actions.report', + 'report_type': 'xlsx', + 'data': {'model': 'stock.move.report', + 'output_format': 'xlsx', + 'options': json.dumps(data, + default=date_utils.json_default), + 'report_name': 'Stock Move report'} + } + + def get_xlsx_report(self, data, response): + """ Function to print excel report customize the Excel file for + print data + :param data :Dictionary contains results + :param response : Response from the controller""" + state = {'draft': 'New', 'cancel': 'cancelled', + 'waiting': 'Waiting Another Move', + 'confirmed': 'Waiting Availability', + 'partially_available': 'Partially Available', + 'assigned': 'Available', 'done': 'Done'} + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px'}) + txt = workbook.add_format({'align': 'center'}) + sheet.set_column(0, 8, 24) + sheet.merge_range('B2:D3', 'STOCK MOVE REPORT', head) + sheet.merge_range('B4:D4', data['company_name'], txt) + sheet.write('A8', 'SL No.', txt) + sheet.write('B8', 'Date', txt) + sheet.write('C8', 'Reference', txt) + sheet.write('D8', 'Product', txt) + sheet.write('E8', 'Location', txt) + sheet.write('F8', 'Quantity', txt) + sheet.write('G8', 'Company', txt) + sheet.write('H8', 'Product Category', txt) + sheet.write('I8', 'Status', txt) + records = data['stock_move'] + row = 9 + flag = 1 + for record in records: + sheet.write(row, 0, flag, txt) + sheet.write(row, 1, record['date']) + sheet.write(row, 2, record['reference']) + sheet.write(row, 3, record['product_name']) + sheet.write(row, 4, record['complete_name']) + sheet.write(row, 5, record['product_uom_qty'], txt) + sheet.write(row, 6, record['name']) + sheet.write(row, 7, record['category_name']) + sheet.write(row, 8, state[record['state']], txt) + flag += 1 + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/warehouse_reports/wizards/stock_move_report_views.xml b/warehouse_reports/wizards/stock_move_report_views.xml new file mode 100755 index 000000000..e9ee84d05 --- /dev/null +++ b/warehouse_reports/wizards/stock_move_report_views.xml @@ -0,0 +1,45 @@ + + + + + stock.move.report.view.form + stock.move.report + +
+ + + + + + + + + + + + + + +
+
+
+
+
+ + + Stock Move Report + stock.move.report + form + new + +

+ Stock Move Report +

+
+
+
diff --git a/warehouse_reports/wizards/stock_product_report.py b/warehouse_reports/wizards/stock_product_report.py new file mode 100755 index 000000000..311e02351 --- /dev/null +++ b/warehouse_reports/wizards/stock_product_report.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import io +import json +import xlsxwriter +from odoo import fields, models +from odoo.tools import date_utils + + +class StockProductReport(models.TransientModel): + """ Wizard for printing product report.Both excel and pdf can be print + by filtering the data""" + _name = "stock.product.report" + _description = "Stock Product Report" + + product_id = fields.Many2one('product.product', string="Product", + help='Used to select product') + product_category_id = fields.Many2one('product.category', required=True, + string="Product Category", + help="To pick the product category") + company_id = fields.Many2one('res.company', string='Company', + default=lambda self: self.env.company, + help='To pick the company') + from_date = fields.Datetime(string="Date from", + help='Stock move start from') + to_date = fields.Datetime(string='To date', help='Stock move end') + + def action_print_pdf_report(self): + """ Function to print pdf report passing value to the pdf report""" + lang = f"'{self.env.context['lang']}'" + query = """WITH RECURSIVE CategoryHierarchy AS (SELECT id,name,parent_id + FROM product_category WHERE id = {} UNION ALL SELECT c.id, c.name, + c.parent_id FROM product_category c JOIN CategoryHierarchy ch ON + c.parent_id = ch.id) SELECT CategoryHierarchy.id as category_id, + CategoryHierarchy.name as category_name, + product_template.name->>{} as product_name, + product_product.outgoing_qty, + product_product.incoming_qty, + product_product.free_qty, + product_product.qty_available + FROM CategoryHierarchy + JOIN product_category on CategoryHierarchy.id = product_category.id + JOIN product_template on product_category.id = product_template.categ_id + JOIN product_product on product_template.id = product_product.product_tmpl_id""".format( + self.product_category_id.id, lang) + product_id = self.product_id.id + if self.product_id: + self.env.cr.execute( + """{} and product_product.id = '{}' """.format( + query, product_id)) + else: + self.env.cr.execute("""{}""".format(query)) + stock_product = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'Product Category': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_product': stock_product + } + return self.env.ref( + 'warehouse_reports.stock_product_report').report_action( + None, data=data) + + def action_print_xls_report(self): + """ function to pass data to Excel report""" + lang = f"'{self.env.context['lang']}'" + query = """WITH RECURSIVE CategoryHierarchy AS (SELECT id,name,parent_id + FROM product_category WHERE id = {} UNION ALL SELECT c.id, + c.name, c.parent_id FROM product_category c + JOIN CategoryHierarchy ch ON c.parent_id = ch.id) SELECT + CategoryHierarchy.id as category_id, + CategoryHierarchy.name as category_name, + product_template.name->>{} as product_name, + product_product.outgoing_qty, + product_product.incoming_qty, + product_product.free_qty, + product_product.qty_available + FROM CategoryHierarchy + JOIN product_category on CategoryHierarchy.id = product_category.id + JOIN product_template on product_category.id = product_template.categ_id + JOIN product_product on product_template.id = product_product.product_tmpl_id""".format( + self.product_category_id.id, lang) + product_id = self.product_id.id + + if self.product_id: + self.env.cr.execute( + """{} and product_product.id = '{}' """.format( + query, product_id)) + else: + self.env.cr.execute("""{}""".format(query)) + stock_product = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'Product Category': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_product': stock_product, + } + return { + 'type': 'ir.actions.report', + 'report_type': 'xlsx', + 'data': {'model': 'stock.product.report', + 'output_format': 'xlsx', + 'options': json.dumps(data, + default=date_utils.json_default), + 'report_name': 'Stock Product Report'}} + + def get_xlsx_report(self, data, response): + """ function to print Excel report and customising the Excel file + :param data :Dictionary contains results + :param response : Response from the controller""" + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + sheet.set_column(0, 8, 24) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px'}) + txt = workbook.add_format({'align': 'center'}) + sheet.merge_range('B2:D3', 'STOCK REPORT', head) + sheet.merge_range('B4:D4', data['company_name'], txt) + sheet.write('A8', 'SL No.', txt) + sheet.write('B8', 'Product Name', txt) + sheet.write('C8', 'Product Category', txt) + sheet.write('D8', 'On Hand Quantity', txt) + sheet.write('E8', 'Quantity Unreserved', txt) + sheet.write('F8', 'Incoming Quantity', txt) + sheet.write('G8', 'Outgoing Quantity', txt) + records = data['stock_product'] + row = 9 + flag = 1 + for record in records: + sheet.write(row, 0, flag, txt) + sheet.write(row, 1, record['product_name'], txt) + sheet.write(row, 2, record['category_name'], txt) + sheet.write(row, 3, record['qty_available'], txt) + sheet.write(row, 4, record['free_qty'], txt) + sheet.write(row, 5, record['incoming_qty'], txt) + sheet.write(row, 6, record['outgoing_qty'], txt) + flag += 1 + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/warehouse_reports/wizards/stock_product_report_views.xml b/warehouse_reports/wizards/stock_product_report_views.xml new file mode 100755 index 000000000..9145c50b3 --- /dev/null +++ b/warehouse_reports/wizards/stock_product_report_views.xml @@ -0,0 +1,41 @@ + + + + + stock.product.report.view.form + stock.product.report + +
+ + + + + + + + + + +
+
+
+
+
+ + + Stock Product Report + stock.product.report + form + new + +

+ Stock product Report +

+
+
+
diff --git a/warehouse_reports/wizards/stock_transfer_report.py b/warehouse_reports/wizards/stock_transfer_report.py new file mode 100755 index 000000000..2ed06610f --- /dev/null +++ b/warehouse_reports/wizards/stock_transfer_report.py @@ -0,0 +1,517 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import io +import json +import xlsxwriter +from odoo import fields, models +from odoo.tools import date_utils + + +class StockTransferReport(models.TransientModel): + """ Wizard to getting the stock transfer reports.We can get both Pdf and + Excel report """ + _name = "stock.transfer.report" + _description = "Stock Transfer Report" + + product_id = fields.Many2one('product.product', string='Product', + help='To pick the product') + location_id = fields.Many2one('stock.location', string='Location', + help='Pick stock location') + product_category_id = fields.Many2one('product.category', required=True, + string='Product Category', + help='To pick product_category') + picking_type_id = fields.Many2one('stock.picking.type', + string="Operation Type", + help='To select the operation type') + partner_id = fields.Many2one('res.partner', string='Customer/Vendor', + help='To pick the vendor/customer') + from_date = fields.Datetime(string="Date from", + help='Stock move start from', + required=True, default=fields.Datetime.now()) + to_date = fields.Datetime(string='To date', help='Stock move end', + required=True, default=fields.Datetime.now()) + company_id = fields.Many2one('res.company', string='Company Name', + default=lambda self: self.env.company, + help='To pick company') + + def action_print_pdf_report(self): + """ function to print pdf report .Value passed to the pdf template""" + state = {'draft': 'Draft', 'waiting': 'Waiting Another Operation', + 'confirmed': 'Waiting', 'assigned': 'Ready', 'done': 'Done', + 'cancel': 'Cancelled'} + lang = f"'{self.env.context['lang']}'" + query = """WITH RECURSIVE CategoryHierarchy AS (SELECT id,name,parent_id + FROM product_category WHERE id = {} UNION ALL + SELECT c.id,c.name, c.parent_id FROM + product_category c JOIN CategoryHierarchy ch ON + c.parent_id = ch.id) SELECT CategoryHierarchy.id + as category_id, CategoryHierarchy.name as + category_name, stock_picking.name as picking_name, + product_template.name->>{} as product_name, + stock_picking.scheduled_date, stock_picking.date_deadline, + stock_picking.date_done, stock_picking.origin, + stock_location.complete_name,stock_picking_type.display_name, + res_company.name as company_name,stock_picking.state + FROM CategoryHierarchy + JOIN product_category on CategoryHierarchy.id = + product_category.id JOIN product_template on + product_category.id = product_template.categ_id + JOIN product_product on product_template.id = + product_product.product_tmpl_id JOIN stock_move on + product_product.id = stock_move.product_id + JOIN stock_picking on stock_move.picking_id = + stock_picking.id JOIN stock_picking_type on + stock_picking.picking_type_id = stock_picking_type.id + JOIN res_company on stock_picking.company_id = + res_company.id JOIN stock_location on + stock_move.location_id = stock_location.id""".format( + self.product_category_id.id, lang) + product_id = self.product_id.id + location_id = self.location_id.id + from_date = self.from_date + to_date = self.to_date + company_id = self.company_id.id + partner_id = self.partner_id.id + picking_type_id = self.picking_type_id.id + if self.product_id and self.location_id and self.partner_id and picking_type_id: + self.env.cr.execute( + """{} and product_product.id = '{}' and + stock_picking.company_id ='{}' and + stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' and + stock_picking.partner_id = '{}' and + stock_picking.picking_type_id = '{}' """.format( + query, product_id, company_id, location_id, + from_date, to_date, partner_id, picking_type_id)) + elif self.product_id and self.location_id and self.partner_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id ='{}' + and stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' and + stock_picking.partner_id = '{}' """.format( + query, product_id, company_id, location_id, + from_date, to_date, partner_id)) + elif self.product_id and self.location_id and self.picking_type_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.picking_type_id + ='{}' and stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, picking_type_id, location_id, + from_date, to_date + )) + elif self.product_id and self.company_id and self.picking_type_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id ='{}' + and stock_picking.picking_type_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, picking_type_id, + from_date, to_date + )) + elif self.product_id and self.location_id and self.company_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id ='{}' + and stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, location_id, + from_date, to_date + )) + elif self.product_id and self.location_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_location.id ='{}' + and stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, location_id, from_date, + to_date)) + elif self.product_id and self.picking_type_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and + stock_picking.picking_type_id='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, picking_type_id, from_date, + to_date)) + elif self.product_id and self.company_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id + ='{}' and stock_picking.scheduled_date>='{}' + and stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, from_date, + to_date)) + elif self.product_id and self.company_id and self.location_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and + stock_picking.company_id ='{}' and stock_location.id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, location_id, from_date, + to_date)) + elif self.product_id and self.partner_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.partner_id + ='{}' and stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, partner_id, from_date, + to_date)) + elif self.product_id and self.partner_id and self.location_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and + stock_picking.partner_id ='{}' and stock_location.id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, partner_id, location_id, from_date, + to_date)) + elif self.company_id and self.location_id: + self.env.cr.execute( + """{} where stock_picking.company_id = '{}' and stock_location.id ='{}' + and stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, company_id, location_id, from_date, + to_date)) + elif self.partner_id and self.location_id: + self.env.cr.execute( + """{} where stock_picking.partner_id= '{}' and stock_location.id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, partner_id, location_id, from_date, + to_date)) + elif self.product_id and self.location_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}' and + stock_move.location_id = '{}'""".format(query, product_id, + location_id)) + elif self.product_id and self.partner_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}' and + stock_picking.partner_id = '{}'""".format(query, product_id, + partner_id)) + elif self.product_id and self.company_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}' and + stock_picking.company_id = '{}'""".format(query, product_id, + company_id)) + elif self.company_id and self.partner_id: + self.env.cr.execute( + """{} where stock_picking.company_id ='{}' and + stock_picking.partner_id = '{}'""".format(query, company_id, + partner_id)) + elif self.picking_type_id and self.company_id: + self.env.cr.execute( + """{} where stock_move.picking_type_id ='{}' and + stock_picking.company_id = '{}'""".format(query, + picking_type_id, + company_id)) + elif self.product_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}'""".format(query, + product_id)) + elif self.location_id: + self.env.cr.execute( + """{} where stock_move.location_id ='{}'""".format(query, + location_id)) + elif self.partner_id: + self.env.cr.execute( + """{} where stock_picking.partner_id ='{}'""".format(query, + partner_id)) + elif self.company_id: + self.env.cr.execute( + """{} where stock_picking.company_id ='{}'""".format(query, + company_id)) + else: + self.env.cr.execute("""{}""".format(query)) + stock_picking = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'location': self.location_id.complete_name, + 'Product Category': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_picking': stock_picking, + 'status': state + } + return self.env.ref( + 'warehouse_reports.stock_transfer_report').report_action( + None, data=data) + + def action_print_xls_report(self): + """ Function to pass data to the Excel file""" + lang = f"'{self.env.context['lang']}'" + query = """WITH RECURSIVE CategoryHierarchy AS (SELECT id,name,parent_id + FROM product_category WHERE id = {} UNION ALL + SELECT c.id,c.name, c.parent_id FROM + product_category c JOIN CategoryHierarchy ch ON + c.parent_id = ch.id) SELECT CategoryHierarchy.id + as category_id, CategoryHierarchy.name as + category_name, stock_picking.name as picking_name, + product_template.name->>{} as product_name, + stock_picking.scheduled_date, stock_picking.date_deadline, + stock_picking.date_done, stock_picking.origin, + stock_location.complete_name,stock_picking_type.display_name, + res_company.name as company_name,stock_picking.state + FROM CategoryHierarchy + JOIN product_category on CategoryHierarchy.id = + product_category.id JOIN product_template on + product_category.id = product_template.categ_id + JOIN product_product on product_template.id = + product_product.product_tmpl_id JOIN stock_move on + product_product.id = stock_move.product_id + JOIN stock_picking on stock_move.picking_id = + stock_picking.id JOIN stock_picking_type on + stock_picking.picking_type_id = stock_picking_type.id + JOIN res_company on stock_picking.company_id = + res_company.id JOIN stock_location on + stock_move.location_id = stock_location.id""".format( + self.product_category_id.id, lang) + product_id = self.product_id.id + location_id = self.location_id.id + from_date = self.from_date + to_date = self.to_date + company_id = self.company_id.id + partner_id = self.partner_id.id + picking_type_id = self.picking_type_id.id + if self.product_id and self.location_id and self.partner_id and picking_type_id: + self.env.cr.execute( + """{} and product_product.id = '{}' and + stock_picking.company_id ='{}' and + stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' and + stock_picking.partner_id = '{}' and + stock_picking.picking_type_id = '{}' """.format( + query, product_id, company_id, location_id, + from_date, to_date, partner_id, picking_type_id)) + elif self.product_id and self.location_id and self.partner_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id ='{}' + and stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' and + stock_picking.partner_id = '{}' """.format( + query, product_id, company_id, location_id, + from_date, to_date, partner_id)) + elif self.product_id and self.location_id and self.picking_type_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.picking_type_id + ='{}' and stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, picking_type_id, location_id, + from_date, to_date + )) + elif self.product_id and self.company_id and self.picking_type_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id ='{}' + and stock_picking.picking_type_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, picking_type_id, + from_date, to_date + )) + elif self.product_id and self.location_id and self.company_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id ='{}' + and stock_move.location_id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, location_id, + from_date, to_date + )) + elif self.product_id and self.location_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_location.id ='{}' + and stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, location_id, from_date, + to_date)) + elif self.product_id and self.picking_type_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and + stock_picking.picking_type_id='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, picking_type_id, from_date, + to_date)) + elif self.product_id and self.company_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.company_id + ='{}' and stock_picking.scheduled_date>='{}' + and stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, from_date, + to_date)) + elif self.product_id and self.company_id and self.location_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and + stock_picking.company_id ='{}' and stock_location.id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, company_id, location_id, from_date, + to_date)) + elif self.product_id and self.partner_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and stock_picking.partner_id + ='{}' and stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, partner_id, from_date, + to_date)) + elif self.product_id and self.partner_id and self.location_id: + self.env.cr.execute( + """{} where product_product.id = '{}' and + stock_picking.partner_id ='{}' and stock_location.id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, product_id, partner_id, location_id, from_date, + to_date)) + elif self.company_id and self.location_id: + self.env.cr.execute( + """{} where stock_picking.company_id = '{}' and stock_location.id ='{}' + and stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, company_id, location_id, from_date, + to_date)) + elif self.partner_id and self.location_id: + self.env.cr.execute( + """{} where stock_picking.partner_id= '{}' and stock_location.id ='{}' and + stock_picking.scheduled_date>='{}' and + stock_picking.scheduled_date >'{}' """.format( + query, partner_id, location_id, from_date, + to_date)) + elif self.product_id and self.location_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}' and + stock_move.location_id = '{}'""".format(query, product_id, + location_id)) + elif self.product_id and self.partner_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}' and + stock_picking.partner_id = '{}'""".format(query, product_id, + partner_id)) + elif self.product_id and self.company_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}' and + stock_picking.company_id = '{}'""".format(query, product_id, + company_id)) + elif self.company_id and self.partner_id: + self.env.cr.execute( + """{} where stock_picking.company_id ='{}' and + stock_picking.partner_id = '{}'""".format(query, company_id, + partner_id)) + elif self.picking_type_id and self.company_id: + self.env.cr.execute( + """{} where stock_move.picking_type_id ='{}' and + stock_picking.company_id = '{}'""".format(query, + picking_type_id, + company_id)) + elif self.product_id: + self.env.cr.execute( + """{} where stock_move.product_id ='{}'""".format(query, + product_id)) + elif self.location_id: + self.env.cr.execute( + """{} where stock_move.location_id ='{}'""".format(query, + location_id)) + elif self.partner_id: + self.env.cr.execute( + """{} where stock_picking.partner_id ='{}'""".format(query, + partner_id)) + elif self.company_id: + self.env.cr.execute( + """{} where stock_picking.company_id ='{}'""".format(query, + company_id)) + else: + self.env.cr.execute("""{}""".format(query)) + stock_picking = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'location': self.location_id.complete_name, + 'Product Category': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_picking': stock_picking, + } + return { + 'type': 'ir.actions.report', + 'report_type': 'xlsx', + 'data': {'model': 'stock.transfer.report', + 'output_format': 'xlsx', + 'options': json.dumps(data, + default=date_utils.json_default), + 'report_name': 'Stock Transfer Report'}} + + def get_xlsx_report(self, data, response): + """ Function to print excel file.Customizing Excel file and + adding data + :param data :Dictionary contains results + :param response : Response from the controller""" + state = {'draft': 'Draft', 'waiting': 'Waiting Another Operation', + 'confirmed': 'Waiting', 'assigned': 'Ready', 'done': 'Done', + 'cancel': 'Cancelled'} + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + sheet.set_column(0, 10, 24) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px'}) + txt = workbook.add_format({'align': 'center'}) + sheet.merge_range('B2:I3', 'STOCK TRANSFER REPORT', head) + sheet.merge_range('D4:F4', data['company_name'], txt) + sheet.write('A8', 'SL No.', txt) + sheet.write('B8', 'Reference', txt) + sheet.write('C8', 'Product', txt) + sheet.write('D8', 'scheduled Date', txt) + sheet.write('E8', 'Deadline', txt) + sheet.write('F8', 'Effective Date', txt) + sheet.write('G8', 'Source Document', txt) + sheet.write('H8', 'Location', txt) + sheet.write('I8', 'Operation Type', txt) + sheet.write('J8', 'Company Name', txt) + sheet.write('K8', 'Status', txt) + records = data['stock_picking'] + row = 9 + flag = 1 + for record in records: + sheet.write(row, 0, flag, txt) + sheet.write(row, 1, record['picking_name'], txt) + sheet.write(row, 2, record['product_name'], txt) + sheet.write(row, 3, record['scheduled_date'], txt) + sheet.write(row, 4, record['date_deadline'], txt) + sheet.write(row, 5, record['date_done'], txt) + sheet.write(row, 6, record['origin'], txt) + sheet.write(row, 7, record['complete_name'], txt) + sheet.write(row, 8, record['display_name'], txt) + sheet.write(row, 9, record['company_name'], txt) + sheet.write(row, 10, state[record['state']], txt) + flag += 1 + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/warehouse_reports/wizards/stock_transfer_report_views.xml b/warehouse_reports/wizards/stock_transfer_report_views.xml new file mode 100755 index 000000000..47a49608b --- /dev/null +++ b/warehouse_reports/wizards/stock_transfer_report_views.xml @@ -0,0 +1,47 @@ + + + + + stock.transfer.report.view.form + stock.transfer.report + +
+ + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Stock Transfer Report + stock.transfer.report + form + new + +

+ Stock Transfer Report +

+
+
+
diff --git a/warehouse_reports/wizards/stock_valuation_report.py b/warehouse_reports/wizards/stock_valuation_report.py new file mode 100755 index 000000000..fe542edfc --- /dev/null +++ b/warehouse_reports/wizards/stock_valuation_report.py @@ -0,0 +1,238 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import io +import json +import xlsxwriter +from odoo import fields, models +from odoo.exceptions import ValidationError +from odoo.tools import date_utils + + +class StockValuationReport(models.TransientModel): + """ Wizard for printing stock valuation report.We will get both excl + and pdf reports""" + _name = "stock.valuation.report" + _description = "Stock Valuation Report" + + product_id = fields.Many2one('product.product', string='Product', + help='To pick the product') + product_category_id = fields.Many2one('product.category', + string='Product Category', required=True, + help='To pick product_category') + from_Date = fields.Datetime(string='From Date', required=True, + default=fields.Datetime.now(), + help='For filtering data using from date') + to_date = fields.Datetime(string='To Date', required=True, + default=fields.Datetime.now(), + help='For filtering data using to date') + company_id = fields.Many2one('res.company', + default=lambda self: self.env.company) + + + def action_print_pdf_report(self): + """ Function to print pdf report.Passing data to pdf template""" + lang = f"'{self.env.context['lang']}'" + query = """ WITH RECURSIVE CategoryHierarchy AS ( SELECT id,name, + parent_id FROM product_category WHERE id = {} UNION ALL + SELECT c.id, c.name, c.parent_id FROM product_category c + JOIN CategoryHierarchy ch ON c.parent_id = ch.id) + SELECT CategoryHierarchy.id as category_id, + CategoryHierarchy.name as category_name, + stock_valuation_layer.create_date, product_template.name->>{} + as name, stock_valuation_layer.description, + product_category.complete_name,res_company.name as + company_name, quantity, stock_valuation_layer.unit_cost, + value FROM CategoryHierarchy JOIN product_category on + CategoryHierarchy.id = product_category.id JOIN + product_template on product_category.id = + product_template.categ_id JOIN product_product on + product_template.id = product_product.product_tmpl_id JOIN + stock_valuation_layer on product_product.id = + stock_valuation_layer.product_id JOIN res_company on + stock_valuation_layer.company_id = res_company.id + """.format(self.product_category_id.id, lang) + product_id = self.product_id.id + company_id = self.company_id.id + from_date = self.from_Date + to_date = self.to_date + if self.product_id and self.company_id: + self.env.cr.execute( + """{}where product_product.id='{}' and stock_valuation_layer.company_id + ='{}'""".format( + query, product_id, company_id, + )) + elif self.product_id and self.company_id: + self.env.cr.execute( + """{}where product_product.id='{}' and + stock_valuation_layer.company_id ='{}'""".format( + query, product_id, company_id)) + elif self.product_id: + self.env.cr.execute( + """{}where product_product.id='{}'""".format( + query, product_id)) + elif self.company_id: + self.env.cr.execute( + """{} where stock_valuation_layer.company_id='{}' """.format( + query, company_id)) + elif self.from_Date: + self.env.cr.execute( + """{} where stock_valuation_layer.create_date >= '{}' """.format(query,from_date)) + elif self.to_date: + self.env.cr.execute( + """{} where stock_valuation_layer.create_date <= '{}' """.format(query, to_date)) + if from_date and to_date: + if to_date < from_date: + raise ValidationError('Sorry, To Date Must be greater Than From Date...') + else: + self.env.cr.execute("""{}""".format(query)) + stock_valuation = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'vehicle_id': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_valuation': stock_valuation + } + return self.env.ref( + 'warehouse_reports.stock_valuation_report').report_action( + None, data=data) + + def action_print_xls_report(self): + """ Function to pass data to the Excel file""" + lang = f"'{self.env.context['lang']}'" + query = """ WITH RECURSIVE CategoryHierarchy AS ( SELECT id,name, + parent_id FROM product_category WHERE id = {} UNION ALL + SELECT c.id, c.name, c.parent_id FROM product_category c + JOIN CategoryHierarchy ch ON c.parent_id = ch.id) + SELECT CategoryHierarchy.id as category_id, + CategoryHierarchy.name as category_name, + stock_valuation_layer.create_date, product_template.name->>{} + as name, stock_valuation_layer.description, + product_category.complete_name,res_company.name as + company_name, quantity, stock_valuation_layer.unit_cost, + value FROM CategoryHierarchy JOIN product_category on + CategoryHierarchy.id = product_category.id JOIN + product_template on product_category.id = + product_template.categ_id JOIN product_product on + product_template.id = product_product.product_tmpl_id JOIN + stock_valuation_layer on product_product.id = + stock_valuation_layer.product_id JOIN res_company on + stock_valuation_layer.company_id = res_company.id + """.format(self.product_category_id.id, lang) + product_id = self.product_id.id + company_id = self.company_id.id + from_date = self.from_Date + to_date = self.to_date + if self.product_id and self.company_id: + self.env.cr.execute( + """{}where product_product.id='{}' and stock_valuation_layer.company_id + ='{}'""".format( + query, product_id, company_id, + )) + elif self.product_id and self.company_id: + self.env.cr.execute( + """{}where product_product.id='{}' and + stock_valuation_layer.company_id ='{}'""".format( + query, product_id, company_id)) + elif self.product_id: + self.env.cr.execute( + """{}where product_product.id='{}'""".format( + query, product_id)) + elif self.company_id: + self.env.cr.execute( + """{} where stock_valuation_layer.company_id='{}' """.format( + query, company_id)) + elif self.from_Date: + self.env.cr.execute( + """{} where stock_valuation_layer.create_date >= '{}' """.format(query, from_date)) + elif self.to_date: + self.env.cr.execute( + """{} where stock_valuation_layer.create_date <= '{}' """.format(query, to_date)) + if from_date and to_date: + if to_date < from_date: + raise ValidationError('Sorry, To Date Must be greater Than From Date...') + else: + self.env.cr.execute("""{}""".format(query)) + stock_valuation = self.env.cr.dictfetchall() + data = { + 'product_name': self.product_id.product_tmpl_id.name, + 'vehicle_id': self.product_category_id.display_name, + 'company_name': self.company_id.name, + 'company_street': self.company_id.street, + 'state': self.company_id.state_id.name, + 'country': self.company_id.country_id.name, + 'company_email': self.company_id.email, + 'stock_valuation': stock_valuation + } + return { + 'type': 'ir.actions.report', + 'report_type': 'xlsx', + 'data': {'model': 'stock.valuation.report', + 'output_format': 'xlsx', + 'options': json.dumps(data, + default=date_utils.json_default), + 'report_name': 'Stock valuation report'}} + + def get_xlsx_report(self, data, response): + """ Function to print excel report.Customizing excel file and added data + :param data :Dictionary contains results + :param response : Response from the controller""" + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + sheet.set_column(0, 10, 24) + head = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '20px'}) + txt = workbook.add_format({'align': 'center'}) + sheet.merge_range('C2:E3', 'STOCK VALUATION REPORT', head) + sheet.merge_range('C4:E4', data['company_name'], txt) + sheet.write('A8', 'SL No.', txt) + sheet.write('B8', 'Date', txt) + sheet.write('C8', 'Product Name', txt) + sheet.write('D8', 'Description', txt) + sheet.write('E8', 'Product Category', txt) + sheet.write('F8', 'Company Name', txt) + sheet.write('G8', 'Quantity', txt) + sheet.write('H8', 'Unit Cost', txt) + sheet.write('I8', 'Value', txt) + records = data['stock_valuation'] + row = 9 + flag = 1 + for record in records: + sheet.write(row, 0, flag, txt) + sheet.write(row, 1, record['create_date'], txt) + sheet.write(row, 2, record['name'], txt) + sheet.write(row, 3, record['description'], txt) + sheet.write(row, 4, record['complete_name'], txt) + sheet.write(row, 5, record['company_name'], txt) + sheet.write(row, 6, record['quantity'], txt) + sheet.write(row, 7, record['unit_cost'], txt) + sheet.write(row, 8, record['value'], txt) + flag += 1 + row += 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() \ No newline at end of file diff --git a/warehouse_reports/wizards/stock_valuation_report_views.xml b/warehouse_reports/wizards/stock_valuation_report_views.xml new file mode 100755 index 000000000..02bb445c3 --- /dev/null +++ b/warehouse_reports/wizards/stock_valuation_report_views.xml @@ -0,0 +1,44 @@ + + + + + stock.valuation.report.view.form + stock.valuation.report + +
+ + + + + + + + + + + + + +
+
+
+
+
+ + + Stock Valuation Report + stock.valuation.report + form + new + +

+ Stock Valuation Report +

+
+
+