diff --git a/pos_report_generator/README.rst b/pos_report_generator/README.rst new file mode 100644 index 000000000..970593a06 --- /dev/null +++ b/pos_report_generator/README.rst @@ -0,0 +1,42 @@ +POS All In One Report Generator +=============================== +* POS All In One Dynamic Report For Odoo 14 Community And Enterprise editions + +Installation +============ + - www.odoo.com/documentation/14.0/setup/install.html + - Install our custom addon + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.odoo.com/documentation/user/14.0/legal/licenses/licenses.html) + +Company +------- +* 'Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: +(v14) Sreelakshmi @ Cybrosys + + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ + diff --git a/pos_report_generator/__init__.py b/pos_report_generator/__init__.py new file mode 100644 index 000000000..4a84e60d7 --- /dev/null +++ b/pos_report_generator/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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 models +from . import report +from . import controllers diff --git a/pos_report_generator/__manifest__.py b/pos_report_generator/__manifest__.py new file mode 100644 index 000000000..efb802148 --- /dev/null +++ b/pos_report_generator/__manifest__.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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': 'POS All in One Report Generator', + 'version': '14.0.1.0.0', + 'summary': "POS All In One Dynamic Report For Odoo 14 Community And Enterprise editions", + 'description': "POS All In One Dynamic Report For Odoo 14 Community And Enterprise editions", + 'category': 'Point of Sale', + 'author': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': [ + 'point_of_sale', + 'stock', + ], + 'data': [ + 'security/ir.model.access.csv', + 'report/pos_order_report.xml', + 'views/pos_report.xml', + 'views/templates.xml', + ], + 'qweb': [ + 'static/src/xml/pos_report_view.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'auto_install': False, +} diff --git a/pos_report_generator/controllers/__init__.py b/pos_report_generator/controllers/__init__.py new file mode 100644 index 000000000..9356a4766 --- /dev/null +++ b/pos_report_generator/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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 diff --git a/pos_report_generator/controllers/controllers.py b/pos_report_generator/controllers/controllers.py new file mode 100644 index 000000000..846d5f0f6 --- /dev/null +++ b/pos_report_generator/controllers/controllers.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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.addons.web.controllers.main import _serialize_exception +from odoo.tools import html_escape + + +class TBXLSXReportController(http.Controller): + @http.route('/pos_dynamic_xlsx_reports', type='http', auth='user', methods=['POST'], csrf=False) + def get_report_xlsx(self, model, options, output_format, token, report_data, report_name, dfr_data, **kw): + + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + dfr_data = dfr_data + options = options + 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_pos_xlsx_report(options, response, report_data, dfr_data) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = _serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/pos_report_generator/doc/RELEASE_NOTES.md b/pos_report_generator/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..da0244ccc --- /dev/null +++ b/pos_report_generator/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 15.12.2022 +#### Version 15.0.1.0.0 +##### ADD +- Initial commit for pos_report_generator diff --git a/pos_report_generator/models/__init__.py b/pos_report_generator/models/__init__.py new file mode 100644 index 000000000..5b2bde19e --- /dev/null +++ b/pos_report_generator/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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 pos_report diff --git a/pos_report_generator/models/pos_report.py b/pos_report_generator/models/pos_report.py new file mode 100644 index 000000000..12fb729ec --- /dev/null +++ b/pos_report_generator/models/pos_report.py @@ -0,0 +1,567 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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 models, fields, api + +import io +import json + +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class PosReportGenerator(models.Model): + _name = "pos.report" + + pos_report = fields.Char(string="PoS Report") + date_from = fields.Datetime(string="Date From") + date_to = fields.Datetime(string="Date to") + 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_salesman', 'Report By Salesman'), + ('report_by_payment', 'Report By Payment')], + default='report_by_order') + + @api.model + def pos_report(self, option): + orders = self.env['pos.order'].search([]) + report_values = self.env['pos.report'].search([('id', '=', 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, + }) + # print("reports",reports) + filters = self.get_filter(option) + report = self._get_report_values(data) + lines = self._get_report_values(data).get('POS') + main_line = self._get_report_values(data).get('pos_main') + + return { + 'name': "PoS Orders", + 'type': 'ir.actions.client', + 'tag': 'p_r', + 'orders': data, + 'filters': filters, + 'report_lines': lines, + 'report_main_line': main_line, + } + + def get_filter(self, option): + 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_salesman': + filters['report_type'] = 'Report By Salesman' + elif data.get('report_type') == 'report_by_payment': + filters['report_type'] = 'Report By Payment' + else: + filters['report_type'] = 'report_by_order' + + return filters + + def get_filter_data(self, option): + r = self.env['pos.report'].search([('id', '=', option[0])]) + default_filters = {} + + + filter_dict = { + 'report_type': r.report_type, + } + filter_dict.update(default_filters) + return filter_dict + + @api.model + def create(self, vals): + print("vals", vals) + + res = super(PosReportGenerator, self).create(vals) + return res + + def write(self, vals): + + + res = super(PosReportGenerator, self).write(vals) + return res + + def _get_report_sub_lines(self, data, report, date_from, date_to): + report_sub_lines = [] + new_filter = None + + if data.get('report_type') == 'report_by_order': + query = ''' + select l.name,l.date_order,l.partner_id,l.amount_total,l.note,l.user_id,res_partner.name,l.name as shop,pos_session.name as session, + res_users.partner_id as user_partner,sum(pos_order_line.qty),l.id as id, + (SELECT res_partner.name as salesman FROM res_partner WHERE res_partner.id = res_users.partner_id) + from pos_order as l + left join pos_session on l.session_id = pos_session.id + left join res_partner on l.partner_id = res_partner.id + left join res_users on l.user_id = res_users.id + left join pos_order_line on l.id = pos_order_line.order_id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where l.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "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,pos_session.name,l.session_id,l.name,l.amount_total,l.note,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.note,l.user_id,res_partner.name,l.name as shop,pos_session.name as session, + res_users.partner_id as user_partner,sum(pos_order_line.qty), pos_order_line.full_product_name, pos_order_line.price_unit,pos_order_line.price_subtotal,pos_order_line.price_subtotal_incl,pos_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 pos_order as l + left join pos_session on l.session_id = pos_session.id + left join res_partner on l.partner_id = res_partner.id + left join res_users on l.user_id = res_users.id + left join pos_order_line on l.id = pos_order_line.order_id + left join product_product on pos_order_line.product_id = product_product.id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where l.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "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,pos_session.name,l.session_id,l.name,l.amount_total,l.note,pos_order_line.full_product_name,pos_order_line.price_unit,pos_order_line.price_subtotal,pos_order_line.price_subtotal_incl,pos_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,l.amount_paid,sum(pos_order_line.qty) as qty, pos_order_line.full_product_name, pos_order_line.price_unit,product_product.default_code,product_category.name + from pos_order as l + left join pos_order_line on l.id = pos_order_line.order_id + left join product_product on pos_order_line.product_id = product_product.id + left join product_template on pos_order_line.product_id = product_template.id + left join product_category on product_category.id = product_template.categ_id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where l.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "l.date_order <= '%s' " % data.get('date_to') + query += "group by l.amount_total,l.amount_paid,pos_order_line.full_product_name,pos_order_line.price_unit,pos_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.qty) as qty,sum(l.price_subtotal) as amount_total,sum(price_subtotal_incl) as total_incl + from pos_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 pos_order on l.order_id = pos_order.id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where pos_order.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "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_salesman': + query =''' + select res_partner.name,sum(pos_order_line.qty) as qty,sum(pos_order_line.price_subtotal) as amount,count(l.id) as order + from pos_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 pos_order_line on l.id = pos_order_line.order_id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where l.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "l.date_order <= '%s' " % data.get('date_to') + query += "group by res_partner.name" + self._cr.execute(query) + report_by_salesman = self._cr.dictfetchall() + report_sub_lines.append(report_by_salesman) + elif data.get('report_type') == 'report_by_payment': + query =''' + select pos_payment_method.name,sum(l.amount_total),pos_session.name as session,pos_config.name as config + from pos_order as l + left join pos_payment on l.id = pos_payment.pos_order_id + left join pos_payment_method on pos_payment.payment_method_id = pos_payment_method.id + left join pos_session on l.session_id = pos_session.id + left join pos_config on pos_session.config_id = pos_config.id + ''' + term = 'Where ' + if data.get('date_from'): + query += "Where l.date_order >= '%s' " % data.get('date_from') + term = 'AND ' + if data.get('date_to'): + query += term + "l.date_order <= '%s' " % data.get('date_to') + query += "group by pos_payment_method.name,pos_session.name,pos_config.name" + self._cr.execute(query) + report_by_payment = self._cr.dictfetchall() + + report_sub_lines.append(report_by_payment) + return report_sub_lines + + def _get_report_total_value(self, data, report): + report_main_lines = [] + if data.get('report_type') == 'report_by_order': + self._cr.execute(''' + select count(l.id) as order,sum(l.amount_total) as amount + from pos_order as l + ''') + 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(line.id) as order,sum(line.price_subtotal) as total,sum(line.price_subtotal_incl) + from pos_order_line as 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(l.product_id) as order,sum(l.price_subtotal) as amount + from pos_order_line as l + ''') + 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): + 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_salesman': + report = ['Report By Salesman'] + elif data['report_type'] == 'report_by_payment': + report = ['Report By Payment'] + 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, + 'POS': report_res, + 'pos_main': report_res_total, + + } + + def get_pos_xlsx_report(self, data, response, report_data, dfr_data): + 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'}) + sub_heading = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '10px', + 'border': 1, + 'border_color': 'black'}) + heading = workbook.add_format( + {'align': 'center', 'bold': True, 'font_size': '10px', + 'border': 2, + 'border_color': 'black'}) + txt = workbook.add_format({'font_size': '10px', 'border': 1}) + txt_l = workbook.add_format( + {'font_size': '10px', 'border': 1, 'bold': True}) + txt_v = workbook.add_format( + {'align': 'right', 'font_size': '10px', 'border': 1}) + sheet.merge_range('A2:H3', + 'Point of Sale Report', + head) + date_head = workbook.add_format({'align': 'center', 'bold': True, + 'font_size': '10px'}) + date_style = workbook.add_format({'align': 'center', + 'font_size': '10px'}) + + if filters.get('report_type') == 'report_by_order': + + sheet.merge_range('B5:D5', 'Report Type: ' + + filters.get('report_type'), txt_l) + + sheet.write('A7', 'PoS', heading) + sheet.write('B7', 'Order', heading) + sheet.write('C7', 'Date Order', heading) + sheet.write('D7', 'Customer', heading) + sheet.write('E7', 'Salesman', heading) + sheet.write('F7', 'Total Qty', heading) + sheet.write('G7', 'Amount Total', heading) + sheet.write('H7', 'Note', 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) + + for rec_data in report_data_main: + one_lst = [] + two_lst = [] + print("iiii", rec_data) + row += 1 + sheet.write(row, col, rec_data['shop'], txt_l) + sheet.write(row, col + 1, rec_data['session'], txt_l) + sheet.write(row, col + 2, rec_data['date_order'], txt_l) + sheet.write(row, col + 3, rec_data['name'], txt_l) + sheet.write(row, col + 4, rec_data['salesman'], txt_l) + sheet.write(row, col + 5, rec_data['sum'], txt_l) + sheet.write(row, col + 6, rec_data['amount_total'], txt_l) + sheet.write(row, col + 7, rec_data['note'], txt_l) + + if filters.get('report_type') == 'report_by_order_detail': + + sheet.merge_range('B5:D5', 'Report Type: ' + + filters.get('report_type'), txt_l) + + sheet.write('A7', 'PoS', heading) + sheet.write('B7', 'Order', heading) + sheet.write('C7', 'Date Order', heading) + sheet.write('D7', 'Customer', heading) + sheet.write('E7', 'Salesman', heading) + sheet.write('F7', 'Product Code', heading) + sheet.write('G7', 'Product Name', heading) + sheet.write('H7', 'Price unit', heading) + sheet.write('I7', 'Qty', heading) + sheet.write('J7', 'Price Subtotal', heading) + sheet.write('K7', 'Price Subtotal Incl', 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: + one_lst = [] + two_lst = [] + print("iiii", rec_data) + row += 1 + sheet.write(row, col, rec_data['shop'], txt_l) + sheet.write(row, col + 1, rec_data['session'], txt_l) + sheet.write(row, col + 2, rec_data['date_order'], txt_l) + sheet.write(row, col + 3, rec_data['name'], txt_l) + sheet.write(row, col + 4, rec_data['salesman'], txt_l) + sheet.write(row, col + 5, rec_data['default_code'], txt_l) + sheet.write(row, col + 6, rec_data['full_product_name'], txt_l) + sheet.write(row, col + 7, rec_data['price_unit'], txt_l) + sheet.write(row, col + 8, rec_data['sum'], txt_l) + sheet.write(row, col + 9, rec_data['price_subtotal'], txt_l) + sheet.write(row, col + 10, rec_data['price_subtotal_incl'], txt_l) + + if filters.get('report_type') == 'report_by_product': + + sheet.merge_range('B5:D5', 'Report Type: ' + + filters.get('report_type'), 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) + sheet.write('F7', 'Amount Total Incl', 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: + one_lst = [] + two_lst = [] + print("iiii", rec_data) + row += 1 + sheet.write(row, col, rec_data['name'], txt_l) + sheet.write(row, col + 1, rec_data['default_code'], txt_l) + sheet.write(row, col + 2, rec_data['full_product_name'], txt_l) + sheet.write(row, col + 3, rec_data['qty'], txt_l) + sheet.write(row, col + 4, rec_data['amount_total'], txt_l) + sheet.write(row, col + 5, rec_data['amount_paid'], txt_l) + + if filters.get('report_type') == 'report_by_categories': + + sheet.merge_range('B5:D5', 'Report Type: ' + + filters.get('report_type'), txt_l) + + sheet.write('A7', 'Category', heading) + sheet.write('B7', 'Qty', heading) + sheet.write('C7', 'Amount Total', heading) + sheet.write('D7', 'Amount Total Incl', 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: + one_lst = [] + two_lst = [] + print("iiii", rec_data) + 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) + sheet.write(row, col + 3, rec_data['total_incl'], txt_l) + + if filters.get('report_type') == 'report_by_salesman': + + sheet.merge_range('B5:D5', 'Report Type: ' + + filters.get('report_type'), txt_l) + + sheet.write('A7', 'Salesman', 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: + one_lst = [] + two_lst = [] + print("iiii", rec_data) + 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_payment': + + sheet.merge_range('B5:D5', 'Report Type: ' + + filters.get('report_type'), txt_l) + + sheet.write('A7', 'Point of Sale', heading) + sheet.write('B7', 'PoS Session', heading) + sheet.write('C7', 'Payment', 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: + one_lst = [] + two_lst = [] + print("iiii", rec_data) + row += 1 + sheet.write(row, col, rec_data['config'], txt_l) + sheet.write(row, col + 1, rec_data['session'], txt_l) + sheet.write(row, col + 2, rec_data['name'], txt_l) + sheet.write(row, col + 3, rec_data['sum'], txt_l) + + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() diff --git a/pos_report_generator/report/__init__.py b/pos_report_generator/report/__init__.py new file mode 100644 index 000000000..2a3d294aa --- /dev/null +++ b/pos_report_generator/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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 pos_order_report diff --git a/pos_report_generator/report/pos_order_report.py b/pos_report_generator/report/pos_order_report.py new file mode 100644 index 000000000..55a7ab0be --- /dev/null +++ b/pos_report_generator/report/pos_order_report.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies(). +# +# 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 PosOrder(models.AbstractModel): + _name = 'report.pos_report_generator.pos_order_report' + + @api.model + def _get_report_values(self, docids, data=None): + if self.env.context.get('pos_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/pos_report_generator/report/pos_order_report.xml b/pos_report_generator/report/pos_order_report.xml new file mode 100644 index 000000000..a9ae1470c --- /dev/null +++ b/pos_report_generator/report/pos_order_report.xml @@ -0,0 +1,478 @@ + + + + + + + + + + + + + + + + + + POS All In One Report + pos.report + qweb-pdf + pos_report_generator.pos_order_report + pos_report_generator.pos_order_report + + + \ No newline at end of file diff --git a/pos_report_generator/security/ir.model.access.csv b/pos_report_generator/security/ir.model.access.csv new file mode 100644 index 000000000..3a035de18 --- /dev/null +++ b/pos_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_pos_report,access.pos.report,model_pos_report,base.group_user,1,1,1,1 diff --git a/pos_report_generator/static/description/assets/icons/check.png b/pos_report_generator/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/check.png differ diff --git a/pos_report_generator/static/description/assets/icons/chevron.png b/pos_report_generator/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/chevron.png differ diff --git a/pos_report_generator/static/description/assets/icons/cogs.png b/pos_report_generator/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/cogs.png differ diff --git a/pos_report_generator/static/description/assets/icons/consultation.png b/pos_report_generator/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/consultation.png differ diff --git a/pos_report_generator/static/description/assets/icons/ecom-black.png b/pos_report_generator/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/ecom-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/education-black.png b/pos_report_generator/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/education-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/hotel-black.png b/pos_report_generator/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/hotel-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/license.png b/pos_report_generator/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/license.png differ diff --git a/pos_report_generator/static/description/assets/icons/lifebuoy.png b/pos_report_generator/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_report_generator/static/description/assets/icons/logo.png b/pos_report_generator/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/logo.png differ diff --git a/pos_report_generator/static/description/assets/icons/manufacturing-black.png b/pos_report_generator/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/pos-black.png b/pos_report_generator/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/pos-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/puzzle.png b/pos_report_generator/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/puzzle.png differ diff --git a/pos_report_generator/static/description/assets/icons/restaurant-black.png b/pos_report_generator/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/service-black.png b/pos_report_generator/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/service-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/trading-black.png b/pos_report_generator/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/trading-black.png differ diff --git a/pos_report_generator/static/description/assets/icons/training.png b/pos_report_generator/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/training.png differ diff --git a/pos_report_generator/static/description/assets/icons/update.png b/pos_report_generator/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/update.png differ diff --git a/pos_report_generator/static/description/assets/icons/user.png b/pos_report_generator/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/user.png differ diff --git a/pos_report_generator/static/description/assets/icons/wrench.png b/pos_report_generator/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pos_report_generator/static/description/assets/icons/wrench.png differ diff --git a/pos_report_generator/static/description/assets/modules/barcode_scanning.png b/pos_report_generator/static/description/assets/modules/barcode_scanning.png new file mode 100644 index 000000000..01a9e99f7 Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/barcode_scanning.png differ diff --git a/pos_report_generator/static/description/assets/modules/barcode_scanning_support.png b/pos_report_generator/static/description/assets/modules/barcode_scanning_support.png new file mode 100644 index 000000000..dbf3f71e9 Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/barcode_scanning_support.png differ diff --git a/pos_report_generator/static/description/assets/modules/dynamic_financial_report.jpg b/pos_report_generator/static/description/assets/modules/dynamic_financial_report.jpg new file mode 100644 index 000000000..c79986ab0 Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/dynamic_financial_report.jpg differ diff --git a/pos_report_generator/static/description/assets/modules/invoice.jpg b/pos_report_generator/static/description/assets/modules/invoice.jpg new file mode 100644 index 000000000..26fb9d33f Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/invoice.jpg differ diff --git a/pos_report_generator/static/description/assets/modules/sale_discount.png b/pos_report_generator/static/description/assets/modules/sale_discount.png new file mode 100644 index 000000000..2901d6ef4 Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/sale_discount.png differ diff --git a/pos_report_generator/static/description/assets/modules/support_package.jpg b/pos_report_generator/static/description/assets/modules/support_package.jpg new file mode 100644 index 000000000..5f7084b86 Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/support_package.jpg differ diff --git a/pos_report_generator/static/description/assets/modules/whatsapp-mail-messaging.jpg b/pos_report_generator/static/description/assets/modules/whatsapp-mail-messaging.jpg new file mode 100644 index 000000000..c7874c7bf Binary files /dev/null and b/pos_report_generator/static/description/assets/modules/whatsapp-mail-messaging.jpg differ diff --git a/pos_report_generator/static/description/assets/screenshots/hero(1).gif b/pos_report_generator/static/description/assets/screenshots/hero(1).gif new file mode 100644 index 000000000..e4441181d Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/hero(1).gif differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report1.png b/pos_report_generator/static/description/assets/screenshots/pos_report1.png new file mode 100644 index 000000000..bfcb375a2 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report1.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report2.png b/pos_report_generator/static/description/assets/screenshots/pos_report2.png new file mode 100644 index 000000000..68b0e640b Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report2.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report3.png b/pos_report_generator/static/description/assets/screenshots/pos_report3.png new file mode 100644 index 000000000..fbbe3c93c Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report3.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report4.png b/pos_report_generator/static/description/assets/screenshots/pos_report4.png new file mode 100644 index 000000000..725e1870a Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report4.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report5.png b/pos_report_generator/static/description/assets/screenshots/pos_report5.png new file mode 100644 index 000000000..b068a3464 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report5.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report6.png b/pos_report_generator/static/description/assets/screenshots/pos_report6.png new file mode 100644 index 000000000..44afb688c Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report6.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/pos_report_menu.png b/pos_report_generator/static/description/assets/screenshots/pos_report_menu.png new file mode 100644 index 000000000..c73fedd09 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/pos_report_menu.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/project_1.png b/pos_report_generator/static/description/assets/screenshots/project_1.png new file mode 100644 index 000000000..78d8b3d4b Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/project_1.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/project_2.png b/pos_report_generator/static/description/assets/screenshots/project_2.png new file mode 100644 index 000000000..91cdc3bec Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/project_2.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/project_3.png b/pos_report_generator/static/description/assets/screenshots/project_3.png new file mode 100644 index 000000000..b208a26e8 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/project_3.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/project_4.png b/pos_report_generator/static/description/assets/screenshots/project_4.png new file mode 100644 index 000000000..067cf25e4 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/project_4.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/project_5.png b/pos_report_generator/static/description/assets/screenshots/project_5.png new file mode 100644 index 000000000..813be7c5b Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/project_5.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/task_1.png b/pos_report_generator/static/description/assets/screenshots/task_1.png new file mode 100644 index 000000000..5477d3484 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/task_1.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/task_2.png b/pos_report_generator/static/description/assets/screenshots/task_2.png new file mode 100644 index 000000000..c9f72e29f Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/task_2.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/task_3.png b/pos_report_generator/static/description/assets/screenshots/task_3.png new file mode 100644 index 000000000..313f91406 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/task_3.png differ diff --git a/pos_report_generator/static/description/assets/screenshots/task_4.png b/pos_report_generator/static/description/assets/screenshots/task_4.png new file mode 100644 index 000000000..cd84a0f47 Binary files /dev/null and b/pos_report_generator/static/description/assets/screenshots/task_4.png differ diff --git a/pos_report_generator/static/description/banner.png b/pos_report_generator/static/description/banner.png new file mode 100644 index 000000000..e071a2bd6 Binary files /dev/null and b/pos_report_generator/static/description/banner.png differ diff --git a/pos_report_generator/static/description/icon.png b/pos_report_generator/static/description/icon.png new file mode 100644 index 000000000..241d07411 Binary files /dev/null and b/pos_report_generator/static/description/icon.png differ diff --git a/pos_report_generator/static/description/index.html b/pos_report_generator/static/description/index.html new file mode 100644 index 000000000..2f25aadac --- /dev/null +++ b/pos_report_generator/static/description/index.html @@ -0,0 +1,629 @@ +
+ +
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+
+

+ POS All In One Report Generator

+

+ POS All In One Dynamic Report For Odoo 14 Community And Enterprise editions +

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ This app useful to provide different PoS Reports to do analysis. It shows the PoS sales analysis of a company in many aspects such as by order,order details, payment,salesman and so on. It can be filtered out based on different date ranges too.

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Community & Enterprise Support

+

+ Available in Odoo 14.0 Community and Enterprise.

+
+
+
+
+ +
+
+

+ Generates Report for a specific date range.

+
+
+ +
+
+ +
+
+

+ Filtering based on different aspects

+
+
+ +
+
+ +
+
+

+ Print Reports in both PDF and XLSX format.

+
+
+ +
+
+ +
+
+

+ Drilled on approach

+
+
+ +
+ +
+
+

+ Screenshots +

+
+
+

+ All In One POS Report Menu

+ +
+ +
+

+ Point Of Sale Report Based On Orders

+ +
+ +
+

+ Point Of Sale Report Based On Order Details

+ + +
+ +
+

+ Point Of Sale Report Based On Product

+ +
+
+

+ Point Of Sale Report Based On Categories

+ +
+
+

+ Point Of Sale Report Based On Salesman

+ +
+
+

+ Point Of Sale Report Based On Payment

+ +
+ +
+ + +
+
+
+

+ Suggested Products

+

+ Check out our other products

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

+ Our Services

+

+ We provide following services

+
+ +
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+
+ + + +
+
+
+

+ Our Industries

+

+ Our industry specifics and process segments to solve your complex business barriers.

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

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

+ Need Help?

+

+ Do you have any queries regarding our products & services? Let us know.

+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
\ No newline at end of file diff --git a/pos_report_generator/static/src/css/pos_report.css b/pos_report_generator/static/src/css/pos_report.css new file mode 100644 index 000000000..7a6e35961 --- /dev/null +++ b/pos_report_generator/static/src/css/pos_report.css @@ -0,0 +1,53 @@ +.time_range_pos { + width: 125px; + border: 2px solid #ccc; + border-radius: 5px; + padding: 10px; +} +a.dropdown-toggle.report-type { + margin: 10px; +} +.search-Result-Selection { + border: 2px solid #ccc; + width: 257px; + margin-right: 10px; + margin-left: 10px; + border-radius: 5px; +} +.table_pos_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.ps-line { + height: 48px; +} +tr.table_pos_head th { + font-size: 18px; + text-align: center; +} +ul.dropdown-menu.show { + height: 40px; + background-color: #eeeeee; + width: 200px; +} +ul.dropdown-menu.show li { + margin-left: 10px; +} + +ul.dropdown-menu.show a{ + + color: #221c1c; +} \ No newline at end of file diff --git a/pos_report_generator/static/src/js/action_manager.js b/pos_report_generator/static/src/js/action_manager.js new file mode 100644 index 000000000..0cb865c7f --- /dev/null +++ b/pos_report_generator/static/src/js/action_manager.js @@ -0,0 +1,44 @@ +odoo.define('pos_report_generator.action_manager', function (require) { +"use strict"; +/** + * The purpose of this file is to add the actions of type + * 'xlsx' to the ActionManager. + */ +var ActionManager = require('web.ActionManager'); +var framework = require('web.framework'); +var session = require('web.session'); +ActionManager.include({ + /** + * Executes actions of type 'ir.actions.report'. + * @private + * @param {Object} action the description of the action to execute + * @param {Object} options @see doAction for details + * @returns {Promise} resolved when the action has been executed + */ + _executeposdynamicxlsxReportDownloadAction: function (action) { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/pos_dynamic_xlsx_reports', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + }, + /** + * Overrides to handle the 'ir.actions.report' actions. + * @override + * @private + */ + _handleAction: function (action, options) { + + if (action.type === 'ir_actions_pos_dynamic_xlsx_download') { + return this._executeposdynamicxlsxReportDownloadAction(action, options); + } + return this._super.apply(this, arguments); + }, +}); + +}); diff --git a/pos_report_generator/static/src/js/pos_report.js b/pos_report_generator/static/src/js/pos_report.js new file mode 100644 index 000000000..0a575bc55 --- /dev/null +++ b/pos_report_generator/static/src/js/pos_report.js @@ -0,0 +1,225 @@ +odoo.define('pos_report_generator.pos_report', function(require) { + 'use strict'; + var AbstractAction = require('web.AbstractAction'); + var core = require('web.core'); + var rpc = require('web.rpc'); + var QWeb = core.qweb; + var _t = core._t; + var datepicker = require('web.datepicker'); + var time = require('web.time'); + + var PosReport = AbstractAction.extend({ + template: 'PosReport', + events: { + 'click #apply_filter': 'apply_filter', + 'click #pdf': 'print_pdf', + 'click #xlsx': 'print_xlsx', + 'click .view_pos_order': 'button_view_order', + 'mousedown div.input-group.date[data-target-input="nearest"]': '_onCalendarIconClick', + + + }, + + + init: function(parent, action) { + this._super(parent, action); + this.report_lines = action.report_lines; + this.wizard_id = action.context.wizard | null; + + }, + start: function() { + var self = this; + self.initial_render = true; + + rpc.query({ + model: 'pos.report', + method: 'create', + args: [{ + + }] + }).then(function(res) { + self.wizard_id = res; + self.load_data(self.initial_render); + self.apply_filter(); + }) + }, + + _onCalendarIconClick: function(ev) { + var $calendarInputGroup = $(ev.currentTarget); + + var calendarOptions = { + + minDate: moment({ + y: 1000 + }), + maxDate: moment().add(200, 'y'), + calendarWeeks: true, + defaultDate: moment().format(), + sideBySide: true, + buttons: { + showClear: true, + showClose: true, + showToday: true, + }, + + icons: { + date: 'fa fa-calendar', + + }, + locale: moment.locale(), + format: time.getLangDateFormat(), + widgetParent: 'body', + allowInputToggle: true, + }; + + $calendarInputGroup.datetimepicker(calendarOptions); + }, + + + load_data: function(initial_render = true) { + var self = this; + self._rpc({ + model: 'pos.report', + method: 'pos_report', + args: [ + [this.wizard_id] + ], + }).then(function(datas) { + if (initial_render) { + self.$('.filter_view_pr').html(QWeb.render('posFilterView', { + filter_data: datas['filters'], + + })); + self.$el.find('.report_type').select2({ + placeholder: ' Report Type...', + }); + + } + if (datas['orders']) + self.$('.table_view_pr').html(QWeb.render('PosOrderTable', { + filter: datas['filters'], + order: datas['orders'], + report_lines: datas['report_lines'], + main_lines: datas['report_main_line'] + + })); + }) + }, + + print_pdf: function(e) { + e.preventDefault(); + var self = this; + var action_title = self._title; + self._rpc({ + model: 'pos.report', + method: 'pos_report', + args: [ + [self.wizard_id] + ], + }).then(function(data) { + var action = { + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name': 'pos_report_generator.pos_order_report', + 'report_file': 'pos_report_generator.pos_order_report', + 'data': { + 'report_data': data + }, + 'context': { + 'active_model': 'pos.report', + 'landscape': 1, + 'pos_order_report': true + + }, + 'display_name': 'PoS Order', + }; + return self.do_action(action); + }); + + }, + print_xlsx: function() { + var self = this; + self._rpc({ + model: 'pos.report', + method: 'pos_report', + args: [ + [self.wizard_id] + ], + }).then(function(data) { + + var action = { + 'type': 'ir_actions_pos_dynamic_xlsx_download', + 'data': { + 'model': 'pos.report', + 'options': JSON.stringify(data['orders']), + 'output_format': 'xlsx', + 'report_data': JSON.stringify(data['report_lines']), + 'report_name': 'PoS Report', + 'dfr_data': JSON.stringify(data), + }, + }; + return self.do_action(action).then(function(data) { + }); + }); + }, + + button_view_order: function(event) { + event.preventDefault(); + var self = this; + var context = {}; + this.do_action({ + name: _t("PoS Order"), + type: 'ir.actions.act_window', + res_model: 'pos.order', + view_type: 'form', + domain: [ + ['id', '=', $(event.target).closest('.view_pos_order').attr('id')] + ], + views: [ + [false, 'list'], + [false, 'form'] + ], + target: 'current' + }); + }, + // + apply_filter: function() { +// event.preventDefault(); + var self = this; + self.initial_render = false; + + var filter_data_selected = {}; + + if (this.$el.find('.datetimepicker-input[name="date_from"]').val()) { + filter_data_selected.date_from = moment(this.$el.find('.datetimepicker-input[name="date_from"]').val(), time.getLangDateFormat()).locale('en').format('YYYY-MM-DD'); + } + + if (this.$el.find('.datetimepicker-input[name="date_to"]').val()) { + filter_data_selected.date_to = moment(this.$el.find('.datetimepicker-input[name="date_to"]').val(), time.getLangDateFormat()).locale('en').format('YYYY-MM-DD'); + } + if ($(".report_type").length) { + var report_res = document.getElementById("report_res") + filter_data_selected.report_type = $(".report_type")[1].value + report_res.value = $(".report_type")[1].value + report_res.innerHTML = report_res.value; + if ($(".report_type")[1].value == "") { + report_res.innerHTML = "report_by_order"; + + } + } + rpc.query({ + model: 'pos.report', + method: 'write', + args: [ + self.wizard_id, filter_data_selected + ], + }).then(function(res) { + self.initial_render = false; + self.load_data(self.initial_render); + }); + }, + + }); + core.action_registry.add("p_r", PosReport); + return PosReport; +}); \ No newline at end of file diff --git a/pos_report_generator/static/src/xml/pos_report_view.xml b/pos_report_generator/static/src/xml/pos_report_view.xml new file mode 100644 index 000000000..e5385cf6d --- /dev/null +++ b/pos_report_generator/static/src/xml/pos_report_view.xml @@ -0,0 +1,490 @@ + + +
+
+
+

Point of Sale Report

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

+ +
+
+ + + Date Range + + +
+
+ + + Report Type: + + + +
+
+ +
+
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PoSOrderDate OrderCustomerSalesmanTotal QtyAmount TotalNote
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PoSOrderDate OrderCustomerSalesmanProduct CodeProduct NamePrice unitQtyPrice SubtotalPrice Subtotal Incl
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
CategoryProduct CodeProduct NameQtyAmount TotalAmount Total Incl
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
CategoryQtyAmount TotalAmount Total Incl
+ + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
SalesmanTotal OrderTotal QtyTotal Amount
+ + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + +
Point of SalePoS SessionPaymentTotal Amount
+ + + + + + + + + + + + + + + + +
+
+
+
+ diff --git a/pos_report_generator/views/pos_report.xml b/pos_report_generator/views/pos_report.xml new file mode 100644 index 000000000..94138290c --- /dev/null +++ b/pos_report_generator/views/pos_report.xml @@ -0,0 +1,12 @@ + + + + Pos Report + p_r + + + + + \ No newline at end of file diff --git a/pos_report_generator/views/templates.xml b/pos_report_generator/views/templates.xml new file mode 100644 index 000000000..d54dcbc5c --- /dev/null +++ b/pos_report_generator/views/templates.xml @@ -0,0 +1,16 @@ + + + +