diff --git a/sale_report_generator/README.rst b/sale_report_generator/README.rst new file mode 100644 index 000000000..a0a4032d9 --- /dev/null +++ b/sale_report_generator/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Sales All In One Report Generator +================================= +This module Helps to Generate All in One Dynamic Sale Report + +Configuration +============= +* No additional configurations needed + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer: (V17) Ayana KP, +Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. 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/sale_report_generator/__init__.py b/sale_report_generator/__init__.py new file mode 100644 index 000000000..6fbef8f6c --- /dev/null +++ b/sale_report_generator/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import controllers +from . import models +from . import report diff --git a/sale_report_generator/__manifest__.py b/sale_report_generator/__manifest__.py new file mode 100644 index 000000000..7124ba3ca --- /dev/null +++ b/sale_report_generator/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': 'Sales All In One Report Generator', + 'version': '17.0.1.0.0', + 'category': 'Sales', + 'summary': """This module Helps to Generate All in One Dynamic + Sale Report""", + 'description': """This module facilitates comprehensive Sale Reports, + offering insights into a company's procurement analysis from various + angles, including orders, order details, sales representatives, and the + ability to filter data by different date ranges.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['sale_management'], + 'data': [ + 'security/ir.model.access.csv', + 'report/sale_order_reports.xml', + 'report/sale_order_templates.xml', + 'views/sale_report_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'sale_report_generator/static/src/js/sale_report.js', + 'sale_report_generator/static/src/css/sale_report.css', + 'sale_report_generator/static/src/xml/sale_report_templates.xml', + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/sale_report_generator/controllers/__init__.py b/sale_report_generator/controllers/__init__.py new file mode 100644 index 000000000..49325620d --- /dev/null +++ b/sale_report_generator/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import sale_report_generator diff --git a/sale_report_generator/controllers/sale_report_generator.py b/sale_report_generator/controllers/sale_report_generator.py new file mode 100644 index 000000000..054542c6f --- /dev/null +++ b/sale_report_generator/controllers/sale_report_generator.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.tools import html_escape + + +class TBXLSXReport(http.Controller): + """Controller class to generate dynamic sale reports in Excel format. + Methods: + get_report_xlsx: Generate a dynamic sale report in Excel format and + send it as a response to a HTTP POST request. """ + @http.route('/sale_dynamic_xlsx_reports', type='http', auth='user', + methods=['POST'], csrf=False) + def get_report_xlsx(self, model, options, output_format, report_data, + report_name, dfr_data): + """Generate a dynamic sale report in Excel format and send it as a + response to a HTTP POST request.""" + report_obj = request.env[model].with_user(request.session.uid) + dfr_data = dfr_data + options = options + token = 'dummy-because-api-expects-one' + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', + content_disposition(report_name + '.xlsx')) + ] + ) + report_obj.get_sale_xlsx_report(options, response, report_data, + dfr_data) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = http.serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/sale_report_generator/doc/RELEASE_NOTES.md b/sale_report_generator/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..d156ef265 --- /dev/null +++ b/sale_report_generator/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 19.04.2024 +#### Version 17.0.1.0.0 +#### ADD +- Initial Commit for Sales All In One Report Generator diff --git a/sale_report_generator/models/__init__.py b/sale_report_generator/models/__init__.py new file mode 100644 index 000000000..7d1ab2226 --- /dev/null +++ b/sale_report_generator/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import sales_report diff --git a/sale_report_generator/models/sales_report.py b/sale_report_generator/models/sales_report.py new file mode 100644 index 000000000..59a126142 --- /dev/null +++ b/sale_report_generator/models/sales_report.py @@ -0,0 +1,578 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +import io +import json +from odoo import api, fields, models +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class SalesReport(models.Model): + """Model for generating sales reports. + Methods: + sale_report : Generate a sales report based on the provided option. + get_filter :This method relies on the 'get_filter_data' method to + retrieve filter data based on the provided option. It then formats the + filter data and returns a dictionary of filters to apply to the sales + report. + get_filter_data:This method relies on the 'get_filter_data' method to + retrieve filter data based on the provided option. It then formats the + filter data and returns a dictionary of filters to apply to the sales + report. + create : Create a new record for the current model. + write : Override the write method to perform additional actions when + updating a record. + _get_report_sub_lines: Generates sub-lines for a sales report based + on the given report type and date rangeand append to report_sub_lines. + _get_report_total_value : Retrieves the main lines of a report based on + the report type in data. + get_sale_xlsx_report:Generate a sales report in XLSX format based on + the specified filters. """ + _name = "sales.report" + _description = "Generate Sales Report" + + sale_report = fields.Char(string="Sale Report", + help="The generated sales report") + date_from = fields.Datetime(string="Start Date", + help="The starting date for the report") + date_to = fields.Datetime(string="End Date", + help="The ending date for the report") + report_type = fields.Selection([ + ('report_by_order', 'Report By Order'), + ('report_by_order_detail', 'Report By Order Detail'), + ('report_by_product', 'Report By Product'), + ('report_by_categories', 'Report By Categories'), + ('report_by_salesperson', 'Report By Sales Person'), + ('report_by_state', 'Report By State')], string='Report Type', + default='report_by_order', help="Select the type of report to generate") + + @api.model + def sale_report(self, option): + """Generate a sales report based on the provided option.""" + report_values = self.env['sales.report'].browse(option[0]) + data = { + 'report_type': report_values.report_type, + 'model': self, + } + if report_values.date_from: + data.update({ + 'date_from': report_values.date_from, + }) + if report_values.date_to: + data.update({ + 'date_to': report_values.date_to, + }) + return { + 'name': "Sale Orders", + 'type': 'ir.actions.client', + 'tag': 'sales_report', + 'orders': data, + 'filters': self.get_filter(option,report_values.date_from,report_values.date_to), + 'report_lines': self._get_report_values(data).get('SALE'), + 'report_main_line': self._get_report_values(data).get('sale_main'), + } + + def get_filter(self, option,date_from,date_to): + """ This method relies on the 'get_filter_data' method to retrieve + filter data based on the provided option. It then formats the filter + data and returns a dictionary of filters to apply to the sales + report.""" + data = self.get_filter_data(option) + filters = {} + if data.get('report_type') == 'report_by_order': + filters['report_type'] = 'Report By Order' + elif data.get('report_type') == 'report_by_order_detail': + filters['report_type'] = 'Report By Order Detail' + elif data.get('report_type') == 'report_by_product': + filters['report_type'] = 'Report By Product' + elif data.get('report_type') == 'report_by_categories': + filters['report_type'] = 'Report By Categories' + elif data.get('report_type') == 'report_by_salesperson': + filters['report_type'] = 'Report By Sales Person' + elif data.get('report_type') == 'report_by_state': + filters['report_type'] = 'Report By State' + else: + filters['report_type'] = 'report_by_order' + if date_from: + filters['date_from'] = date_from.strftime('%Y-%m-%d') + if date_to: + filters['date_to'] = date_to.strftime('%Y-%m-%d') + return filters + + def get_filter_data(self, option): + """ This method relies on the 'sales.report' model to retrieve the + sales report values.""" + default_filters = {} + report = self.env['sales.report'].browse(option[0]) + filter_dict = { + 'report_type': report.report_type, + } + filter_dict.update(default_filters) + return filter_dict + + def _get_report_sub_lines(self, data, report, date_from, date_to): + """ Generates sublines for a sales report based on the given report + type and date range and append to report_sub_lines""" + report_sub_lines = [] + if data.get('report_type') == 'report_by_order': + query = '''select so.id,so.name as number,so.date_order, + so.partner_id,so.amount_total,so.user_id, + res_partner.name as customer,res_users.partner_id as + user_partner,so.id as id,sum(sale_order_line.product_uom_qty), + (SELECT res_partner.name as sales_man FROM res_partner + WHERE res_partner.id = res_users.partner_id) + from sale_order as so + inner join res_partner on so.partner_id = res_partner.id + inner join res_users on so.user_id = res_users.id + inner join sale_order_line on so.id = sale_order_line.order_id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where so.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "so.date_order <= '%s' " % data.get('date_to') + query += "AND so.company_id = '%s' " % self.env.company.id + query += "group by so.user_id,res_users.partner_id," \ + "res_partner.name,so.partner_id,so.date_order," \ + "so.name,so.amount_total,so.id" + self._cr.execute(query) + report_by_order = self._cr.dictfetchall() + report_sub_lines.append(report_by_order) + elif data.get('report_type') == 'report_by_order_detail': + query = '''SELECT + so.id, + so.name AS number, + so.date_order, + res_partner.name AS customer, + rc.name AS company, + product_template.name AS product, + product_product.default_code, + so_line.product_uom_qty, + so_line.price_subtotal, + so.amount_total, + so.partner_id, + so.user_id, + ru.id AS salesman_id, + res_partner_salesman.name AS salesman + FROM + sale_order AS so + JOIN + sale_order_line AS so_line ON so.id = so_line.order_id + JOIN + product_product ON so_line.product_id = product_product.id + JOIN + product_template ON product_product.product_tmpl_id = product_template.id + JOIN + res_partner ON so.partner_id = res_partner.id + JOIN + res_users ON so.user_id = res_users.id + JOIN + res_company AS rc ON so.company_id = rc.id + JOIN + res_users AS ru ON so.user_id = ru.id + JOIN + res_partner AS res_partner_salesman ON res_users.partner_id = res_partner_salesman.id + WHERE + 1=1''' + if data.get('date_from'): + query += "AND so.date_order >= '%s' " % data.get('date_from') + if data.get('date_to'): + query += """ AND so.date_order <= '%s' """ % data.get('date_to') + query += "AND so.company_id = '%s' " % self.env.company.id + query += ''' GROUP BY + so.id, so.name, so.user_id, so.date_order, + res_partner.name, rc.name, product_template.name, + product_product.default_code, so_line.product_uom_qty, + so_line.price_subtotal, so.amount_total, so.partner_id, + so.user_id, ru.id, res_users.partner_id, res_partner_salesman.name + ORDER BY so.id asc; + ''' + self._cr.execute(query) + report_by_order_details = self._cr.dictfetchall() + report_sub_lines.append(report_by_order_details) + elif data.get('report_type') == 'report_by_product': + query = '''SELECT so.id,so.date_order, + product_template.name as product, + product_category.name as category, + product_product.default_code,so_line.product_uom_qty, + so.amount_total,so.name as number + From sale_order as so + inner join sale_order_line as so_line on + so.id = so_line.order_id inner join product_product ON + so_line.product_id=product_product.id inner join + product_template ON product_product.product_tmpl_id = + product_template.id inner join product_category on + product_category.id = product_template.categ_id Where 1=1 ''' + + if data.get('date_from'): + query += "AND so.date_order >= '%s' " % data.get('date_from') + if data.get('date_to'): + query += " AND so.date_order <= '%s' " % data.get('date_to') + query += "AND so.company_id = '%s' " % self.env.company.id + query += ("group by so.id,so.date_order,product_template.name," + "product_category.name,product_product.default_code," + "so_line.product_uom_qty") + self._cr.execute(query) + report_by_product = self._cr.dictfetchall() + report_sub_lines.append(report_by_product) + elif data.get('report_type') == 'report_by_categories': + query = '''select product_category.name, + sum(so_line.product_uom_qty) as qty,sum(so_line.price_subtotal) as + amount_total from sale_order_line as so_line inner join + product_template on so_line.product_id = product_template.id + inner join product_category on product_category.id = + product_template.categ_id inner join sale_order on so_line.order_id + = sale_order.id ''' + term = 'Where ' + if data.get('date_from'): + query += "Where sale_order.date_order >= '%s' " % data.get( + 'date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "sale_order.date_order <= '%s' " % data.get( + 'date_to') + query += "AND sale_order.company_id = '%s' " % self.env.company.id + query += "group by product_category.name" + self._cr.execute(query) + report_by_categories = self._cr.dictfetchall() + report_sub_lines.append(report_by_categories) + elif data.get('report_type') == 'report_by_salesperson': + query = ''' + select res_partner.name,sum(sale_order_line.product_uom_qty) as qty, + sum(sale_order_line.price_subtotal) as amount,count(so.id) as order + from sale_order as so + inner join res_users on so.user_id = res_users.id + inner join res_partner on res_users.partner_id = res_partner.id + inner join sale_order_line on so.id = sale_order_line.order_id ''' + term = 'Where ' + if data.get('date_from'): + query += "Where so.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "so.date_order <= '%s' " % data.get('date_to') + query += "AND so.company_id = '%s' " % self.env.company.id + query += "group by res_partner.name" + self._cr.execute(query) + report_by_salesperson = self._cr.dictfetchall() + report_sub_lines.append(report_by_salesperson) + elif data.get('report_type') == 'report_by_state': + query = ''' + select so.state,count(so.id),sum(sale_order_line.product_uom_qty) as qty, + sum(sale_order_line.price_subtotal) as amount from sale_order as so + inner join sale_order_line on so.id = sale_order_line.order_id ''' + term = 'Where ' + if data.get('date_from'): + query += "Where so.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "so.date_order <= '%s' " % data.get('date_to') + query += "AND so.company_id = '%s' " % self.env.company.id + query += "group by so.state" + self._cr.execute(query) + report_by_state = self._cr.dictfetchall() + report_sub_lines.append(report_by_state) + return report_sub_lines + + def _get_report_total_value(self, data, report): + """Retrieves the main lines of a report based on the report type in + data.""" + report_main_lines = [] + if data.get('report_type') == 'report_by_order': + self._cr.execute(''' + select count(so.id) as order,sum(so.amount_total) as amount + from sale_order as so + ''') + report_by_order = self._cr.dictfetchall() + report_main_lines.append(report_by_order) + elif data.get('report_type') == 'report_by_order_detail': + self._cr.execute(''' + select count(so_line.id) as order,sum(so_line.price_subtotal) as total + from sale_order_line as so_line ''') + report_by_order_detail = self._cr.dictfetchall() + report_main_lines.append(report_by_order_detail) + elif data.get('report_type') == 'report_by_product': + self._cr.execute(''' + select count(so_line.product_id) as order,sum(so_line.price_subtotal) + as amount from sale_order_line as so_line ''') + report_by_product = self._cr.dictfetchall() + report_main_lines.append(report_by_product) + else: + report_main_lines = False + return report_main_lines + + def _get_report_values(self, data): + """ Generate a dictionary of report values based on the input + data dictionary.""" + docs = data['model'] + date_from = data.get('date_from') + date_to = data.get('date_to') + if data['report_type'] == 'report_by_order_detail': + report = ['Report By Order Detail'] + elif data['report_type'] == 'report_by_product': + report = ['Report By Product'] + elif data['report_type'] == 'report_by_categories': + report = ['Report By Categories'] + elif data['report_type'] == 'report_by_salesperson': + report = ['Report By Sales Person'] + elif data['report_type'] == 'report_by_state': + report = ['Report By State'] + else: + report = ['Report By Order'] + report_res_total = self._get_report_total_value(data, report) + if data.get('report_type'): + report_res = \ + self._get_report_sub_lines(data, report, date_from, date_to)[0] + else: + report_res = self._get_report_sub_lines(data, report, date_from, + date_to) + if data.get('report_type') == 'report_by_order': + report_res_total = self._get_report_total_value(data, report)[0] + return { + 'doc_ids': self.ids, + 'docs': docs, + 'SALE': report_res, + 'sale_main': report_res_total, + } + + def get_sale_xlsx_report(self, data, response, report_data, dfrm_data): + """Generate a sales report in XLSX format based on the specified + filters.""" + report_data_main = json.loads(report_data) + output = io.BytesIO() + filters = json.loads(data) + dfr_data = json.loads(dfrm_data) + f_date = dfr_data.get('filters') + date_from = f_date.get('date_from') + t_date = dfr_data.get('filters') + date_to = t_date.get('date_to') + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + sheet = workbook.add_worksheet() + head = workbook.add_format({'align': 'center', 'bold': True, + 'font_size': '20px'}) + heading = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '10px', + 'border': 2, + 'border_color': 'black'}) + txt_l = workbook.add_format( + {'align': 'center', 'font_size': '10px', 'border': 1, 'bold': True}) + sheet.merge_range('A2:H3', + 'Sales Report', + head) + if report_data_main: + if filters.get('report_type') == 'report_by_order': + sheet.merge_range('B5:D5', 'Report By Order', txt_l) + if filters.get('date_from'): + sheet.write('A6', 'FROM DATE :', txt_l) + sheet.write('B6', date_from, txt_l) + if filters.get('date_to'): + sheet.write('C6', 'TO DATE :', txt_l) + sheet.write('D6', date_to, txt_l) + sheet.write('A7', 'Sale', heading) + sheet.write('B7', 'Date Order', heading) + sheet.write('C7', 'Customer', heading) + sheet.write('D7', 'Sales Person', heading) + sheet.write('E7', 'Total Qty', heading) + sheet.write('F7', 'Amount Total', heading) + lst = [] + for rec in report_data_main[0]: + lst.append(rec) + row = 6 + col = 0 + sheet.set_column(3, 0, 15) + sheet.set_column(4, 1, 15) + sheet.set_column(5, 2, 15) + sheet.set_column(6, 3, 15) + sheet.set_column(7, 4, 15) + sheet.set_column(8, 5, 15) + for rec_data in report_data_main: + row += 1 + sheet.write(row, col, rec_data['number'], txt_l) + sheet.write(row, col + 1, rec_data['date_order'], txt_l) + sheet.write(row, col + 2, rec_data['customer'], txt_l) + sheet.write(row, col + 3, rec_data['sales_man'], txt_l) + sheet.write(row, col + 4, rec_data['sum'], txt_l) + sheet.write(row, col + 5, rec_data['amount_total'], txt_l) + if filters.get('report_type') == 'report_by_order_detail': + sheet.merge_range('B5:D5', 'Report By Order Details ', txt_l) + if filters.get('date_from'): + sheet.write('A6', 'FROM DATE :', txt_l) + sheet.write('B6', date_from, txt_l) + if filters.get('date_to'): + sheet.write('C6', 'TO DATE :', txt_l) + sheet.write('D6', date_to, txt_l) + sheet.write('A7', 'Sale', heading) + sheet.write('B7', 'Date Order', heading) + sheet.write('C7', 'Customer', heading) + sheet.write('D7', 'Company', heading) + sheet.write('E7', 'Sales Person', heading) + sheet.write('F7', 'Product Name', heading) + sheet.write('G7', 'Product Code', heading) + sheet.write('H7', 'Quantity', heading) + sheet.write('I7', 'Price Subtotal', heading) + sheet.write('J7', 'Amount Total', heading) + lst = [] + for rec in report_data_main[0]: + lst.append(rec) + row = 6 + col = 0 + sheet.set_column(3, 0, 15) + sheet.set_column(4, 1, 15) + sheet.set_column(5, 2, 15) + sheet.set_column(6, 3, 15) + sheet.set_column(7, 4, 15) + sheet.set_column(8, 5, 15) + sheet.set_column(9, 6, 15) + sheet.set_column(10, 7, 15) + sheet.set_column(11, 8, 15) + sheet.set_column(12, 9, 15) + for rec_data in report_data_main: + row += 1 + sheet.write(row, col, rec_data['number'], txt_l) + sheet.write(row, col + 1, rec_data['date_order'], txt_l) + sheet.write(row, col + 2, rec_data['customer'], txt_l) + sheet.write(row, col + 3, rec_data['company'], txt_l) + sheet.write(row, col + 4, rec_data['salesman'], txt_l) + sheet.write(row, col + 5, rec_data['product']['en_US'], txt_l) + sheet.write(row, col + 6, rec_data['default_code'], txt_l) + sheet.write(row, col + 7, rec_data['product_uom_qty'], txt_l) + sheet.write(row, col + 8, rec_data['price_subtotal'], txt_l) + sheet.write(row, col + 9, rec_data['amount_total'], txt_l) + if filters.get('report_type') == 'report_by_product': + sheet.merge_range('B5:D5', 'Report By Products', txt_l) + if filters.get('date_from'): + sheet.write('A6', 'FROM DATE :', txt_l) + sheet.write('B6', date_from, txt_l) + if filters.get('date_to'): + sheet.write('C6', 'TO DATE :', txt_l) + sheet.write('D6', date_to, txt_l) + sheet.write('A7', 'Product', heading) + sheet.write('B7', 'Category', heading) + sheet.write('C7', 'Product Code', heading) + sheet.write('D7', 'Quantity', heading) + sheet.write('E7', 'Amount Total', heading) + lst = [] + for rec in report_data_main[0]: + lst.append(rec) + row = 6 + col = 0 + sheet.set_column(3, 0, 15) + sheet.set_column(4, 1, 15) + sheet.set_column(5, 2, 15) + sheet.set_column(6, 3, 15) + sheet.set_column(7, 4, 15) + for rec_data in report_data_main: + row += 1 + sheet.write(row, col, rec_data['product']['en_US'], txt_l) + sheet.write(row, col + 1, rec_data['category'], txt_l) + sheet.write(row, col + 2, rec_data['default_code'], txt_l) + sheet.write(row, col + 3, rec_data['product_uom_qty'], txt_l) + sheet.write(row, col + 4, rec_data['amount_total'], txt_l) + if filters.get('report_type') == 'report_by_categories': + sheet.merge_range('B5:D5', 'Report By Categories', txt_l) + if filters.get('date_from'): + sheet.write('A6', 'FROM DATE :', txt_l) + sheet.write('B6', date_from, txt_l) + if filters.get('date_to'): + sheet.write('C6', 'TO DATE :', txt_l) + sheet.write('D6', date_to, txt_l) + sheet.write('B7', 'Category', heading) + sheet.write('C7', 'Qty', heading) + sheet.write('D7', 'Amount Total', heading) + lst = [] + for rec in report_data_main[0]: + lst.append(rec) + row = 6 + col = 1 + sheet.set_column(3, 1, 15) + sheet.set_column(4, 2, 15) + sheet.set_column(5, 3, 15) + for rec_data in report_data_main: + row += 1 + sheet.write(row, col, rec_data['name'], txt_l) + sheet.write(row, col + 1, rec_data['qty'], txt_l) + sheet.write(row, col + 2, rec_data['amount_total'], txt_l) + if filters.get('report_type') == 'report_by_salesperson': + sheet.merge_range('B5:D5', 'Report By Salesperson', txt_l) + if filters.get('date_from'): + sheet.write('A6', 'FROM DATE :', txt_l) + sheet.write('B6', date_from, txt_l) + if filters.get('date_to'): + sheet.write('C6', 'TO DATE :', txt_l) + sheet.write('D6', date_to, txt_l) + sheet.write('A7', 'Sales Person', heading) + sheet.write('B7', 'Total Order', heading) + sheet.write('C7', 'Total Qty', heading) + sheet.write('D7', 'Total Amount', heading) + lst = [] + for rec in report_data_main[0]: + lst.append(rec) + row = 6 + col = 0 + sheet.set_column(3, 0, 15) + sheet.set_column(4, 1, 15) + sheet.set_column(5, 2, 15) + sheet.set_column(6, 3, 15) + for rec_data in report_data_main: + row += 1 + sheet.write(row, col, rec_data['name'], txt_l) + sheet.write(row, col + 1, rec_data['order'], txt_l) + sheet.write(row, col + 2, rec_data['qty'], txt_l) + sheet.write(row, col + 3, rec_data['amount'], txt_l) + if filters.get('report_type') == 'report_by_state': + sheet.merge_range('B5:D5', 'Report By State ', txt_l) + if filters.get('date_from'): + sheet.write('A6', 'FROM DATE :', txt_l) + sheet.write('B6', date_from, txt_l) + if filters.get('date_to'): + sheet.write('C6', 'TO DATE :', txt_l) + sheet.write('D6', date_to, txt_l) + sheet.write('A7', 'State', heading) + sheet.write('B7', 'Total Count', heading) + sheet.write('C7', 'Quantity', heading) + sheet.write('D7', 'Amount', heading) + lst = [] + for rec in report_data_main[0]: + lst.append(rec) + row = 6 + col = 0 + sheet.set_column(3, 0, 15) + sheet.set_column(4, 1, 15) + sheet.set_column(5, 2, 15) + sheet.set_column(6, 3, 15) + for rec_data in report_data_main: + row += 1 + if rec_data['state'] == 'draft': + sheet.write(row, col, 'Quotation', txt_l) + elif rec_data['state'] == 'sent': + sheet.write(row, col, 'Quotation Sent', txt_l) + elif rec_data['state'] == 'sale': + sheet.write(row, col, 'Sale Order', txt_l) + sheet.write(row, col + 1, rec_data['count'], txt_l) + sheet.write(row, col + 2, rec_data['qty'], txt_l) + sheet.write(row, col + 3, rec_data['amount'], txt_l) + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/sale_report_generator/report/__init__.py b/sale_report_generator/report/__init__.py new file mode 100644 index 000000000..ae98cf5f4 --- /dev/null +++ b/sale_report_generator/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import sale_order_report diff --git a/sale_report_generator/report/sale_order_report.py b/sale_report_generator/report/sale_order_report.py new file mode 100644 index 000000000..c7fada1ae --- /dev/null +++ b/sale_report_generator/report/sale_order_report.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Ayana KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import api, models + + +class SaleOrderReport(models.AbstractModel): + """Model for generating sale order reports. + Methods: + _get_report_values: Returns the report data for a sale order report.""" + + _name = 'report.sale_report_generator.sale_order_report' + _description = 'Sale Report Generator' + + @api.model + def _get_report_values(self, docids, data=None): + """Returns the report data for a sale order report.""" + if self.env.context.get('sale_order_report'): + if data.get('report_data'): + data.update({'report_main_line_data': data.get( + 'report_data')['report_lines'], + 'Filters': data.get('report_data')['filters'], + 'company': self.env.company, + }) + return data diff --git a/sale_report_generator/report/sale_order_reports.xml b/sale_report_generator/report/sale_order_reports.xml new file mode 100644 index 000000000..30b84b541 --- /dev/null +++ b/sale_report_generator/report/sale_order_reports.xml @@ -0,0 +1,11 @@ + + + + + Sales All In One Report + sales.report + qweb-pdf + sale_report_generator.sale_order_report + sale_report_generator.sale_order_report + + diff --git a/sale_report_generator/report/sale_order_templates.xml b/sale_report_generator/report/sale_order_templates.xml new file mode 100644 index 000000000..642f2731f --- /dev/null +++ b/sale_report_generator/report/sale_order_templates.xml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + diff --git a/sale_report_generator/security/ir.model.access.csv b/sale_report_generator/security/ir.model.access.csv new file mode 100644 index 000000000..ae32b9e1b --- /dev/null +++ b/sale_report_generator/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_sales_report_user,access.sales.report.user,model_sales_report,base.group_user,1,1,1,1 diff --git a/sale_report_generator/static/description/assets/icons/capture (1).png b/sale_report_generator/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/capture (1).png differ diff --git a/sale_report_generator/static/description/assets/icons/check.png b/sale_report_generator/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/check.png differ diff --git a/sale_report_generator/static/description/assets/icons/chevron.png b/sale_report_generator/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/chevron.png differ diff --git a/sale_report_generator/static/description/assets/icons/cogs.png b/sale_report_generator/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/cogs.png differ diff --git a/sale_report_generator/static/description/assets/icons/consultation.png b/sale_report_generator/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/consultation.png differ diff --git a/sale_report_generator/static/description/assets/icons/ecom-black.png b/sale_report_generator/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/ecom-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/education-black.png b/sale_report_generator/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/education-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/hotel-black.png b/sale_report_generator/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/hotel-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/img.png b/sale_report_generator/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/img.png differ diff --git a/sale_report_generator/static/description/assets/icons/license.png b/sale_report_generator/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/license.png differ diff --git a/sale_report_generator/static/description/assets/icons/lifebuoy.png b/sale_report_generator/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/lifebuoy.png differ diff --git a/sale_report_generator/static/description/assets/icons/manufacturing-black.png b/sale_report_generator/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/manufacturing-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/photo-capture.png b/sale_report_generator/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/photo-capture.png differ diff --git a/sale_report_generator/static/description/assets/icons/pos-black.png b/sale_report_generator/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/pos-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/puzzle.png b/sale_report_generator/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/puzzle.png differ diff --git a/sale_report_generator/static/description/assets/icons/restaurant-black.png b/sale_report_generator/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/restaurant-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/service-black.png b/sale_report_generator/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/service-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/trading-black.png b/sale_report_generator/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/trading-black.png differ diff --git a/sale_report_generator/static/description/assets/icons/training.png b/sale_report_generator/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/training.png differ diff --git a/sale_report_generator/static/description/assets/icons/update.png b/sale_report_generator/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/update.png differ diff --git a/sale_report_generator/static/description/assets/icons/user.png b/sale_report_generator/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/user.png differ diff --git a/sale_report_generator/static/description/assets/icons/wrench.png b/sale_report_generator/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/sale_report_generator/static/description/assets/icons/wrench.png differ diff --git a/sale_report_generator/static/description/assets/misc/Cybrosys R.png b/sale_report_generator/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/sale_report_generator/static/description/assets/misc/Cybrosys R.png differ diff --git a/sale_report_generator/static/description/assets/misc/email.svg b/sale_report_generator/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sale_report_generator/static/description/assets/misc/phone.svg b/sale_report_generator/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/sale_report_generator/static/description/assets/misc/star (1) 2.svg b/sale_report_generator/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/sale_report_generator/static/description/assets/misc/support (1) 1.svg b/sale_report_generator/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/sale_report_generator/static/description/assets/misc/support-email.svg b/sale_report_generator/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/sale_report_generator/static/description/assets/misc/tick-mark.svg b/sale_report_generator/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/sale_report_generator/static/description/assets/misc/whatsapp 1.svg b/sale_report_generator/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/sale_report_generator/static/description/assets/misc/whatsapp.svg b/sale_report_generator/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/sale_report_generator/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sale_report_generator/static/description/assets/modules/module_image (1).jpeg b/sale_report_generator/static/description/assets/modules/module_image (1).jpeg new file mode 100644 index 000000000..5ae24843e Binary files /dev/null and b/sale_report_generator/static/description/assets/modules/module_image (1).jpeg differ diff --git a/sale_report_generator/static/description/assets/modules/module_image (1).png b/sale_report_generator/static/description/assets/modules/module_image (1).png new file mode 100644 index 000000000..0dea4f332 Binary files /dev/null and b/sale_report_generator/static/description/assets/modules/module_image (1).png differ diff --git a/sale_report_generator/static/description/assets/modules/module_image (2).png b/sale_report_generator/static/description/assets/modules/module_image (2).png new file mode 100644 index 000000000..a5dc79613 Binary files /dev/null and b/sale_report_generator/static/description/assets/modules/module_image (2).png differ diff --git a/sale_report_generator/static/description/assets/modules/module_image-1.jpeg b/sale_report_generator/static/description/assets/modules/module_image-1.jpeg new file mode 100644 index 000000000..31f066e9c Binary files /dev/null and b/sale_report_generator/static/description/assets/modules/module_image-1.jpeg differ diff --git a/sale_report_generator/static/description/assets/modules/module_image.jpeg b/sale_report_generator/static/description/assets/modules/module_image.jpeg new file mode 100644 index 000000000..0cbac311c Binary files /dev/null and b/sale_report_generator/static/description/assets/modules/module_image.jpeg differ diff --git a/sale_report_generator/static/description/assets/modules/module_image.png b/sale_report_generator/static/description/assets/modules/module_image.png new file mode 100644 index 000000000..612be4b77 Binary files /dev/null and b/sale_report_generator/static/description/assets/modules/module_image.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/1.png b/sale_report_generator/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..ccdb2fe91 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/1.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/2.png b/sale_report_generator/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..ba5a985c1 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/2.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/3.png b/sale_report_generator/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..5437c78de Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/3.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/4.png b/sale_report_generator/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..bb36ae70b Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/4.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/5.png b/sale_report_generator/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..f73eb5d28 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/5.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/6.png b/sale_report_generator/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..14d11790b Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/6.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/7.png b/sale_report_generator/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..fff54e498 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/7.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/8.png b/sale_report_generator/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..85ad8808b Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/8.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/9.png b/sale_report_generator/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..306dd952b Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/9.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/hero-v17.gif b/sale_report_generator/static/description/assets/screenshots/hero-v17.gif new file mode 100644 index 000000000..0887c0d78 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/hero-v17.gif differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_001.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_001.png new file mode 100644 index 000000000..2bc10987a Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_001.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_02.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_02.png new file mode 100644 index 000000000..0a61c54d9 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_02.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_03.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_03.png new file mode 100644 index 000000000..3fd601883 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_03.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_04.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_04.png new file mode 100644 index 000000000..5103d021c Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_04.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_05.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_05.png new file mode 100644 index 000000000..2fd45721e Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_05.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_06.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_06.png new file mode 100644 index 000000000..9fd45f3c1 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_06.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_07.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_07.png new file mode 100644 index 000000000..fd7bff659 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_07.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_08.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_08.png new file mode 100644 index 000000000..2dee7cbb0 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_08.png differ diff --git a/sale_report_generator/static/description/assets/screenshots/sale_report_gen_09.png b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_09.png new file mode 100644 index 000000000..7505034b7 Binary files /dev/null and b/sale_report_generator/static/description/assets/screenshots/sale_report_gen_09.png differ diff --git a/sale_report_generator/static/description/banner.png b/sale_report_generator/static/description/banner.png new file mode 100644 index 000000000..8cfacbbb1 Binary files /dev/null and b/sale_report_generator/static/description/banner.png differ diff --git a/sale_report_generator/static/description/icon.png b/sale_report_generator/static/description/icon.png new file mode 100644 index 000000000..a023e78c1 Binary files /dev/null and b/sale_report_generator/static/description/icon.png differ diff --git a/sale_report_generator/static/description/index.html b/sale_report_generator/static/description/index.html new file mode 100644 index 000000000..b95b58140 --- /dev/null +++ b/sale_report_generator/static/description/index.html @@ -0,0 +1,653 @@ + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Sales All In One Report Generator

+

+ All In One Dynamic Report For Sales. +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Generates Report for a Specific Date Range.

+

Makes a report with details for a certain period of time you choose. +

+
+
+
+
+
+
+ +
+
+

Filtering Based on Different Aspects.

+
+
+
+
+
+
+ +
+
+

Print Reports in both PDF and XLSX format.

+
+
+
+
+
+
+ +
+
+

Enterprise, Community and Odoo.sh Support.

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

+ Sales Dynamic Report Menu.

+
+
+
+
+
+
+ +
+
+

+ We can Apply Filters in Date Range

+
+
+
+
+
+
+ +
+
+

+ Select the Report Type; by default, it is the Sales Report based on orders. After selecting filters, click the "Apply" button.

+
+
+
+
+
+
+ +
+
+

+ Sales Report Based On Order Details.

+
+
+
+
+
+
+ +
+
+

+ Sale Report Based On Product.

+
+
+
+
+
+
+ +
+
+

+ Sales Report Based On Categories.

+
+
+
+
+
+
+ +
+
+

+ Sales Report Based On Sales Person.

+
+
+
+
+
+
+ +
+
+

+ Sales Report Based On State.

+
+
+
+
+
+
+ +
+
+

+ Print Reports in both PDF and XLSX format.

+
+
+
+
+
+
+
    +
  • + Generates Report for a specific date range.. +
  • +
  • + Filtering based on different aspects. +
  • +
  • + Print Reports in both PDF and XLSX format. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:19th January 2024 +
+

+ Sales All In One Report Generator.

+
+
+
+
+
+
+
+

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/sale_report_generator/static/src/css/sale_report.css b/sale_report_generator/static/src/css/sale_report.css new file mode 100644 index 000000000..03dabc8f5 --- /dev/null +++ b/sale_report_generator/static/src/css/sale_report.css @@ -0,0 +1,172 @@ +a.dropdown-toggle.report-type { + margin: 10px; +} +.search-Result-Selection { + border: 2px solid #ccc; + margin-right: 30px; + margin-left: 10px; + border-radius: 10px; + max-width: 360px; + min-width: 250px; + min-height: 40px; + text-align: center; + padding: 0 12px +} +.table_sale_head { + background-color: #7c7bad; + color: #fff; + padding: 20px; + margin: 20px; + height: 57px; + width: 100%; + border: 1px solid #000; +} +element.style { + top: 0px; + height: 42px; + color: white; + background-color: #7c7bad; + border-color: #7c7bad; + width: 100px; +} +tr.so-line { + height: 48px; +} +tr.table_sale_head th { + font-size: 18px; + text-align: center; +} +ul.dropdown-menu.show li { + margin-left: 10px; + height:20px; +} +ul.dropdown-menu.show a{ + color: #221c1c; +} +.table_view_sr { + overflow-y: overlay; + position: relative; + height: 800px; + max-width: 100%; +} +.time_range_pr { + width: 125px; + border: 2px solid #ccc; + border-radius: 5px; + padding: 20px; +} +.apply_sale { + margin-right: 5px; + padding: 4px; +} +#pdf, #xlsx, #apply_filter { + color: white; + background-color: #7c7bad; + border-color: #7c7bad; +} +a.dropdown-toggle.report-type { + margin: 10px; +} +.search-Result-Selection:hover{ + border:2px solid #eaeaea; +} +.dropdown-togglereport-type{ + min-height: 40px; + padding-top: 10px; +} +.low_case, #report_res { + text-transform: capitalize; + text-align: center; +} +#report_res{ + padding-right: 3px; +} +.print-btns { + margin-bottom: 30px; +} +.table_pr_head { + background-color: #7c7bad; + color: #fff; + padding: 20px; + margin: 20px; + height: 57px; + width: 100%; + border: 1px solid #000; +} +tr.pr-line { + height: 48px; +} +tr.table_pr_head th { + font-size: 18px; + text-align: center; +} +.table_view_pr { + overflow-y: scroll; + position: relative; + height: 500px; + max-width: 100%; +} +.my_custom_dropdown{ + min-width:200px; + height:150px; + padding: 20px; +} +.my_custom_dropdown input{ + height:25px; +} +.report_type { + min-height: 38px; + min-width: 150px; + padding: 10px 43px 10px; +} +.sub_container_right, .print-btns { + display: flex; + justify-content: space-around; + align-items: center; +} +@media screen and (max-width: 768px) { + .sub_container_right, .print-btns { + flex-flow: column; + align-items: center; + } + .sub_container_left { + order: 2; + margin: 0; + } + .sub_container_right { + flex-flow: row; + margin-bottom: 10px; + flex-wrap: wrap !important; + width: 100%; + } +} +@media screen and (max-width: 576px) { + .apply_filter { + width: 100%; + position: relative; + } + #apply_filter { + position: absolute; + margin: 30px 0 0; + top: 50%; + left: 50%; + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + margin-right: 25px; + } + #date_chose { + margin-bottom: 15px; + } + .sub_container_left { + order: 2; + display: flex; + margin-top: 50px; + width: 100%; + justify-content: center; + align-items: center; + flex-wrap: wrap !important; + } + .sub_container_right { + flex-direction: column; + } +} diff --git a/sale_report_generator/static/src/js/sale_report.js b/sale_report_generator/static/src/js/sale_report.js new file mode 100644 index 000000000..8524a00b6 --- /dev/null +++ b/sale_report_generator/static/src/js/sale_report.js @@ -0,0 +1,118 @@ +/** @odoo-module */ +const { Component } = owl; +import { registry } from "@web/core/registry"; +import { download } from "@web/core/network/download"; +import { useService } from "@web/core/utils/hooks"; +import { useRef, useState } from "@odoo/owl"; +import { BlockUI } from "@web/core/ui/block_ui"; +const actionRegistry = registry.category("actions"); +import { uiService } from "@web/core/ui/ui_service"; +// Extending components for adding purchase report class +class SaleReport extends Component { + async setup() { + super.setup(...arguments); + this.uiService = useService('ui'); + this.initial_render = true; + this.orm = useService('orm'); + this.action = useService('action'); + this.start_date = useRef('date_from'); + this.end_date = useRef('date_to'); + this.order_by = useRef('order_by'); + this.state = useState({ + order_line: [], + data: null, + order:'Report By Sale Order', + order_by : 'report_by_order', + wizard_id : [] + }); + this.load_data(); + } + async load_data(wizard_id = null) { + /** + * Loads the data for the sales report. + */ + let move_lines = '' + try { + if(wizard_id == null){ + this.state.wizard_id = await this.orm.create("sales.report",[{}]); + } + this.state.data = await this.orm.call("sales.report", "sale_report", [this.state.wizard_id]); + this.state.order_line = this.state.data.report_lines + } + catch (el) { + window.location.href + } + } + async apply_filter(ev) { + let filter_data = {} + this.state.order_by = this.order_by.el.value + this.state.order = this.order_by.el.selectedOptions[0].outerText + filter_data.date_from = this.start_date.el.value + filter_data.date_to = this.end_date.el.value + filter_data.report_type = this.order_by.el.value + let data = await this.orm.write("sales.report",this.state.wizard_id, filter_data); + this.load_data(this.state.wizard_id) + } + //This function call an rpc call to the model sales.report & function sale_report with args wizard_id + async PrintPdf(ev){ + /** + * Generates and displays a PDF report for the sale orders. + * + * @param {Event} ev - The event object triggered by the action. + * @returns {Promise} - A promise that resolves to the result of the action. + */ + ev.preventDefault(); + var self = this; + var action_title = self.props.action.display_name; + return self.action.doAction({ + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name': 'sale_report_generator.sale_order_report', + 'report_file': 'sale_report_generator.sale_order_report', + 'data': { + 'report_data': this.state.data + }, + 'context': { + 'active_model': 'sales.report', + 'landscape': 1, + 'sale_order_report': true + }, + 'display_name': 'sale Order', + }); + } + async PrintXlsx(){ + /** + * Generates and downloads an XLSX report for the sale orders. + */ + var data = this.state.data + var action = { + 'data': { + 'model': 'sales.report', + 'options': JSON.stringify(data['orders']), + 'output_format': 'xlsx', + 'report_data': JSON.stringify(data['report_lines']), + 'report_name': 'Sales Report', + 'dfr_data': JSON.stringify(data), + }, + }; + this.uiService.block(); + await download({ + url: '/sale_dynamic_xlsx_reports', + data: action.data, + complete: this.uiService.unblock(), + error: (error) => this.call('crash_manager', 'rpc_error', error), + }); + } + //Corresponding SaleOrder Tree,Form View + async viewSaleOrder(ev){ + return this.action.doAction({ + type: "ir.actions.act_window", + res_model: 'sale.order', + res_id: parseInt(ev.target.id), + views: [[false, "form"]], + target: "current", + }); + } +} +SaleReport.template = 'SaleReport'; +actionRegistry.add("sales_report", SaleReport); diff --git a/sale_report_generator/static/src/xml/sale_report_templates.xml b/sale_report_generator/static/src/xml/sale_report_templates.xml new file mode 100644 index 000000000..eda04d8ee --- /dev/null +++ b/sale_report_generator/static/src/xml/sale_report_templates.xml @@ -0,0 +1,534 @@ + + + +
+
+
+

Sales Dynamic Report

+
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
SaleDate OrderCustomerSales PersonTotal QtyAmount Total
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SaleDate OrderCustomerCompanySales PersonProduct NameProduct CodeQuantityPrice SubtotalAmount Total
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
ProductSale Order NoCategoryProduct CodeQuantityAmount Total
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + +
CategoryQtyAmount Total
+ + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
Sales PersonTotal OrderTotal QtyTotal Amount
+ + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
StateTotal CountQuantityAmount
+ + + Quotation + + + Quotation Sent + + + Sales Order + + + Locked + + + Cancelled + + + + + + + + + + + + + + +
+
+
+
+
+
diff --git a/sale_report_generator/views/sale_report_views.xml b/sale_report_generator/views/sale_report_views.xml new file mode 100644 index 000000000..eb2b4ff8b --- /dev/null +++ b/sale_report_generator/views/sale_report_views.xml @@ -0,0 +1,14 @@ + + + + + Sale Dynamic Report + sales_report + + + +