diff --git a/purchase_report_generator/README.rst b/purchase_report_generator/README.rst new file mode 100644 index 000000000..048c5a8da --- /dev/null +++ b/purchase_report_generator/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Purchase All In One Report Generator +==================================== +This module Helps to Generate All in One Dynamic Purchase Report. + +Configuration +============= +* No additional configuration is needed. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers: (V17) Ayana KP, + (V18) Aysha Shalin + Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/purchase_report_generator/__init__.py b/purchase_report_generator/__init__.py new file mode 100644 index 000000000..7fa0a1272 --- /dev/null +++ b/purchase_report_generator/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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/purchase_report_generator/__manifest__.py b/purchase_report_generator/__manifest__.py new file mode 100644 index 000000000..4389f0773 --- /dev/null +++ b/purchase_report_generator/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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': 'Purchase All In One Report Generator', + 'version': '18.0.1.0.0', + 'category': 'Purchases', + 'summary': """This module Helps to Generate All in One Dynamic Purchase + Report.""", + 'description': """This module facilitates comprehensive Purchase 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': ['purchase'], + 'data': [ + 'security/ir.model.access.csv', + 'views/dynamic_purchase_report_views.xml', + 'report/purchase_order_report_templates.xml' + ], + 'assets': { + 'web.assets_backend': [ + 'purchase_report_generator/static/src/css/purchase_report.css', + 'purchase_report_generator/static/src/js/purchase_report.js', + 'purchase_report_generator/static/src/xml/purchase_report_view.xml', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/purchase_report_generator/controllers/__init__.py b/purchase_report_generator/controllers/__init__.py new file mode 100644 index 000000000..3b0725547 --- /dev/null +++ b/purchase_report_generator/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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 purchase_report_generator diff --git a/purchase_report_generator/controllers/purchase_report_generator.py b/purchase_report_generator/controllers/purchase_report_generator.py new file mode 100644 index 000000000..fc1b2c796 --- /dev/null +++ b/purchase_report_generator/controllers/purchase_report_generator.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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 TBXLSXReportController(http.Controller): + """ This endpoint generates and provides an XLSX report in response to an + HTTP POST request. The function uses the provided data to create the + report and returns it as an XLSX file. """ + @http.route('/purchase_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, **kw): + """ Endpoint for getting xlsx report """ + uid = request.session.uid + report_obj = request.env[model].with_user(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_purchase_xlsx_report(options, response, + report_data, dfr_data) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = 0 + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/purchase_report_generator/doc/RELEASE_NOTES.md b/purchase_report_generator/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..5a90b4678 --- /dev/null +++ b/purchase_report_generator/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 02.08.2025 +#### Version 18.0.1.0.0 +##### ADD +- Initial Commit for Purchase All In One Report Generator diff --git a/purchase_report_generator/models/__init__.py b/purchase_report_generator/models/__init__.py new file mode 100644 index 000000000..b3159f135 --- /dev/null +++ b/purchase_report_generator/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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 dynamic_purchase_report diff --git a/purchase_report_generator/models/dynamic_purchase_report.py b/purchase_report_generator/models/dynamic_purchase_report.py new file mode 100644 index 000000000..165db1443 --- /dev/null +++ b/purchase_report_generator/models/dynamic_purchase_report.py @@ -0,0 +1,521 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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 +import re +from datetime import datetime + +from odoo import api, fields, models + +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class DynamicPurchaseReport(models.Model): + """ Model for getting dynamic purchase report """ + _name = "dynamic.purchase.report" + _description = "Dynamic Purchase Report" + + purchase_report = fields.Char(string="Purchase Report", + help='Name of the report') + date_from = fields.Datetime(string="Date From", help='Start date of report') + date_to = fields.Datetime(string="Date to", help='End date of 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_purchase_representative', + 'Report By Purchase Representative'), + ('report_by_state', 'Report By State')], default='report_by_order', + help='The order of the report') + + @api.model + def purchase_report(self, option): + """ Function for getting datas for requests """ + report_values = self.env['dynamic.purchase.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, + }) + filters = self.get_filter(option) + lines = self._get_report_values(data).get('PURCHASE') + + return { + 'name': "Purchase Orders", + 'type': 'ir.actions.client', + 'tag': 's_r', + 'orders': data, + 'filters': filters, + 'report_lines': lines, + } + + def get_filter(self, option): + """Function for get data according to order_by filter""" + 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_purchase_representative': + filters['report_type'] = 'Report By Purchase Representative' + elif data.get('report_type') == 'report_by_state': + filters['report_type'] = 'Report By State' + else: + filters['report_type'] = 'report_by_order' + return filters + + def get_filter_data(self, option): + """Function for get filter data in report""" + record = self.env['dynamic.purchase.report'].browse(option[0]) + default_filters = {} + filter_dict = { + 'report_type': record.report_type, + } + filter_dict.update(default_filters) + return filter_dict + + def _get_report_sub_lines(self, data): + """Function for get report value using sql query""" + report_sub_lines = [] + if data.get('report_type') == 'report_by_order': + query = """ select l.name,l.date_order, l.partner_id,l.amount_total, + l.notes,l.user_id,res_partner.name as partner, + res_users.partner_id as user_partner,sum(purchase_order_line.product_qty), + l.id as id,(SELECT res_partner.name as salesman FROM res_partner + WHERE res_partner.id = res_users.partner_id) from purchase_order as l + left join res_partner on l.partner_id = res_partner.id + left join res_users on l.user_id = res_users.id + left join purchase_order_line on l.id = purchase_order_line.order_id + where 1=1 """ + if data.get('date_from'): + query += """and l.date_order >= '%s' """ % data.get('date_from') + if data.get('date_to'): + query += """ and l.date_order <= '%s' """ % data.get('date_to') + query += """group by l.user_id,res_users.partner_id,res_partner.name, + l.partner_id,l.date_order,l.name,l.amount_total,l.notes,l.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 l.name,l.date_order,l.partner_id,l.amount_total, + l.notes, l.user_id,res_partner.name as partner,res_users.partner_id + as user_partner,sum(purchase_order_line.product_qty), + purchase_order_line.name as product, purchase_order_line.price_unit, + purchase_order_line.price_subtotal,l.amount_total, + purchase_order_line.product_id,product_product.default_code, + (SELECT res_partner.name as salesman FROM res_partner WHERE + res_partner.id = res_users.partner_id)from purchase_order as l + left join res_partner on l.partner_id = res_partner.id + left join res_users on l.user_id = res_users.id + left join purchase_order_line on l.id = purchase_order_line.order_id + left join product_product on purchase_order_line.product_id = product_product.id + where 1=1 """ + if data.get('date_from'): + query += """ and l.date_order >= '%s' """ % data.get('date_from') + if data.get('date_to'): + query += """ and l.date_order <= '%s' """ % data.get('date_to') + query += """group by l.user_id,res_users.partner_id,res_partner.name, + l.partner_id,l.date_order,l.name,l.amount_total,l.notes, + purchase_order_line.name,purchase_order_line.price_unit, + purchase_order_line.price_subtotal,l.amount_total, + purchase_order_line.product_id,product_product.default_code""" + 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 l.amount_total,sum(purchase_order_line.product_qty) + as qty, purchase_order_line.name as product, purchase_order_line.price_unit, + product_product.default_code,product_category.name from purchase_order + as l left join purchase_order_line on l.id = purchase_order_line.order_id + left join product_product on purchase_order_line.product_id = product_product.id + left join product_template on purchase_order_line.product_id = product_template.id + left join product_category on product_category.id = product_template.categ_id + where 1=1 """ + if data.get('date_from'): + query += """and l.date_order >= '%s' """ % data.get('date_from') + if data.get('date_to'): + query += """ and l.date_order <= '%s' """ % data.get('date_to') + query += """group by l.amount_total,purchase_order_line.name, + purchase_order_line.price_unit,purchase_order_line.product_id, + product_product.default_code,product_template.categ_id, + product_category.name""" + 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(l.product_qty) as qty, + sum(l.price_subtotal) as amount_total from purchase_order_line as l + left join product_template on l.product_id = product_template.id + left join product_category on product_category.id = product_template.categ_id + left join purchase_order on l.order_id = purchase_order.id + where 1=1 """ + if data.get('date_from'): + query += """and pos_order.date_order >= '%s' """ % data.get( + 'date_from') + if data.get('date_to'): + query += """ and pos_order.date_order <= '%s' """ % data.get( + 'date_to') + 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_purchase_representative': + query = """select res_partner.name,sum(purchase_order_line.product_qty) + as qty,sum(purchase_order_line.price_subtotal) as amount,count(DISTINCT l.id) + as order from purchase_order as l left join res_users on + l.user_id = res_users.id left join res_partner on + res_users.partner_id = res_partner.id left join purchase_order_line + on l.id = purchase_order_line.order_id where 1=1 """ + if data.get('date_from'): + query += """ and l.date_order >= '%s' """ % data.get('date_from') + if data.get('date_to'): + query += """ and l.date_order <= '%s' """ % data.get('date_to') + query += "group by res_partner.name" + self._cr.execute(query) + report_by_purchase_representative = self._cr.dictfetchall() + report_sub_lines.append(report_by_purchase_representative) + elif data.get('report_type') == 'report_by_state': + query = """select l.state,sum(purchase_order_line.product_qty) as + qty,sum(purchase_order_line.price_subtotal) as amount, + count(DISTINCT l.id) as order from purchase_order as l + left join res_users on l.user_id = res_users.id left join + res_partner on res_users.partner_id = res_partner.id + left join purchase_order_line on l.id = purchase_order_line.order_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 += "group by l.state" + self._cr.execute(query) + report_by_state = self._cr.dictfetchall() + report_sub_lines.append(report_by_state) + return report_sub_lines + + @staticmethod + def strip_html_tags(text): + if not text: + return '' + return re.sub(r'<[^>]*>', '', text) + + def _get_report_values(self, data): + """Get report values based on the provided data.""" + docs = data['model'] + if data.get('report_type'): + report_res = self._get_report_sub_lines(data)[0] + else: + report_res = self._get_report_sub_lines(data) + + if isinstance(report_res, list): + for row in report_res: + if 'notes' in row: + row['notes'] = self.strip_html_tags(row['notes']) + elif isinstance(report_res, dict): + if 'notes' in report_res: + report_res['notes'] = self.strip_html_tags(report_res['notes']) + return { + 'doc_ids': self.ids, + 'docs': docs, + 'PURCHASE': report_res, + } + + def get_purchase_xlsx_report(self, data, response, report_data, dfr_data): + """ This function generates an XLSX report based on the provided data + and report type. It writes the report data to the response + object for download. + Args: + data (str): JSON data containing report filters. + response (object): The response object used to send the XLSX file. + report_data (str): JSON data containing the report data to be + included in the XLSX. + dfr_data: Data that doesn't appear to be used in this function.""" + report_data_main = json.loads(report_data) + output = io.BytesIO() + filters = json.loads(data) + 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': 1, 'border_color': 'black'}) + txt_l = workbook.add_format({ + 'font_size': '10px', 'border': 1, 'bold': True}) + txt_normal = workbook.add_format({ + 'font_size': '10px', 'border': 1}) + sheet.merge_range('A2:H3', 'Purchase Report', head) + if filters.get('report_type') == 'report_by_order': + sheet.merge_range('B5:C5', 'Report Type: ' + + 'Report By Order', txt_l) + + if filters.get('date_from') and filters.get('date_to'): + formatted_date_from = datetime.strptime( + filters['date_from'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + formatted_date_to = datetime.strptime( + filters['date_to'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + sheet.write('B6', 'Start Date:', txt_l) + sheet.write('C6', formatted_date_from, txt_l) + sheet.write('D6', 'End Date:', txt_l) + sheet.write('E6', formatted_date_to, txt_l) + + sheet.write('A7', 'Order', heading) + sheet.write('B7', 'Date Order', heading) + sheet.write('C7', 'Customer', heading) + sheet.write('D7', 'Purchase Representative', 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['name'], txt_normal) + sheet.write(row, col + 1, rec_data['date_order'], txt_normal) + sheet.write(row, col + 2, rec_data['partner'], txt_normal) + sheet.write(row, col + 3, rec_data['salesman'], txt_normal) + sheet.write(row, col + 4, rec_data['sum'], txt_normal) + sheet.write(row, col + 5, rec_data['amount_total'], txt_normal) + if filters.get('report_type') == 'report_by_order_detail': + sheet.merge_range('B5:C5', 'Report Type: ' + + 'Report By Order Details', txt_l) + + if filters.get('date_from') and filters.get('date_to'): + formatted_date_from = datetime.strptime( + filters['date_from'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + formatted_date_to = datetime.strptime( + filters['date_to'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + sheet.write('B6', 'Start Date:', txt_l) + sheet.write('C6', formatted_date_from, txt_l) + sheet.write('D6', 'End Date:', txt_l) + sheet.write('E6', formatted_date_to, txt_l) + + sheet.write('A7', 'Order', heading) + sheet.write('B7', 'Date Order', heading) + sheet.write('C7', 'Customer', heading) + sheet.write('D7', 'Purchase Representative', heading) + sheet.write('E7', 'Product Code', heading) + sheet.write('F7', 'Product Name', heading) + sheet.write('G7', 'Price unit', heading) + sheet.write('H7', 'Qty', heading) + sheet.write('I7', 'Price 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['name'], txt_normal) + sheet.write(row, col + 1, rec_data['date_order'], txt_normal) + sheet.write(row, col + 2, rec_data['partner'], txt_normal) + sheet.write(row, col + 3, rec_data['salesman'], txt_normal) + sheet.write(row, col + 4, rec_data['default_code'], txt_normal) + sheet.write(row, col + 5, rec_data['product'], txt_normal) + sheet.write(row, col + 6, rec_data['price_unit'], txt_normal) + sheet.write(row, col + 7, rec_data['sum'], txt_normal) + sheet.write(row, col + 8, rec_data['amount_total'], txt_normal) + if filters.get('report_type') == 'report_by_product': + sheet.merge_range('B5:C5', 'Report Type: ' + + 'Report By Product', txt_l) + + if filters.get('date_from') and filters.get('date_to'): + formatted_date_from = datetime.strptime( + filters['date_from'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + formatted_date_to = datetime.strptime( + filters['date_to'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + sheet.write('B6', 'Start Date:', txt_l) + sheet.write('C6', formatted_date_from, txt_l) + sheet.write('D6', 'End Date:', txt_l) + sheet.write('E6', formatted_date_to, txt_l) + + sheet.write('A7', 'Category', heading) + sheet.write('B7', 'Product Code', heading) + sheet.write('C7', 'Product Name', heading) + sheet.write('D7', 'Qty', 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['name'], txt_normal) + sheet.write(row, col + 1, rec_data['default_code'], txt_normal) + sheet.write(row, col + 2, rec_data['product'], txt_normal) + sheet.write(row, col + 3, rec_data['qty'], txt_normal) + sheet.write(row, col + 4, rec_data['amount_total'], txt_normal) + if filters.get('report_type') == 'report_by_categories': + sheet.merge_range('B5:C5', 'Report Type: ' + + 'Report By Categories', txt_normal) + + if filters.get('date_from') and filters.get('date_to'): + formatted_date_from = datetime.strptime( + filters['date_from'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + formatted_date_to = datetime.strptime( + filters['date_to'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + sheet.write('B6', 'Start Date:', txt_l) + sheet.write('C6', formatted_date_from, txt_l) + sheet.write('D6', 'End Date:', txt_l) + sheet.write('E6', formatted_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_normal) + sheet.write(row, col + 1, rec_data['qty'], txt_normal) + sheet.write(row, col + 2, rec_data['amount_total'], txt_normal) + if filters.get('report_type') == 'report_by_purchase_representative': + sheet.merge_range('B5:C5', 'Report Type: ' + + 'Report By Purchase Representative', txt_l) + + if filters.get('date_from') and filters.get('date_to'): + formatted_date_from = datetime.strptime( + filters['date_from'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + formatted_date_to = datetime.strptime( + filters['date_to'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + sheet.write('B6', 'Start Date:', txt_l) + sheet.write('C6', formatted_date_from, txt_l) + sheet.write('D6', 'End Date:', txt_l) + sheet.write('E6', formatted_date_to, txt_l) + + sheet.write('A7', 'Purchase Representative', 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_normal) + sheet.write(row, col + 1, rec_data['order'], txt_normal) + sheet.write(row, col + 2, rec_data['qty'], txt_normal) + sheet.write(row, col + 3, rec_data['amount'], txt_normal) + if filters.get('report_type') == 'report_by_state': + sheet.merge_range('B5:C5', 'Report Type: ' + + 'Report By State', txt_l) + + if filters.get('date_from') and filters.get('date_to'): + formatted_date_from = datetime.strptime( + filters['date_from'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + formatted_date_to = datetime.strptime( + filters['date_to'], '%Y-%m-%d %H:%M:%S').strftime( + '%d/%m/%y') + sheet.write('B6', 'Start Date:', txt_l) + sheet.write('C6', formatted_date_from, txt_l) + sheet.write('D6', 'End Date:', txt_l) + sheet.write('E6', formatted_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, 'RFQ', txt_normal) + elif rec_data['state'] == 'sent': + sheet.write(row, col, 'RFQ Sent', txt_normal) + elif rec_data['state'] == 'purchase': + sheet.write(row, col, 'Purchase Order', txt_normal) + sheet.write(row, col + 1, rec_data['order'], txt_normal) + sheet.write(row, col + 2, rec_data['qty'], txt_normal) + sheet.write(row, col + 3, rec_data['amount'], txt_normal) + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/purchase_report_generator/report/__init__.py b/purchase_report_generator/report/__init__.py new file mode 100644 index 000000000..51fe604e1 --- /dev/null +++ b/purchase_report_generator/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# 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 purchase_order_report diff --git a/purchase_report_generator/report/purchase_order_report.py b/purchase_report_generator/report/purchase_order_report.py new file mode 100644 index 000000000..bbc5c9f0d --- /dev/null +++ b/purchase_report_generator/report/purchase_order_report.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Aysha Shalin (odoo@cybrosys.info) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from odoo import api, models +from odoo.fields import Date, Datetime + + +class PurchaseOrderReport(models.AbstractModel): + """Model for creating pdf report and data fetching """ + _name = 'report.purchase_report_generator.purchase_order_report' + _description = "Purchase Report" + + @api.model + def _get_report_values(self, docids, data=None): + """Function for get pdf report values""" + if self.env.context.get('purchase_order_report'): + report_data = data.get('report_data', {}) + orders = report_data.get('orders', {}) + filters = report_data.get('filters', {}) + report_lines = report_data.get('report_lines', []) + date_from = Date.from_string(orders.get('date_from', '')) + date_to = Date.from_string(orders.get('date_to', '')) + if report_data: + data.update({ + 'report_main_line_data': report_lines, + 'Filters': filters, + 'date_from': (Datetime.from_string(date_from)).strftime('%d/%m/%y') if date_from else '', + 'date_to': (Datetime.from_string(date_to)).strftime('%d/%m/%y') if date_to else '', + 'company': self.env.company, + }) + return data diff --git a/purchase_report_generator/report/purchase_order_report_templates.xml b/purchase_report_generator/report/purchase_order_report_templates.xml new file mode 100644 index 000000000..1f20e4c6d --- /dev/null +++ b/purchase_report_generator/report/purchase_order_report_templates.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + Purchase All In One Report + dynamic.purchase.report + qweb-pdf + purchase_report_generator.purchase_order_report + purchase_report_generator.purchase_order_report + + \ No newline at end of file diff --git a/purchase_report_generator/security/ir.model.access.csv b/purchase_report_generator/security/ir.model.access.csv new file mode 100644 index 000000000..2fbc685dd --- /dev/null +++ b/purchase_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_dynamic_purchase_report,access.dynamic.purchase.report,model_dynamic_purchase_report,base.group_user,1,1,1,1 diff --git a/purchase_report_generator/static/description/assets/icons/arrows-repeat.svg b/purchase_report_generator/static/description/assets/icons/arrows-repeat.svg new file mode 100644 index 000000000..1d7efabc5 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/banner-1.png b/purchase_report_generator/static/description/assets/icons/banner-1.png new file mode 100644 index 000000000..c180db172 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/banner-1.png differ diff --git a/purchase_report_generator/static/description/assets/icons/banner-2.svg b/purchase_report_generator/static/description/assets/icons/banner-2.svg new file mode 100644 index 000000000..e606d97d9 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/banner-bg.png b/purchase_report_generator/static/description/assets/icons/banner-bg.png new file mode 100644 index 000000000..a8238d3c0 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/banner-bg.png differ diff --git a/purchase_report_generator/static/description/assets/icons/banner-bg.svg b/purchase_report_generator/static/description/assets/icons/banner-bg.svg new file mode 100644 index 000000000..b1378103e --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/banner-call.svg b/purchase_report_generator/static/description/assets/icons/banner-call.svg new file mode 100644 index 000000000..96c687e81 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/banner-mail.svg b/purchase_report_generator/static/description/assets/icons/banner-mail.svg new file mode 100644 index 000000000..cbf0d158d --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/banner-pattern.svg b/purchase_report_generator/static/description/assets/icons/banner-pattern.svg new file mode 100644 index 000000000..9c1c7e101 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/banner-promo.svg b/purchase_report_generator/static/description/assets/icons/banner-promo.svg new file mode 100644 index 000000000..d52791b11 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/brand-pair.svg b/purchase_report_generator/static/description/assets/icons/brand-pair.svg new file mode 100644 index 000000000..d8db7fc1e --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/check.png b/purchase_report_generator/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/check.png differ diff --git a/purchase_report_generator/static/description/assets/icons/chevron.png b/purchase_report_generator/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/chevron.png differ diff --git a/purchase_report_generator/static/description/assets/icons/close-icon.svg b/purchase_report_generator/static/description/assets/icons/close-icon.svg new file mode 100644 index 000000000..df8cce37a --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/cogs.png b/purchase_report_generator/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/cogs.png differ diff --git a/purchase_report_generator/static/description/assets/icons/collabarate-icon.svg b/purchase_report_generator/static/description/assets/icons/collabarate-icon.svg new file mode 100644 index 000000000..dd4e10518 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/purchase_report_generator/static/description/assets/icons/consultation.png b/purchase_report_generator/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/consultation.png differ diff --git a/purchase_report_generator/static/description/assets/icons/cybro-logo.png b/purchase_report_generator/static/description/assets/icons/cybro-logo.png new file mode 100644 index 000000000..ff4b78220 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/cybro-logo.png differ diff --git a/purchase_report_generator/static/description/assets/icons/down.svg b/purchase_report_generator/static/description/assets/icons/down.svg new file mode 100644 index 000000000..f21c36271 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/purchase_report_generator/static/description/assets/icons/ecom-black.png b/purchase_report_generator/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/ecom-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/education-black.png b/purchase_report_generator/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/education-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/faq.png b/purchase_report_generator/static/description/assets/icons/faq.png new file mode 100644 index 000000000..4250b5b81 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/faq.png differ diff --git a/purchase_report_generator/static/description/assets/icons/feature-icon.svg b/purchase_report_generator/static/description/assets/icons/feature-icon.svg new file mode 100644 index 000000000..fa0ea6850 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/feature.png b/purchase_report_generator/static/description/assets/icons/feature.png new file mode 100644 index 000000000..ac7a785c0 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/feature.png differ diff --git a/purchase_report_generator/static/description/assets/icons/gear.svg b/purchase_report_generator/static/description/assets/icons/gear.svg new file mode 100644 index 000000000..0cc66b6ea --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/hero.gif b/purchase_report_generator/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..380654dfe Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/hero.gif differ diff --git a/purchase_report_generator/static/description/assets/icons/hire-odoo.svg b/purchase_report_generator/static/description/assets/icons/hire-odoo.svg new file mode 100644 index 000000000..e1ac089b0 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/hotel-black.png b/purchase_report_generator/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/hotel-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/license.png b/purchase_report_generator/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/license.png differ diff --git a/purchase_report_generator/static/description/assets/icons/life-ring-icon.svg b/purchase_report_generator/static/description/assets/icons/life-ring-icon.svg new file mode 100644 index 000000000..3ae6e1d89 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/lifebuoy.png b/purchase_report_generator/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/lifebuoy.png differ diff --git a/purchase_report_generator/static/description/assets/icons/mail.svg b/purchase_report_generator/static/description/assets/icons/mail.svg new file mode 100644 index 000000000..1eedde695 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/purchase_report_generator/static/description/assets/icons/manufacturing-black.png b/purchase_report_generator/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/manufacturing-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/notes.png b/purchase_report_generator/static/description/assets/icons/notes.png new file mode 100644 index 000000000..ee5e95404 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/notes.png differ diff --git a/purchase_report_generator/static/description/assets/icons/notification icon.svg b/purchase_report_generator/static/description/assets/icons/notification icon.svg new file mode 100644 index 000000000..053189973 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/odoo-consultancy.svg b/purchase_report_generator/static/description/assets/icons/odoo-consultancy.svg new file mode 100644 index 000000000..e05f65bde --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/purchase_report_generator/static/description/assets/icons/odoo-licencing.svg b/purchase_report_generator/static/description/assets/icons/odoo-licencing.svg new file mode 100644 index 000000000..2606c88b0 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/purchase_report_generator/static/description/assets/icons/odoo-logo.png b/purchase_report_generator/static/description/assets/icons/odoo-logo.png new file mode 100644 index 000000000..0e4d0eb5a Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/odoo-logo.png differ diff --git a/purchase_report_generator/static/description/assets/icons/patter.svg b/purchase_report_generator/static/description/assets/icons/patter.svg new file mode 100644 index 000000000..25c9c0a8f --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/pattern1.png b/purchase_report_generator/static/description/assets/icons/pattern1.png new file mode 100644 index 000000000..09ab0fb2d Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/pattern1.png differ diff --git a/purchase_report_generator/static/description/assets/icons/pos-black.png b/purchase_report_generator/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/pos-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/puzzle-piece-icon.svg b/purchase_report_generator/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100644 index 000000000..3e9ad9373 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/puzzle.png b/purchase_report_generator/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/puzzle.png differ diff --git a/purchase_report_generator/static/description/assets/icons/replace-icon.svg b/purchase_report_generator/static/description/assets/icons/replace-icon.svg new file mode 100644 index 000000000..d0e3a7af1 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/restaurant-black.png b/purchase_report_generator/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/restaurant-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/screenshot-main.png b/purchase_report_generator/static/description/assets/icons/screenshot-main.png new file mode 100644 index 000000000..575f8e676 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/screenshot-main.png differ diff --git a/purchase_report_generator/static/description/assets/icons/screenshot.png b/purchase_report_generator/static/description/assets/icons/screenshot.png new file mode 100644 index 000000000..cef272529 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/screenshot.png differ diff --git a/purchase_report_generator/static/description/assets/icons/service-black.png b/purchase_report_generator/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/service-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/skype-fill.svg b/purchase_report_generator/static/description/assets/icons/skype-fill.svg new file mode 100644 index 000000000..c17423639 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/skype.png b/purchase_report_generator/static/description/assets/icons/skype.png new file mode 100644 index 000000000..51b409fb3 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/skype.png differ diff --git a/purchase_report_generator/static/description/assets/icons/skype.svg b/purchase_report_generator/static/description/assets/icons/skype.svg new file mode 100644 index 000000000..df3dad39b --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/purchase_report_generator/static/description/assets/icons/star-1.svg b/purchase_report_generator/static/description/assets/icons/star-1.svg new file mode 100644 index 000000000..7e55ab162 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/star-2.svg b/purchase_report_generator/static/description/assets/icons/star-2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/support.png b/purchase_report_generator/static/description/assets/icons/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/support.png differ diff --git a/purchase_report_generator/static/description/assets/icons/test-1 - Copy.png b/purchase_report_generator/static/description/assets/icons/test-1 - Copy.png new file mode 100644 index 000000000..f6a902663 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/test-1 - Copy.png differ diff --git a/purchase_report_generator/static/description/assets/icons/test-1.png b/purchase_report_generator/static/description/assets/icons/test-1.png new file mode 100644 index 000000000..0908add2b Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/test-1.png differ diff --git a/purchase_report_generator/static/description/assets/icons/test-2.png b/purchase_report_generator/static/description/assets/icons/test-2.png new file mode 100644 index 000000000..4671fe91e Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/test-2.png differ diff --git a/purchase_report_generator/static/description/assets/icons/trading-black.png b/purchase_report_generator/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/trading-black.png differ diff --git a/purchase_report_generator/static/description/assets/icons/training.png b/purchase_report_generator/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/training.png differ diff --git a/purchase_report_generator/static/description/assets/icons/translate.svg b/purchase_report_generator/static/description/assets/icons/translate.svg new file mode 100644 index 000000000..af9c8a1aa --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/update.png b/purchase_report_generator/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/update.png differ diff --git a/purchase_report_generator/static/description/assets/icons/user.png b/purchase_report_generator/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/user.png differ diff --git a/purchase_report_generator/static/description/assets/icons/video.png b/purchase_report_generator/static/description/assets/icons/video.png new file mode 100644 index 000000000..576705b17 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/video.png differ diff --git a/purchase_report_generator/static/description/assets/icons/whatsapp.png b/purchase_report_generator/static/description/assets/icons/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/whatsapp.png differ diff --git a/purchase_report_generator/static/description/assets/icons/wrench-icon.svg b/purchase_report_generator/static/description/assets/icons/wrench-icon.svg new file mode 100644 index 000000000..174b5a465 --- /dev/null +++ b/purchase_report_generator/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purchase_report_generator/static/description/assets/icons/wrench.png b/purchase_report_generator/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/purchase_report_generator/static/description/assets/icons/wrench.png differ diff --git a/purchase_report_generator/static/description/assets/modules/1.jpg b/purchase_report_generator/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..a94aeabbc Binary files /dev/null and b/purchase_report_generator/static/description/assets/modules/1.jpg differ diff --git a/purchase_report_generator/static/description/assets/modules/2.jpg b/purchase_report_generator/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..dab7b184c Binary files /dev/null and b/purchase_report_generator/static/description/assets/modules/2.jpg differ diff --git a/purchase_report_generator/static/description/assets/modules/3.png b/purchase_report_generator/static/description/assets/modules/3.png new file mode 100644 index 000000000..0f250c021 Binary files /dev/null and b/purchase_report_generator/static/description/assets/modules/3.png differ diff --git a/purchase_report_generator/static/description/assets/modules/4.png b/purchase_report_generator/static/description/assets/modules/4.png new file mode 100644 index 000000000..c89b72217 Binary files /dev/null and b/purchase_report_generator/static/description/assets/modules/4.png differ diff --git a/purchase_report_generator/static/description/assets/modules/5.png b/purchase_report_generator/static/description/assets/modules/5.png new file mode 100644 index 000000000..5657d8bd8 Binary files /dev/null and b/purchase_report_generator/static/description/assets/modules/5.png differ diff --git a/purchase_report_generator/static/description/assets/modules/6.png b/purchase_report_generator/static/description/assets/modules/6.png new file mode 100644 index 000000000..81b25b767 Binary files /dev/null and b/purchase_report_generator/static/description/assets/modules/6.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/hero.gif b/purchase_report_generator/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..f60d4c26b Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/hero.gif differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report1.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report1.png new file mode 100644 index 000000000..9b4cf4e9b Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report1.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report10.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report10.png new file mode 100644 index 000000000..9827d9fc9 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report10.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report2.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report2.png new file mode 100644 index 000000000..25cf7c04f Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report2.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report3.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report3.png new file mode 100644 index 000000000..c41dfff01 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report3.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report4.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report4.png new file mode 100644 index 000000000..eabcad436 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report4.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report5.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report5.png new file mode 100644 index 000000000..805e52731 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report5.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report6.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report6.png new file mode 100644 index 000000000..76257d5f9 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report6.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report7.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report7.png new file mode 100644 index 000000000..2969ebe70 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report7.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report8.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report8.png new file mode 100644 index 000000000..a89341ad5 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report8.png differ diff --git a/purchase_report_generator/static/description/assets/screenshots/purchase_report9.png b/purchase_report_generator/static/description/assets/screenshots/purchase_report9.png new file mode 100644 index 000000000..689ea1801 Binary files /dev/null and b/purchase_report_generator/static/description/assets/screenshots/purchase_report9.png differ diff --git a/purchase_report_generator/static/description/banner.jpg b/purchase_report_generator/static/description/banner.jpg new file mode 100644 index 000000000..aa5a5b602 Binary files /dev/null and b/purchase_report_generator/static/description/banner.jpg differ diff --git a/purchase_report_generator/static/description/icon.png b/purchase_report_generator/static/description/icon.png new file mode 100644 index 000000000..758cc607f Binary files /dev/null and b/purchase_report_generator/static/description/icon.png differ diff --git a/purchase_report_generator/static/description/index.html b/purchase_report_generator/static/description/index.html new file mode 100644 index 000000000..64b19d165 --- /dev/null +++ b/purchase_report_generator/static/description/index.html @@ -0,0 +1,1122 @@ + + + + + + Purchase All In One Report Generator + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

+ Generate All in One Dynamic Purchase Report +

+

Purchase All In One Report Generator +

+
+
+ img +
+ +
+ img +
+
+
+ img +
+
+ icon +
+
+ +
+
+
+

Key + Highlights

+
+
+
+
+ icon +
+
+ Generates Report for a Specific Date Range +
+
+
+
+
+
+ icon +
+
+ Filtering Based on Different Aspects +
+
+
+
+
+
+ icon +
+
+ Print Reports in Both PDF and XLSX Format +
+
+
+
+
+
+ icon +
+
+ Community & Enterprise Support +
+
+
+
+
+ +
+
+
+ Purchase All In One Report Generator +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ icon +
+
+
+ + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ All In One Purchase Report + + Menu +

+
+
+

+ Navigate to Purchase -> Reporting -> Dynamic Purchase Report. +

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

+ Generates Report for a Specific + + Date Range +

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

+ Filtering Based on + Different Aspects +

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

+ Purchase Report Based on + Orders +

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

+ Purchase Report Based on + Order Details +

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

+ Purchase Report Based on + Product +

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

+ Purchase Report Based on + Categories +

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

+ Purchase Report Based on + Purchase Representative +

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

+ Purchase Report Based on + State +

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

+ Print Reports in Both + PDF and XLSX Format +

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

+ Print Reports in both PDF and XLSX Formats. +

+
+
+
+
+
+
+
+ +
+

+ Filtering based on Different Aspects.

+
+
+
+
+
+
+
+ +
+

+ Generates Report for a Specific Date Range.

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

+ Yes, you can download different + purchase reports using this module. +

+
+
+ +
+ +
+

+ Yes, different filters are + available for printing various + types of purchase reports. +

+
+
+ +
+ +
+

+ Yes, both formats are available. +

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

+ Latest Release 18.0.1.0.0 +

+ + 22nd May, 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+
+ +
+
+ +
+
+ .... +
+
+ +
+ +
+
+ + + + + + diff --git a/purchase_report_generator/static/src/css/purchase_report.css b/purchase_report_generator/static/src/css/purchase_report.css new file mode 100644 index 000000000..62083a746 --- /dev/null +++ b/purchase_report_generator/static/src/css/purchase_report.css @@ -0,0 +1,138 @@ +.time_range_pr { + width: 125px; + border: 2px solid #ccc; + border-radius: 5px; + padding: 10px; +} +.apply_sale { + margin-right: 5px; + padding: 4px; +} +#apply_filter { + margin-right: 25px; +} +#pdf, #xlsx, #apply_filter { + color: white; + background-color: #7c7bad; + border-color: #7c7bad; +} +a.dropdown-toggle.report-type { + margin: 10px; +} +.search-Result-Selection { + border: 2px solid #ccc; + max-width: 360px; + min-width: 250px; + margin-right: 10px; + margin-left: 10px; + border-radius: 5px; + min-height: 40px; + text-align: center; +} +.search-Result-Selection:hover{ + border:2px solid #eaeaea; +} +#selection{ + min-height: 46px; + min-width: 150px; + padding: 10px 10px 10px; +} +.dropdown-togglereport-type{ + min-height: 10px; + padding-top: 5px; +} +.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: 100px; + min-width: 150px; + padding: 30px 10px 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%); + } + #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/purchase_report_generator/static/src/js/purchase_report.js b/purchase_report_generator/static/src/js/purchase_report.js new file mode 100644 index 000000000..b2771a4bf --- /dev/null +++ b/purchase_report_generator/static/src/js/purchase_report.js @@ -0,0 +1,189 @@ +/** @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"; +const actionRegistry = registry.category("actions"); +import { uiService } from "@web/core/ui/ui_service"; +// Extending components for adding purchase report class +class PurchaseReport extends Component { + async setup() { + super.setup(...arguments); + this.actionService = useService("action"); + 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_by : 'report_by_order', + wizard_id : [] + }); + this.reportTypeLabels = { + 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_purchase_representative: 'Report By Purchase Representative', + report_by_state: 'Report By State', + }; + this.load_data(); + } + get reportLabel() { + return this.reportTypeLabels[this.state.order_by] || this.state.order_by; + } + async load_data(wizard_id = null) { + /** + * Loads the data for the purchase report. + */ + let move_lines = '' + try { + if(wizard_id == null){ + this.state.wizard_id = await this.orm.create("dynamic.purchase.report",[{}]); + } + this.state.data = await this.orm.call("dynamic.purchase.report", "purchase_report", [this.state.wizard_id]); + if (Array.isArray(this.state.data)) { + this.state.order_line = this.state.data.map(item => { + return item; + }); + } else if (typeof this.state.data === 'object' && this.state.data !== null) { + this.state.order_line = this.state.data.report_lines; + } + } + catch (el) { + window.location.href; + } + } + async onchangeFromDate() { + // Validation for start date + if (this.end_date.el.value && this.start_date.el.value > this.end_date.el.value) { + this.actionService.doAction({ + type: 'ir.actions.client', + tag: 'display_notification', + params: { + message: 'End date should be greater than the start date.', + type: 'warning', + sticky: false, + } + }); + this.start_date.el.value = '' + this.end_date.el.value = '' + } + } + async onchangeEndDate() { + // Validation for end date + if (this.start_date.el.value && this.start_date.el.value > this.end_date.el.value) { + this.actionService.doAction({ + type: 'ir.actions.client', + tag: 'display_notification', + params: { + message: 'End date should be greater than the start date.', + type: 'warning', + sticky: false, + } + }); + this.start_date.el.value = '' + this.end_date.el.value = '' + } + } + async applyFilter(ev) { + let filter_data = {} + this.state.order_by = this.order_by.el.value + 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("dynamic.purchase.report",this.state.wizard_id, filter_data); + this.load_data(this.state.wizard_id) + } + viewPurchaseOrder(ev) { + return this.action.doAction({ + type: "ir.actions.act_window", + res_model: 'purchase.order', + res_id: parseInt(ev.target.id), + views: [[false, "form"]], + target: "current", + }); + } + async print_xlsx() { + /** + * Generates and downloads an XLSX report for the purchase orders. + */ + var data = this.state.data + if (data.report_lines && data.report_lines.length > 0) { + const action = { + 'data': { + 'model': 'dynamic.purchase.report', + 'options': JSON.stringify(data['orders']), + 'output_format': 'xlsx', + 'report_data': JSON.stringify(data['report_lines']), + 'report_name': 'Purchase Report', + 'dfr_data': JSON.stringify(data), + }, + }; + this.uiService.block(); + await download({ + url: '/purchase_dynamic_xlsx_reports', + data: action.data, + complete: this.uiService.unblock(), + error: (error) => this.call('crash_manager', 'rpc_error', error), + }); + } else { + // Notify the user if there's no data + this.actionService.doAction({ + type: 'ir.actions.client', + tag: 'display_notification', + params: { + message: 'No data available to print', + type: 'warning', + sticky: false, + } + }); + } + } + async printPdf(ev) { + /** + * Generates and displays a PDF report for the purchase 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; + var data = this.state.data + if (data.report_lines && data.report_lines.length > 0) { + return self.action.doAction({ + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name': 'purchase_report_generator.purchase_order_report', + 'report_file': 'purchase_report_generator.purchase_order_report', + 'data': { + 'report_data': data + }, + 'context': { + 'active_model': 'purchase.report', + 'purchase_order_report': true + }, + 'display_name': 'Purchase Order', + }) + } else { + // Notify the user if there's no data + this.actionService.doAction({ + type: 'ir.actions.client', + tag: 'display_notification', + params: { + message: 'No data available to print', + type: 'warning', + sticky: false, + } + }); + } + } +} +PurchaseReport.template = 'PurchaseReport'; +actionRegistry.add("purchase_report", PurchaseReport); diff --git a/purchase_report_generator/static/src/xml/purchase_report_view.xml b/purchase_report_generator/static/src/xml/purchase_report_view.xml new file mode 100644 index 000000000..3a196025d --- /dev/null +++ b/purchase_report_generator/static/src/xml/purchase_report_view.xml @@ -0,0 +1,496 @@ + + + + +
+
+
+

Purchase Report

+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
OrderDate OrderCustomerPurchase RepresentativeTotal QtyAmount TotalNote
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OrderDate OrderCustomerPurchase RepresentativeProduct CodeProduct NamePrice unitQtyPrice Subtotal
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
CategoryProduct CodeProduct NameQtyAmount Total
+ + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + +
CategoryQtyAmount Total
+ + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
Purchase RepresentativeTotal OrderTotal QtyTotal Amount
+ + + + + + + + + + + + + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
StateTotal CountQuantityAmount
+ + + RFQ Sent + + + Purchase Order + + + RFQ + + + + + + + + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/purchase_report_generator/views/dynamic_purchase_report_views.xml b/purchase_report_generator/views/dynamic_purchase_report_views.xml new file mode 100644 index 000000000..19b48dcf5 --- /dev/null +++ b/purchase_report_generator/views/dynamic_purchase_report_views.xml @@ -0,0 +1,12 @@ + + + + + Purchase Report + purchase_report + + + \ No newline at end of file