diff --git a/advanced_pos_reports/README.rst b/advanced_pos_reports/README.rst new file mode 100755 index 000000000..475a74d3a --- /dev/null +++ b/advanced_pos_reports/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Advanced POS Reports +===================== +Generates Various Reports From POS Screen and From Reporting Menu. + +Configuration +============= +- www.odoo.com/documentation/16.0/setup/install.html +- Install our custom addon + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Lesser General Public License, Version 3 (LGPL-3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +* Developer: + (V16) Sruthi Pavithran, 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/advanced_pos_reports/__init__.py b/advanced_pos_reports/__init__.py new file mode 100644 index 000000000..093ad90ee --- /dev/null +++ b/advanced_pos_reports/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models +from . import report +from . import wizard diff --git a/advanced_pos_reports/__manifest__.py b/advanced_pos_reports/__manifest__.py new file mode 100644 index 000000000..b87c6e801 --- /dev/null +++ b/advanced_pos_reports/__manifest__.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Advanced POS Reports', + 'version': '16.0.1.0.0', + 'category': 'Point of Sale', + 'summary': """Generates various reports from POS screen and reporting + menu""", + 'description': """Generates various reports like, top + selling products / categories / customers report, ongoing sessions report, + posted sessions report under reporting menu.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['pos_sale'], + 'data': [ + 'security/ir.model.access.csv', + 'wizard/advanced_pos_reports_wizard.xml', + 'wizard/pos_sale_ongoing_views.xml', + 'wizard/pos_sale_posted_views.xml', + 'wizard/pos_sale_top_selling_views.xml', + 'report/advanced_pos_reports.xml', + 'report/pos_ongoing_session_templates.xml', + 'report/pos_posted_session_templates.xml', + 'report/pos_top_selling_categories_templates.xml', + 'report/pos_top_selling_customers_templates.xml', + 'report/pos_top_selling_products_templates.xml', + ], + 'assets': { + 'point_of_sale.assets': [ + 'advanced_pos_reports/static/src/js/Category.js', + 'advanced_pos_reports/static/src/js/CategoryPopup.js', + 'advanced_pos_reports/static/src/js/CategoryReceipt.js', + 'advanced_pos_reports/static/src/js/ReceiptScreen.js', + 'advanced_pos_reports/static/src/xml/Category_templates.xml', + 'advanced_pos_reports/static/src/xml/Popup_templates.xml', + 'advanced_pos_reports/static/src/xml/CategoryReceipt_templates.xml', + 'advanced_pos_reports/static/src/xml/ReceiptScreen_templates.xml', + 'advanced_pos_reports/static/src/js/Location.js', + 'advanced_pos_reports/static/src/js/LocationPopup.js', + 'advanced_pos_reports/static/src/js/LocationReceipt.js', + 'advanced_pos_reports/static/src/js/LocationReceiptScreen.js', + 'advanced_pos_reports/static/src/xml/Location_templates.xml', + 'advanced_pos_reports/static/src/xml/LocationPopup_templates.xml', + 'advanced_pos_reports/static/src/xml/LocationReceipt_templates.xml', + 'advanced_pos_reports/static/src/xml/LocationReceiptScreen_templates.xml', + 'advanced_pos_reports/static/src/js/Order.js', + 'advanced_pos_reports/static/src/js/OrderPopup.js', + 'advanced_pos_reports/static/src/js/OrderReceipt.js', + 'advanced_pos_reports/static/src/js/OrderReceiptScreen.js', + 'advanced_pos_reports/static/src/xml/Order_templates.xml', + 'advanced_pos_reports/static/src/xml/OrderPopup_templates.xml', + 'advanced_pos_reports/static/src/xml/OrderReceipt_templates.xml', + 'advanced_pos_reports/static/src/xml/OrderReceiptScreen_templates.xml', + 'advanced_pos_reports/static/src/js/Payment.js', + 'advanced_pos_reports/static/src/js/PaymentPopup.js', + 'advanced_pos_reports/static/src/js/PaymentReceipt.js', + 'advanced_pos_reports/static/src/js/PaymentReceiptScreen.js', + 'advanced_pos_reports/static/src/xml/Payment_templates.xml', + 'advanced_pos_reports/static/src/xml/PaymentPopup_templates.xml', + 'advanced_pos_reports/static/src/xml/PaymentReceipt_templates.xml', + 'advanced_pos_reports/static/src/xml/PaymentReceiptScreen_templates.xml', + 'advanced_pos_reports/static/src/js/Product.js', + 'advanced_pos_reports/static/src/js/ProductPopup.js', + 'advanced_pos_reports/static/src/js/ProductReceipt.js', + 'advanced_pos_reports/static/src/js/ProductReceiptScreen.js', + 'advanced_pos_reports/static/src/xml/Product_templates.xml', + 'advanced_pos_reports/static/src/xml/ProductPopup_templates.xml', + 'advanced_pos_reports/static/src/xml/ProductReceipt_templates.xml', + 'advanced_pos_reports/static/src/xml/ProductReceiptScreen_templates.xml' + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/advanced_pos_reports/doc/RELEASE_NOTES.md b/advanced_pos_reports/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..f9f287666 --- /dev/null +++ b/advanced_pos_reports/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 29.11.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial Commit for Advanced POS Reports. diff --git a/advanced_pos_reports/models/__init__.py b/advanced_pos_reports/models/__init__.py new file mode 100644 index 000000000..b3db4b134 --- /dev/null +++ b/advanced_pos_reports/models/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import pos_config +from . import pos_order +from . import pos_payment diff --git a/advanced_pos_reports/models/pos_config.py b/advanced_pos_reports/models/pos_config.py new file mode 100644 index 000000000..bec974170 --- /dev/null +++ b/advanced_pos_reports/models/pos_config.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models + + +class PosConfig(models.Model): + """Inheriting pos config to get location summary""" + _inherit = 'pos.config' + + def get_location_summary(self, location_id): + """Function to get location details""" + location_quant = self.env['stock.quant'].search( + [('location_id', '=', int(location_id))]) + for quant in location_quant.filtered( + lambda x: x.product_id.available_in_pos): + location_summary = [ + { + 'product_id': quant.product_id.id, + 'product': quant.product_id.name, + 'quantity': quant.available_quantity, + } + ] + return location_summary diff --git a/advanced_pos_reports/models/pos_order.py b/advanced_pos_reports/models/pos_order.py new file mode 100644 index 000000000..385974be6 --- /dev/null +++ b/advanced_pos_reports/models/pos_order.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models + + +class PosOrder(models.Model): + """Get details from pos order""" + _inherit = 'pos.order' + + def get_category_summary(self, order_ids): + """Function to get category details""" + categories = [] + if order_ids: + self.env.cr.execute("""SELECT category.name,category.id, + sum(price_subtotal_incl) as amount, + sum(qty) as qty FROM pos_order_line AS line INNER JOIN + product_product AS product ON + line.product_id = product.id INNER JOIN + product_template AS template ON + product.product_tmpl_id = template.id + INNER JOIN pos_category as category ON + template.pos_categ_id = category.id + WHERE line.order_id IN %s GROUP BY + category.name,category.id """, + (tuple(order_ids),)) + categories = self.env.cr.dictfetchall() + return categories + + def get_product_summary(self, order_ids): + """Function to get product details""" + product_summary = [] + if order_ids: + self.env.cr.execute(""" + SELECT product.id, template.name, product.default_code as code, + sum(qty) as qty + FROM product_product AS product, + pos_order_line AS line, product_template AS template + WHERE product.id = line.product_id AND + template.id = product.product_tmpl_id + AND line.order_id IN %s + GROUP BY product.id, template.name, template.default_code + """, (tuple(order_ids),)) + product_summary = self.env.cr.dictfetchall() + return product_summary + + def get_order_summary(self, order_ids): + """Function to get order details""" + orders = self.env["pos.order"].browse(order_ids) + order_summary = [] + for order in orders: + order_summary.append( + {'order_name': order.name, + 'state': dict(self._fields['state'].selection).get( + order.state), + 'date_order': order.date_order, + 'amount_total': order.amount_total}) + return order_summary diff --git a/advanced_pos_reports/models/pos_payment.py b/advanced_pos_reports/models/pos_payment.py new file mode 100644 index 000000000..0c20cf5e7 --- /dev/null +++ b/advanced_pos_reports/models/pos_payment.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import models + + +class PosPayment(models.Model): + """Get payment details of pos session""" + _inherit = 'pos.payment' + + def get_payment_summary(self, order_ids): + """Function to get payment details""" + payments_summary = [] + if order_ids: + self.env.cr.execute(""" + SELECT method.name,method.id, sum(amount) total + FROM pos_payment AS payment, + pos_payment_method AS method + WHERE payment.payment_method_id = method.id + AND payment.id IN %s + GROUP BY method.name,method.id + """, (tuple(order_ids),)) + payments_summary = self.env.cr.dictfetchall() + return payments_summary diff --git a/advanced_pos_reports/report/__init__.py b/advanced_pos_reports/report/__init__.py new file mode 100644 index 000000000..f45d57f38 --- /dev/null +++ b/advanced_pos_reports/report/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import pos_ongoing_session_report +from . import pos_posted_session_report +from . import pos_top_selling_products_report +from . import pos_top_selling_categories_report +from . import pos_top_selling_customers_report diff --git a/advanced_pos_reports/report/advanced_pos_reports.xml b/advanced_pos_reports/report/advanced_pos_reports.xml new file mode 100644 index 000000000..5aa258387 --- /dev/null +++ b/advanced_pos_reports/report/advanced_pos_reports.xml @@ -0,0 +1,38 @@ + + + + + Posted Sessions + report.advanced_pos_reports.report_pos_posted_session + qweb-pdf + advanced_pos_reports.report_pos_posted_session + + + + Ongoing Sessions + report.advanced_pos_reports.report_pos_ongoing_session + qweb-pdf + advanced_pos_reports.report_pos_ongoing_session + + + + Top Selling Products Report + report.advanced_pos_reports.report_pos_top_selling_products + qweb-pdf + advanced_pos_reports.report_pos_top_selling_products + + + + Top Selling Categories Report + report.advanced_pos_reports.report_pos_top_selling_categories + qweb-pdf + advanced_pos_reports.report_pos_top_selling_categories + + + + Top Selling Customers Report + report.advanced_pos_reports.report_pos_top_selling_customers + qweb-pdf + advanced_pos_reports.report_pos_top_selling_customers + + diff --git a/advanced_pos_reports/report/pos_ongoing_session_report.py b/advanced_pos_reports/report/pos_ongoing_session_report.py new file mode 100644 index 000000000..6e1fbf49a --- /dev/null +++ b/advanced_pos_reports/report/pos_ongoing_session_report.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class ReportPosOngoingSession(models.AbstractModel): + """Generate ongoing session report of pos""" + _name = 'report.advanced_pos_reports.report_pos_ongoing_session' + _description = "Ongoing POS Session Report" + + def get_ongoing_sessions_details(self, session_ids=False): + """Function to get ongoing session details""" + if session_ids: + sessions = self.env['pos.session'].search( + [('state', '=', 'opened'), + ('id', 'in', session_ids)]) + amount_total_without_tax = 0 + amount_total_tax = 0 + amount_total_return = 0 + orders = [] + for session in sessions: + for order in session.order_ids.filtered( + lambda x: x.state in ['paid', 'done', 'invoiced']): + orders.append(order.id) + currency = order.pricelist_id.currency_id + amount_tax = currency.round(sum( + order._amount_line_tax(line, order.fiscal_position_id) + for line in order.lines)) + amount_untaxed = currency.round( + sum(line.price_subtotal for line in order.lines)) + amount_return = sum( + payment.amount < 0 and payment.amount or 0 for payment + in + order.payment_ids) + amount_total_without_tax += amount_untaxed + amount_total_tax += amount_tax + amount_total_return += amount_return + order_ids = self.env["pos.order"].browse(orders) + user_currency = self.env.company.currency_id + total = 0.0 + for order in order_ids: + if user_currency != order.pricelist_id.currency_id: + total += order.pricelist_id.currency_id._convert( + order.amount_total, user_currency, order.company_id, + order.date_order or fields.Date.today()) + else: + total += order.amount_total + categories = [] + if order_ids: + self.env.cr.execute("""SELECT category.name, + sum(price_subtotal_incl) as amount FROM pos_order_line AS line, + pos_category AS category, product_product AS product INNER JOIN + product_template AS template ON + product.product_tmpl_id = template.id WHERE + line.product_id = product.id + AND template.pos_categ_id = category.id + AND line.order_id IN %s GROUP BY category.name """, + (tuple(order_ids.ids),)) + categories = self.env.cr.dictfetchall() + + payment_ids = self.env["pos.payment"].search( + [('pos_order_id', 'in', order_ids.ids)]).ids + if payment_ids: + self.env.cr.execute(""" + SELECT method.name, sum(amount) total + FROM pos_payment AS payment, + pos_payment_method AS method + WHERE payment.payment_method_id = method.id + AND payment.id IN %s + GROUP BY method.name + """, (tuple(payment_ids),)) + payments = self.env.cr.dictfetchall() + else: + payments = [] + return { + 'sessions': sessions, + 'categories': categories, + 'today': fields.Datetime.now(), + 'total_paid': user_currency.round(total), + 'amount_total_without_tax': amount_total_without_tax, + 'amount_total_tax': amount_total_tax, + 'amount_return': amount_total_return, + 'amount_total': total, + 'payments': payments + } + + @api.model + def _get_report_values(self, docids, data=None): + """Get ongoing session report values""" + data = dict(data or {}) + data.update(self.get_ongoing_sessions_details(data['session_ids'])) + return data diff --git a/advanced_pos_reports/report/pos_ongoing_session_templates.xml b/advanced_pos_reports/report/pos_ongoing_session_templates.xml new file mode 100644 index 000000000..9197da795 --- /dev/null +++ b/advanced_pos_reports/report/pos_ongoing_session_templates.xml @@ -0,0 +1,134 @@ + + + + + diff --git a/advanced_pos_reports/report/pos_posted_session_report.py b/advanced_pos_reports/report/pos_posted_session_report.py new file mode 100644 index 000000000..dddf8442c --- /dev/null +++ b/advanced_pos_reports/report/pos_posted_session_report.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class ReportPosPostedSession(models.AbstractModel): + """Generate posted session report of pos""" + _name = 'report.advanced_pos_reports.report_pos_posted_session' + _description = "Report for POS Posted Session" + + def get_posted_sessions_details(self, session_ids=False): + """Get posted session details""" + if session_ids: + sessions = self.env['pos.session'].search( + [('id', 'in', session_ids), + ('state', '=', 'closed')]) + amount_total_without_tax = 0 + amount_total_tax = 0 + amount_total_return = 0 + orders = [] + for session in sessions: + for order in session.order_ids.filtered(lambda x: x.state in + ['paid', 'done', + 'invoiced']): + orders.append(order.id) + currency = order.pricelist_id.currency_id + amount_tax = currency.round( + sum(order._amount_line_tax(line, + order.fiscal_position_id) + for line in order.lines)) + amount_untaxed = currency.round(sum + (line.price_subtotal for + line + in order.lines)) + amount_return = sum( + payment.amount < 0 and payment.amount or + 0 for payment in order.payment_ids) + amount_total_without_tax += amount_untaxed + amount_total_tax += amount_tax + amount_total_return += amount_return + order_ids = self.env["pos.order"].browse(orders) + user_currency = self.env.company.currency_id + + total = 0.0 + for order in order_ids: + if user_currency != order.pricelist_id.currency_id: + total += order.pricelist_id.currency_id._convert( + order.amount_total, user_currency, order.company_id, + order.date_order or fields.Date.today()) + else: + total += order.amount_total + + categories = [] + if order_ids: + self.env.cr.execute("""SELECT category.name, + sum(price_subtotal_incl) as amount FROM pos_order_line AS line, + pos_category AS category, product_product AS product INNER JOIN + product_template AS template ON + product.product_tmpl_id = template.id WHERE + line.product_id = product.id + AND template.pos_categ_id = category.id + AND line.order_id IN %s GROUP BY category.name """, + (tuple(order_ids.ids),)) + categories = self.env.cr.dictfetchall() + + payment_ids = self.env["pos.payment"].search([ + ('pos_order_id', 'in', order_ids.ids)]).ids + if payment_ids: + self.env.cr.execute(""" + SELECT method.name, sum(amount) total + FROM pos_payment AS payment, + pos_payment_method AS method + WHERE payment.payment_method_id = method.id + AND payment.id IN %s + GROUP BY method.name + """, (tuple(payment_ids),)) + payments = self.env.cr.dictfetchall() + else: + payments = [] + return { + 'sessions': sessions, + 'categories': categories, + 'today': fields.Datetime.now(), + 'total_paid': user_currency.round(total), + 'amount_total_without_tax': amount_total_without_tax, + 'amount_total_tax': amount_total_tax, + 'amount_return': amount_total_return, + 'amount_total': total, + 'payments': payments + } + + @api.model + def _get_report_values(self, docids, data=None): + """Get report values to generate posted session report""" + data = dict(data or {}) + data.update(self.get_posted_sessions_details(data['session_ids'])) + return data diff --git a/advanced_pos_reports/report/pos_posted_session_templates.xml b/advanced_pos_reports/report/pos_posted_session_templates.xml new file mode 100644 index 000000000..7a27a4ca6 --- /dev/null +++ b/advanced_pos_reports/report/pos_posted_session_templates.xml @@ -0,0 +1,150 @@ + + + + + diff --git a/advanced_pos_reports/report/pos_top_selling_categories_report.py b/advanced_pos_reports/report/pos_top_selling_categories_report.py new file mode 100644 index 000000000..ba9ecbf9b --- /dev/null +++ b/advanced_pos_reports/report/pos_top_selling_categories_report.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class ReportPosTopSellingCategories(models.AbstractModel): + """Generate top_selling categories report""" + _name = 'report.advanced_pos_reports.report_pos_top_selling_categories' + _description = "Report for Top Selling POS Categories" + + def get_top_selling_categories_details(self, no_of_categories=None, + start_date=False, end_date=False): + """Get top_selling categories details""" + order_ids = self.env["pos.order"].search( + [('date_order', '>=', start_date), + ('date_order', '<=', end_date), + ('state', 'in', ['paid', 'done', 'invoiced'])]) + if order_ids: + query = """ + SELECT category.name, sum(price_subtotal_incl) as amount + FROM pos_order_line AS line,pos_category AS category, + product_product AS product INNER JOIN + product_template AS template ON + product.product_tmpl_id = template.id WHERE + line.product_id = product.id + AND template.pos_categ_id = category.id + AND line.order_id IN %s + GROUP BY category.name ORDER BY amount DESC + """ + if no_of_categories > 0: + query += " LIMIT %s" + self.env.cr.execute(query, + (tuple(order_ids.ids), no_of_categories)) + else: + self.env.cr.execute(query, (tuple(order_ids.ids),)) + categories = self.env.cr.dictfetchall() + return { + 'categories': categories or [], + 'today': fields.Datetime.now(), + 'start_date': start_date, + 'end_date': end_date + } + + @api.model + def _get_report_values(self, docids, data=None): + """Get report values""" + data = dict(data or {}) + data.update( + self.get_top_selling_categories_details(data['no_of_categories'], + data['start_date'], + data['end_date'])) + return data diff --git a/advanced_pos_reports/report/pos_top_selling_categories_templates.xml b/advanced_pos_reports/report/pos_top_selling_categories_templates.xml new file mode 100644 index 000000000..87017afdc --- /dev/null +++ b/advanced_pos_reports/report/pos_top_selling_categories_templates.xml @@ -0,0 +1,65 @@ + + + + + diff --git a/advanced_pos_reports/report/pos_top_selling_customers_report.py b/advanced_pos_reports/report/pos_top_selling_customers_report.py new file mode 100644 index 000000000..2cd026a37 --- /dev/null +++ b/advanced_pos_reports/report/pos_top_selling_customers_report.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class ReportPosTopSellingCustomers(models.AbstractModel): + """Generate top_selling customers report of pos""" + _name = 'report.advanced_pos_reports.report_pos_top_selling_customers' + _description = "Report for Top Selling POS Customers" + + def get_top_selling_customers_details(self, no_of_customers=None, + start_date=False, end_date=False): + """Get top_selling customers details""" + order_ids = self.env["pos.order"].search([ + ('date_order', '>=', start_date), + ('date_order', '<=', end_date), + ('state', 'in', ['paid', 'done', 'invoiced'])]) + if order_ids: + query = """ + SELECT partner.id, partner.name, + sum(amount_total) as amount FROM pos_order, + res_partner AS partner + WHERE partner.id= pos_order.partner_id AND + pos_order.id IN %s GROUP BY partner.id, partner.name + ORDER BY amount DESC + """ + if no_of_customers > 0: + query += " LIMIT %s" + self.env.cr.execute(query, + (tuple(order_ids.ids), no_of_customers)) + else: + self.env.cr.execute(query, (tuple(order_ids.ids),)) + customers = self.env.cr.dictfetchall() + return { + 'customers': customers or [], + 'today': fields.Datetime.now(), + 'start_date': start_date, + 'end_date': end_date + } + + @api.model + def _get_report_values(self, docids, data=None): + """Get report values""" + data = dict(data or {}) + data.update(self.get_top_selling_customers_details( + data['no_of_customers'], data['start_date'], data['end_date'])) + return data diff --git a/advanced_pos_reports/report/pos_top_selling_customers_templates.xml b/advanced_pos_reports/report/pos_top_selling_customers_templates.xml new file mode 100644 index 000000000..679f58676 --- /dev/null +++ b/advanced_pos_reports/report/pos_top_selling_customers_templates.xml @@ -0,0 +1,64 @@ + + + + + diff --git a/advanced_pos_reports/report/pos_top_selling_products_report.py b/advanced_pos_reports/report/pos_top_selling_products_report.py new file mode 100644 index 000000000..d5105626b --- /dev/null +++ b/advanced_pos_reports/report/pos_top_selling_products_report.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class ReportPosTopSellingProducts(models.AbstractModel): + """Generate top_selling products from pos""" + _name = 'report.advanced_pos_reports.report_pos_top_selling_products' + _description = "Report for POS Top Selling Products" + + def get_top_selling_products_details(self, + no_of_products=None, + start_date=False, end_date=False): + """Get top_selling products details""" + order_ids = self.env["pos.order"].search( + [('date_order', '>=', start_date), + ('date_order', '<=', end_date), + ('state', 'in', ['paid', 'done', 'invoiced'])]) + + if order_ids: + query = """ + SELECT product.id, template.name, uom.name AS uom, + product.default_code as code, sum(qty) as qty, + sum(line.price_subtotal_incl) as total FROM + product_product AS product, pos_order_line AS line, + product_template AS template , uom_uom AS uom WHERE + product.id = line.product_id AND + template.id = product.product_tmpl_id AND + uom.id = template.uom_id AND line.order_id IN %s + GROUP BY product.id, template.name, + template.default_code, uom.name ORDER BY qty DESC + """ + if no_of_products > 0: + query += " LIMIT %s" + self.env.cr.execute(query, + (tuple(order_ids.ids), no_of_products)) + else: + self.env.cr.execute(query, (tuple(order_ids.ids),)) + + product_summary = self.env.cr.dictfetchall() + + return { + 'products': product_summary, + 'today': fields.Datetime.now(), + 'start_date': start_date, + 'end_date': end_date + } + + @api.model + def _get_report_values(self, docids, data=None): + """Get report values""" + data = dict(data or {}) + data.update( + self.get_top_selling_products_details(data['no_of_products'], + data['start_date'], + data['end_date'])) + return data diff --git a/advanced_pos_reports/report/pos_top_selling_products_templates.xml b/advanced_pos_reports/report/pos_top_selling_products_templates.xml new file mode 100644 index 000000000..42ca7e92d --- /dev/null +++ b/advanced_pos_reports/report/pos_top_selling_products_templates.xml @@ -0,0 +1,71 @@ + + + + + diff --git a/advanced_pos_reports/security/ir.model.access.csv b/advanced_pos_reports/security/ir.model.access.csv new file mode 100644 index 000000000..87a75c2ae --- /dev/null +++ b/advanced_pos_reports/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_pos_sale_top_selling_user,access.pos.sale.top.selling.user,model_pos_sale_top_selling,point_of_sale.group_pos_manager,1,1,1,0 +access_pos_sale_ongoing_user,access.pos.sale.ongoing.user,model_pos_sale_ongoing,point_of_sale.group_pos_manager,1,1,1,0 +access_pos_sale_posted_user,access.pos.sale.posted.user,model_pos_sale_posted,point_of_sale.group_pos_manager,1,1,1,0 diff --git a/advanced_pos_reports/static/description/assets/icons/check.png b/advanced_pos_reports/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/check.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/chevron.png b/advanced_pos_reports/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/chevron.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/cogs.png b/advanced_pos_reports/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/cogs.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/consultation.png b/advanced_pos_reports/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/consultation.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/ecom-black.png b/advanced_pos_reports/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/ecom-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/education-black.png b/advanced_pos_reports/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/education-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/hotel-black.png b/advanced_pos_reports/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/hotel-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/license.png b/advanced_pos_reports/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/license.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/lifebuoy.png b/advanced_pos_reports/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/lifebuoy.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/manufacturing-black.png b/advanced_pos_reports/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/manufacturing-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/pos-black.png b/advanced_pos_reports/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/pos-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/puzzle.png b/advanced_pos_reports/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/puzzle.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/restaurant-black.png b/advanced_pos_reports/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/restaurant-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/service-black.png b/advanced_pos_reports/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/service-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/trading-black.png b/advanced_pos_reports/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/trading-black.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/training.png b/advanced_pos_reports/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/training.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/update.png b/advanced_pos_reports/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/update.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/user.png b/advanced_pos_reports/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/user.png differ diff --git a/advanced_pos_reports/static/description/assets/icons/wrench.png b/advanced_pos_reports/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/advanced_pos_reports/static/description/assets/icons/wrench.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/categories.png b/advanced_pos_reports/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/categories.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/check-box.png b/advanced_pos_reports/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/check-box.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/compass.png b/advanced_pos_reports/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/compass.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/corporate.png b/advanced_pos_reports/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/corporate.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/customer-support.png b/advanced_pos_reports/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/customer-support.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/cybrosys-logo.png b/advanced_pos_reports/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/cybrosys-logo.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/features.png b/advanced_pos_reports/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/features.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/logo.png b/advanced_pos_reports/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/logo.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/pictures.png b/advanced_pos_reports/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/pictures.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/pie-chart.png b/advanced_pos_reports/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/pie-chart.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/right-arrow.png b/advanced_pos_reports/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/right-arrow.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/star.png b/advanced_pos_reports/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/star.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/support.png b/advanced_pos_reports/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/support.png differ diff --git a/advanced_pos_reports/static/description/assets/misc/whatsapp.png b/advanced_pos_reports/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/misc/whatsapp.png differ diff --git a/advanced_pos_reports/static/description/assets/modules/1.png b/advanced_pos_reports/static/description/assets/modules/1.png new file mode 100644 index 000000000..17c14989e Binary files /dev/null and b/advanced_pos_reports/static/description/assets/modules/1.png differ diff --git a/advanced_pos_reports/static/description/assets/modules/2.png b/advanced_pos_reports/static/description/assets/modules/2.png new file mode 100644 index 000000000..d1d3775d6 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/modules/2.png differ diff --git a/advanced_pos_reports/static/description/assets/modules/3.png b/advanced_pos_reports/static/description/assets/modules/3.png new file mode 100644 index 000000000..759574472 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/modules/3.png differ diff --git a/advanced_pos_reports/static/description/assets/modules/4.png b/advanced_pos_reports/static/description/assets/modules/4.png new file mode 100644 index 000000000..dcbd0cb06 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/modules/4.png differ diff --git a/advanced_pos_reports/static/description/assets/modules/5.png b/advanced_pos_reports/static/description/assets/modules/5.png new file mode 100644 index 000000000..a77027978 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/modules/5.png differ diff --git a/advanced_pos_reports/static/description/assets/modules/6.png b/advanced_pos_reports/static/description/assets/modules/6.png new file mode 100644 index 000000000..fd1f87699 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/modules/6.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advance_003.png b/advanced_pos_reports/static/description/assets/screenshots/advance_003.png new file mode 100644 index 000000000..3759fcec1 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advance_003.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advance_006.png b/advanced_pos_reports/static/description/assets/screenshots/advance_006.png new file mode 100644 index 000000000..c2eed4f2e Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advance_006.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos.png new file mode 100644 index 000000000..871e4781b Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_01.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_01.png new file mode 100644 index 000000000..f2343dced Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_01.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt.png new file mode 100644 index 000000000..fa97f3d20 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_01.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_01.png new file mode 100644 index 000000000..fbc8aac51 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_01.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_02.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_02.png new file mode 100644 index 000000000..f490b1b07 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_02.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_03.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_03.png new file mode 100644 index 000000000..4600c0073 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_03.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_04.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_04.png new file mode 100644 index 000000000..84ad76855 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_04.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_05.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_05.png new file mode 100644 index 000000000..3ac89f8cb Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_05.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_06.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_06.png new file mode 100644 index 000000000..9ec7bc355 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_06.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_07.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_07.png new file mode 100644 index 000000000..8c48a729a Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_07.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_08.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_08.png new file mode 100644 index 000000000..b1a96b151 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_08.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_09.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_09.png new file mode 100644 index 000000000..316954a39 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_09.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_10.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_10.png new file mode 100644 index 000000000..5045edbf1 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_10.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_11.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_11.png new file mode 100644 index 000000000..6996eb3ce Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_11.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_12.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_12.png new file mode 100644 index 000000000..1c701399a Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_12.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_13.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_13.png new file mode 100644 index 000000000..4b0081782 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_13.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_14.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_14.png new file mode 100644 index 000000000..a8c77cd7d Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_14.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_15.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_15.png new file mode 100644 index 000000000..109122fcd Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_15.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_16.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_16.png new file mode 100644 index 000000000..777d2e896 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_16.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_17.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_17.png new file mode 100644 index 000000000..dadf36c6a Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_17.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_18.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_18.png new file mode 100644 index 000000000..a18bdcfb8 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_18.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_19.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_19.png new file mode 100644 index 000000000..5ec050d72 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_19.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_20.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_20.png new file mode 100644 index 000000000..f29a2c957 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_20.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_21.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_21.png new file mode 100644 index 000000000..0278a947c Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_21.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_22.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_22.png new file mode 100644 index 000000000..9b00b7e53 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_22.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_01.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_01.png new file mode 100644 index 000000000..ef57eb82f Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_01.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_02.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_02.png new file mode 100644 index 000000000..c0083a950 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_02.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_03.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_03.png new file mode 100644 index 000000000..6ba529168 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_03.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_04.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_04.png new file mode 100644 index 000000000..8e1bb50a5 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_04.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_05.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_05.png new file mode 100644 index 000000000..00f8534e3 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_05.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_06.png b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_06.png new file mode 100644 index 000000000..d08438834 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_06.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/hero.gif b/advanced_pos_reports/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..d2285da6e Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/hero.gif differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report.png b/advanced_pos_reports/static/description/assets/screenshots/report.png new file mode 100644 index 000000000..194cc8c9f Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report00.png b/advanced_pos_reports/static/description/assets/screenshots/report00.png new file mode 100644 index 000000000..98bce59bb Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report00.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report01.png b/advanced_pos_reports/static/description/assets/screenshots/report01.png new file mode 100644 index 000000000..5840a7111 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report01.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report02.png b/advanced_pos_reports/static/description/assets/screenshots/report02.png new file mode 100644 index 000000000..a019df505 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report02.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report2.png b/advanced_pos_reports/static/description/assets/screenshots/report2.png new file mode 100644 index 000000000..2e735340e Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report2.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report3.png b/advanced_pos_reports/static/description/assets/screenshots/report3.png new file mode 100644 index 000000000..11b540fdc Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report3.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report4.png b/advanced_pos_reports/static/description/assets/screenshots/report4.png new file mode 100644 index 000000000..9693ccfb8 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report4.png differ diff --git a/advanced_pos_reports/static/description/assets/screenshots/report5.png b/advanced_pos_reports/static/description/assets/screenshots/report5.png new file mode 100644 index 000000000..f3d170f97 Binary files /dev/null and b/advanced_pos_reports/static/description/assets/screenshots/report5.png differ diff --git a/advanced_pos_reports/static/description/banner.png b/advanced_pos_reports/static/description/banner.png new file mode 100644 index 000000000..c79ed28dd Binary files /dev/null and b/advanced_pos_reports/static/description/banner.png differ diff --git a/advanced_pos_reports/static/description/icon.png b/advanced_pos_reports/static/description/icon.png new file mode 100644 index 000000000..3e7c4a7fd Binary files /dev/null and b/advanced_pos_reports/static/description/icon.png differ diff --git a/advanced_pos_reports/static/description/index.html b/advanced_pos_reports/static/description/index.html new file mode 100644 index 000000000..c01ec3910 --- /dev/null +++ b/advanced_pos_reports/static/description/index.html @@ -0,0 +1,912 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+

+ Advanced POS Reports

+

+ A Module for Printing Various POS Reports

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ In the Advanced POS Reports app, can print various reports like + Location Summary, Session Summary, Category Summary,etc. from POS + Screen.Top Selling products/ categories / customers + report, Ongoing Sessions Report, Posted Sessions Report from the + reporting menu. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+ +
+ + Ongoing Session Report gives a summary of Ongoing Sessions +
+
+ + Posted Session Report summarizes the Posted Sessions details +
+
+ + Top selling Products / Categories / Customers Reports +
+
+ + Payment Summary from POS Screen to get payment details of current session/ All sessions within a period +
+
+ + Order Summary from POS Screen to get all order details of current session/ All sessions within a period +
+
+ + Category Summary from POS Screen to get category wise sale details current session/ All sessions within a period +
+
+ + Location Summary from POS Screen to get location wise details +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+

+ Reporting Menu

+

+ From Point of Sale --> Reporting, user can access the custom Reports + like Top Selling, Ongoing Sessions and Posted Sessions.

+ +
+ +
+

+ Top Selling - Products Report

+

+ Select the "Products" option from Top Selling field to get Top Selling + Products Report. +

+ +
+
+

+ Top Selling Products Report. +

+ +
+
+

+ Top Selling - Categories Report

+

+ Select the "Categories" option from Top Selling field to get Top + Selling Categories Report. +

+ +
+
+

+ Top Selling Categories Report. +

+ +
+
+

+ Top Selling - Customers Report

+

+ Select the "Customers" option from Top Selling field to get Top Selling + Customers Report. +

+ +
+
+

+ Top Selling Customers Report. +

+ +
+
+

+ Ongoing Sessions Report

+ +
+
+

+ We can see the Pdf Report of Ongoing Sessions

+ +
+
+

+ Posted Sessions Report

+ +
+
+

+ We can see the Pdf Report of Posted Sessions

+ +
+
+

+ Click Payment Summary from POS Screen

+ +
+
+

+ Condition for Getting Payment Summary Report

+ +
+ +
+

+ Payment Summary of Selected dates

+ +
+ +
+

+ Payment Summary of current session

+ +
+ +
+ +
+
+

+ Click Category Summary from POS Screen

+ +
+
+

+ Condition for Getting Category Summary Report

+ +
+ +
+

+ Category Summary of Selected dates

+ +
+ +
+

+ Category Summary of Current Session

+ +
+ +
+ +
+
+

+ Click Product Summary from POS Screen

+ +
+
+

+ Condition for Getting Product Summary Report

+ +
+ +
+

+ Product Summary of Selected dates

+ +
+ +
+

+ Product Summary of Current Session

+ +
+ +
+ +
+
+

+ Click Order Summary from POS Screen

+ +
+ +
+

+ Condition for Getting Order Summary Report

+ +
+ +
+

+ Order Summary of Selected Dates

+ +
+ + +
+

+ Order Summary of Current Session

+ +
+ +
+ +
+
+

+ Click Location Summary from POS Screen

+ +
+
+

+ Condition for Getting Location Summary Report

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

+ Related + Products +

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

Our Services

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

Our Industries

+
+
+ +
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

Need Help?

+
+
+
+ + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ \ No newline at end of file diff --git a/advanced_pos_reports/static/src/js/Category.js b/advanced_pos_reports/static/src/js/Category.js new file mode 100644 index 000000000..c0c80b93f --- /dev/null +++ b/advanced_pos_reports/static/src/js/Category.js @@ -0,0 +1,32 @@ +odoo.define('advanced_pos_reports.CategorySummaryButton', function (require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const { useListener } = require("@web/core/utils/hooks"); + class CategorySummaryButton extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + useListener('click', this._onClick); + } + _onClick() { + //Show category summary popup + this.showPopup('CategorySummaryPopup', + { title: 'Category Summary',} + ); + } + } + CategorySummaryButton.template = 'CategorySummaryButton'; + ProductScreen.addControlButton({ + // Add button in product screen + component: CategorySummaryButton, + condition: function () { + return true; + }, + }); + Registries.Component.add(CategorySummaryButton); + return CategorySummaryButton; +}); diff --git a/advanced_pos_reports/static/src/js/CategoryPopup.js b/advanced_pos_reports/static/src/js/CategoryPopup.js new file mode 100644 index 000000000..c056cba7a --- /dev/null +++ b/advanced_pos_reports/static/src/js/CategoryPopup.js @@ -0,0 +1,84 @@ +odoo.define('advanced_pos_reports.CategorySummaryPopup', function(require) { + 'use strict'; + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); + const { useState, useRef } = owl; + + class CategorySummaryPopup extends AbstractAwaitablePopup { + /** + * @Override AbstractAwaitablePopup + */ + setup() { + super.setup(); + this.is_session = useRef("isSession") + this.date_section = useRef("dateSection") + this.state = useState({ + current_session: false, + start_date: "", + end_date: "", + }); + } + click_is_session(ev){ + //Check the current session is enabled or not + var is_session = this.is_session.el; + var date_section = this.date_section.el; + if(is_session.checked){ + date_section.style.display = "none"; + } + else{ + date_section.style.display = "block"; + } + } + async confirm(event) { + // Filter category summary + var is_session = this.state.current_session; + var start_date = this.state.start_date || ''; + var end_date = this.state.end_date || ''; + var order = this.env.pos.get_order()['sequence_number'] + var domain = [] + if(is_session){ + domain = [['session_id', '=', this.env.pos.pos_session.id]] + } + else{ + if (start_date.trim() === '' || end_date.trim() === '') { + return; + } + if (start_date > end_date) { + this.showPopup('ErrorPopup', { + title: this.env._t('Error'), + body: this.env._t('Start Date Greater than End Date.'), + }); + return; + } + domain = [['date_order', '>=', start_date + ' 00:00:00'], + ['date_order', '<=', end_date + ' 23:59:59']] + } + var orders = await this.rpc({ + model: 'pos.order', + method: 'search', + args: [domain], + }); + var order_ids = [] + orders.forEach(function(value, index) { + order_ids.push(value); + }); + var categories = await this.rpc({ + model: 'pos.order', + method: 'get_category_summary', + args: [order, order_ids], + }); + this.showScreen('CategorySummaryReceiptScreen', { categories: categories, start_date: start_date, end_date: end_date}); + super.confirm(); + } + } + CategorySummaryPopup.template = 'CategorySummaryPopup'; + CategorySummaryPopup.defaultProps = { + confirmText: _lt('Print'), + cancelText: _lt('Cancel'), + array: [], + isSingleItem: false, + }; + Registries.Component.add(CategorySummaryPopup); + return CategorySummaryPopup; +}); diff --git a/advanced_pos_reports/static/src/js/CategoryReceipt.js b/advanced_pos_reports/static/src/js/CategoryReceipt.js new file mode 100644 index 000000000..28ed723ef --- /dev/null +++ b/advanced_pos_reports/static/src/js/CategoryReceipt.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.CategorySummaryReceipt', function(require) { + 'use strict'; + const PosComponent = require('point_of_sale.PosComponent'); + const Registries = require('point_of_sale.Registries'); + + class CategorySummaryReceipt extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + super.setup(); + this._categorySummaryEnv = this.props.categories + this.categories_line = this.props.categories; + } + get categories() { + //Get the category details + return this._categorySummaryEnv; + } + get company() { + //Get the company details + return this.env.pos.company; + } + get cashier() { + //Get cashier details + return this.env.pos.get_cashier(); + } + } + CategorySummaryReceipt.template = 'CategorySummaryReceipt'; + Registries.Component.add(CategorySummaryReceipt); + return CategorySummaryReceipt; +}); diff --git a/advanced_pos_reports/static/src/js/Location.js b/advanced_pos_reports/static/src/js/Location.js new file mode 100644 index 000000000..c20753047 --- /dev/null +++ b/advanced_pos_reports/static/src/js/Location.js @@ -0,0 +1,36 @@ +odoo.define('advanced_pos_reports.LocationSummaryButton', function (require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const { useListener } = require("@web/core/utils/hooks"); + + class LocationSummaryButton extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + useListener('click', this._onClick); + } + async _onClick() { + // Function to get all the location through rpc + var locations = await this.rpc({ + model: 'stock.location', + method: 'search_read', + args: [[['usage', '=', 'internal']]], + }); + this.showPopup('LocationSummaryPopup', { title: 'Location Summary', locations: locations }); + } + } + LocationSummaryButton.template = 'LocationSummaryButton'; + ProductScreen.addControlButton({ + // Add button in product screen + component: LocationSummaryButton, + condition: function () { + return true; + }, + }); + Registries.Component.add(LocationSummaryButton); + return LocationSummaryButton; +}); diff --git a/advanced_pos_reports/static/src/js/LocationPopup.js b/advanced_pos_reports/static/src/js/LocationPopup.js new file mode 100644 index 000000000..adbedf65f --- /dev/null +++ b/advanced_pos_reports/static/src/js/LocationPopup.js @@ -0,0 +1,49 @@ +odoo.define('advanced_pos_reports.LocationSummaryPopup', function(require) { + 'use strict'; + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); + const { useState } = owl; + + class LocationSummaryPopup extends AbstractAwaitablePopup { + /** + * @Override AbstractAwaitablePopup + */ + setup() { + super.setup(); + this.state = useState({ + selected_value: '' + }); + } + async confirm(event) { + // Get location summary + var location = this.state.selected_value; + if (location) { + var locations = await this.rpc({ + model: 'pos.config', + method: 'get_location_summary', + args: [this.config_id, location], + }); + if (locations) { + this.showScreen('LocationSummaryReceiptScreen', { locations: locations}); + super.confirm(); + } + else { + this.showPopup('ErrorPopup', { + title: this.env._t('No data'), + body: this.env._t('There is no data.'), + }); + } + } + } + } + LocationSummaryPopup.template = 'LocationSummaryPopup'; + LocationSummaryPopup.defaultProps = { + confirmText: _lt('Print'), + cancelText: _lt('Cancel'), + array: [], + isSingleItem: false, + }; + Registries.Component.add(LocationSummaryPopup); + return LocationSummaryPopup; +}); diff --git a/advanced_pos_reports/static/src/js/LocationReceipt.js b/advanced_pos_reports/static/src/js/LocationReceipt.js new file mode 100644 index 000000000..9e08cbf99 --- /dev/null +++ b/advanced_pos_reports/static/src/js/LocationReceipt.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.LocationSummaryReceipt', function(require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const Registries = require('point_of_sale.Registries'); + + class LocationSummaryReceipt extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + super.setup(); + this._locationSummaryEnv = this.props.locations + } + get locations() { + //Get location details + return this._locationSummaryEnv; + } + get company() { + //Get company details + return this.env.pos.company; + } + get cashier() { + //Get cashier details + return this.env.pos.get_cashier(); + } + } + LocationSummaryReceipt.template = 'LocationSummaryReceipt'; + Registries.Component.add(LocationSummaryReceipt); + return LocationSummaryReceipt; +}); diff --git a/advanced_pos_reports/static/src/js/LocationReceiptScreen.js b/advanced_pos_reports/static/src/js/LocationReceiptScreen.js new file mode 100644 index 000000000..74eba26a3 --- /dev/null +++ b/advanced_pos_reports/static/src/js/LocationReceiptScreen.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.LocationSummaryReceiptScreen', function (require) { + 'use strict'; + + const { useRef } = owl; + const Registries = require('point_of_sale.Registries'); + const AbstractReceiptScreen = require('point_of_sale.AbstractReceiptScreen'); + + const LocationSummaryReceiptScreen = (AbstractReceiptScreen) => { + class LocationSummaryReceiptScreen extends AbstractReceiptScreen { + /** + * @Override AbstractReceiptScreen + */ + setup() { + super.setup(); + this.locationSummary = useRef('location-summary'); + } + confirm() { + //Returns to the product screen when we click confirm + this.showScreen('ProductScreen'); + } + async printSummary() { + //Method to print the receipt + await this._printReceipt(); + } + } + LocationSummaryReceiptScreen.template = 'LocationSummaryReceiptScreen'; + return LocationSummaryReceiptScreen; + }; + Registries.Component.addByExtending(LocationSummaryReceiptScreen, AbstractReceiptScreen); + return LocationSummaryReceiptScreen; +}); diff --git a/advanced_pos_reports/static/src/js/Order.js b/advanced_pos_reports/static/src/js/Order.js new file mode 100644 index 000000000..3cd76cece --- /dev/null +++ b/advanced_pos_reports/static/src/js/Order.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.OrderSummaryButton', function (require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const { useListener } = require("@web/core/utils/hooks"); + + class OrderSummaryButton extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + useListener('click', this._onClick); + } + _onClick() { + //Show order summary popup + this.showPopup('OrderSummaryPopup', { title: 'Order Summary', }); + } + } + OrderSummaryButton.template = 'OrderSummaryButton'; + ProductScreen.addControlButton({ + // Add button in product screen + component: OrderSummaryButton, + condition: function () { + return true; + }, + }); + Registries.Component.add(OrderSummaryButton); + return OrderSummaryButton; +}); diff --git a/advanced_pos_reports/static/src/js/OrderPopup.js b/advanced_pos_reports/static/src/js/OrderPopup.js new file mode 100644 index 000000000..cf224c493 --- /dev/null +++ b/advanced_pos_reports/static/src/js/OrderPopup.js @@ -0,0 +1,95 @@ +odoo.define('advanced_pos_reports.OrderSummaryPopup', function(require) { + 'use strict'; + + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); + const { useState, useRef } = owl; + + class OrderSummaryPopup extends AbstractAwaitablePopup { + /** + * @Override AbstractAwaitablePopup + */ + setup() { + super.setup(); + this.is_session = useRef("isSession") + this.date_section = useRef("dateSection") + this.state = useState({ + current_session: false, + start_date: "", + end_date: "", + status: '' || 'draft' || 'paid' || 'done' || 'invoiced' || 'cancel', + }); + } + click_is_session(ev){ + // Check if the session is enabled or not + var is_session = this.is_session.el; + var date_section = this.date_section.el; + if(is_session.checked){ + date_section.style.display = "none"; + } + else{ + date_section.style.display = "block"; + } + } + async confirm(event) { + // Get order summary + var is_session = this.state.current_session; + var start_date = this.state.start_date || ''; + var end_date = this.state.end_date || ''; + var status = this.state.status; + var order = this.env.pos.get_order()['sequence_number'] + var domain = [] + if(is_session){ + domain = [['session_id', '=', this.env.pos.pos_session.id]] + if(status){ + domain = [['session_id', '=', this.env.pos.pos_session.id], ['state', '=', status]] + } + } + else{ + if (start_date.trim() === '' || end_date.trim() === '') { + return; + } + if (start_date > end_date) { + this.showPopup('ErrorPopup', { + title: this.env._t('Error'), + body: this.env._t('Start Date Greater than End Date.'), + }); + return; + } + domain = [['date_order', '>=', start_date + ' 00:00:00'], + ['date_order', '<=', end_date + ' 23:59:59']] + if(status){ + domain = [['date_order', '>=', start_date + ' 00:00:00'], + ['date_order', '<=', end_date + ' 23:59:59'], + ['state', '=', status]] + } + } + var orders_ids = await this.rpc({ + model: 'pos.order', + method: 'search', + args: [domain], + }); + var order_ids = [] + orders_ids.forEach(function(value, index) { + order_ids.push(value); + }); + var orders = await this.rpc({ + model: 'pos.order', + method: 'get_order_summary', + args: [order, order_ids], + }); + this.showScreen('OrderSummaryReceiptScreen', { orders: orders, start_date: start_date, end_date: end_date}); + super.confirm(); + } + } + OrderSummaryPopup.template = 'OrderSummaryPopup'; + OrderSummaryPopup.defaultProps = { + confirmText: _lt('Print'), + cancelText: _lt('Cancel'), + array: [], + isSingleItem: false, + }; + Registries.Component.add(OrderSummaryPopup); + return OrderSummaryPopup; +}); diff --git a/advanced_pos_reports/static/src/js/OrderReceipt.js b/advanced_pos_reports/static/src/js/OrderReceipt.js new file mode 100644 index 000000000..f45cb2d1c --- /dev/null +++ b/advanced_pos_reports/static/src/js/OrderReceipt.js @@ -0,0 +1,35 @@ +odoo.define('advanced_pos_reports.OrderSummaryReceipt', function(require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const Registries = require('point_of_sale.Registries'); + + class OrderSummaryReceipt extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + super.setup(); + this._orderSummaryEnv = this.props.orders + } + get orders() { + //Get order details + return this._orderSummaryEnv; + } + get company() { + //Get company details + return this.env.pos.company; + } + get cashier() { + //Get cashier details + return this.env.pos.get_cashier(); + } + getDate(order) { + //Get date information + return moment(order.date_order).format('MM-DD-YYYY'); + } + } + OrderSummaryReceipt.template = 'OrderSummaryReceipt'; + Registries.Component.add(OrderSummaryReceipt); + return OrderSummaryReceipt; +}); diff --git a/advanced_pos_reports/static/src/js/OrderReceiptScreen.js b/advanced_pos_reports/static/src/js/OrderReceiptScreen.js new file mode 100644 index 000000000..89633c0b1 --- /dev/null +++ b/advanced_pos_reports/static/src/js/OrderReceiptScreen.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.OrderSummaryReceiptScreen', function (require) { + 'use strict'; + + const { useRef } = owl; + const Registries = require('point_of_sale.Registries'); + const AbstractReceiptScreen = require('point_of_sale.AbstractReceiptScreen'); + + const OrderSummaryReceiptScreen = (AbstractReceiptScreen) => { + class OrderSummaryReceiptScreen extends AbstractReceiptScreen { + /** + * @Override AbstractReceiptScreen + */ + setup() { + super.setup(); + this.orderSummary = useRef('order-summary'); + } + confirm() { + //Returns to the product screen when we click confirm + this.showScreen('ProductScreen'); + } + async printSummary() { + //Method to print the receipt + await this._printReceipt(); + } + } + OrderSummaryReceiptScreen.template = 'OrderSummaryReceiptScreen'; + return OrderSummaryReceiptScreen; + }; + Registries.Component.addByExtending(OrderSummaryReceiptScreen, AbstractReceiptScreen); + return OrderSummaryReceiptScreen; +}); diff --git a/advanced_pos_reports/static/src/js/Payment.js b/advanced_pos_reports/static/src/js/Payment.js new file mode 100644 index 000000000..9faa28924 --- /dev/null +++ b/advanced_pos_reports/static/src/js/Payment.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.PaymentSummaryButton', function (require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const { useListener } = require("@web/core/utils/hooks"); + + class PaymentSummaryButton extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + useListener('click', this._onClick); + } + _onClick() { + //Show payment summary popup + this.showPopup('PaymentSummaryPopup', { title: 'Payment Summary', }); + } + } + PaymentSummaryButton.template = 'PaymentSummaryButton'; + ProductScreen.addControlButton({ + // Add button in product screen + component: PaymentSummaryButton, + condition: function () { + return true; + }, + }); + Registries.Component.add(PaymentSummaryButton); + return PaymentSummaryButton; +}); diff --git a/advanced_pos_reports/static/src/js/PaymentPopup.js b/advanced_pos_reports/static/src/js/PaymentPopup.js new file mode 100644 index 000000000..07cf0b343 --- /dev/null +++ b/advanced_pos_reports/static/src/js/PaymentPopup.js @@ -0,0 +1,99 @@ +odoo.define('advanced_pos_reports.PaymentSummaryPopup', function(require) { + 'use strict'; + + const { useState, useRef } = owl; + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); + + class PaymentSummaryPopup extends AbstractAwaitablePopup { + /** + * @Override AbstractAwaitablePopup + */ + setup() { + super.setup(); + this.is_session = useRef("isSession") + this.date_section = useRef("dateSection") + this.state = useState({ + current_session: false, + start_date: "", + end_date: "", + summary: '' || 'sales_person' || 'journal', + }); + } + click_is_session(ev){ + //Check if the current session is enabled or not + var is_session = this.is_session.el; + var date_section = this.date_section.el; + if(is_session.checked){ + date_section.style.display = "none"; + } + else{ + date_section.style.display = "block"; + } + } + async confirm(event) { + // Get payment summary + var is_session = this.state.current_session; + var start_date = this.state.start_date || ''; + var end_date = this.state.end_date || ''; + var summary_type = this.state.summary; + var order = this.env.pos.get_order()['sequence_number'] + var is_user = false; + if(summary_type === 'sales_person'){ + is_user = true + } + var domain = [] + if(is_session){ + domain = [['session_id', '=', this.env.pos.pos_session.id]] + if(summary_type == 'sales_person'){ + domain = [['session_id', '=', this.env.pos.pos_session.id], ['user_id', '=', this.env.pos.user.id]] + } + } + else{ + if (start_date.trim() === '' || end_date.trim() === '') { + return; + } + if (start_date > end_date) { + this.showPopup('ErrorPopup', { + title: this.env._t('Error'), + body: this.env._t('Start Date Greater than End Date.'), + }); + return; + } + domain = [['date_order', '>=', start_date + ' 00:00:00'], + ['date_order', '<=', end_date + ' 23:59:59']] + if(summary_type == 'sales_person'){ + domain = [['date_order', '>=', start_date + ' 00:00:00'], + ['date_order', '<=', end_date + ' 23:59:59'], + ['user_id', '=', this.env.pos.user.id]] + } + } + var orders = await this.rpc({ + model: 'pos.order', + method: 'search', + args: [domain], + }); + var order_ids = [] + orders.forEach(function(value, index) { + order_ids.push(value); + }); + var payment_summary = await this.rpc({ + model: 'pos.payment', + method: 'get_payment_summary', + args: [order, order_ids], + }); + this.showScreen('PaymentSummaryReceiptScreen', { payment_summary: payment_summary, start_date: start_date, end_date: end_date, is_user: is_user }); + super.confirm(); + } + } + PaymentSummaryPopup.template = 'PaymentSummaryPopup'; + PaymentSummaryPopup.defaultProps = { + confirmText: _lt('Print'), + cancelText: _lt('Cancel'), + array: [], + isSingleItem: false, + }; + Registries.Component.add(PaymentSummaryPopup); + return PaymentSummaryPopup; +}); diff --git a/advanced_pos_reports/static/src/js/PaymentReceipt.js b/advanced_pos_reports/static/src/js/PaymentReceipt.js new file mode 100644 index 000000000..e5b14360f --- /dev/null +++ b/advanced_pos_reports/static/src/js/PaymentReceipt.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.PaymentSummaryReceipt', function(require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const Registries = require('point_of_sale.Registries'); + + class PaymentSummaryReceipt extends PosComponent { + /** + * @Override PosComponent + */ + constructor() { + super(...arguments); + this._paymentSummaryEnv = this.props.payment_summary + } + get payment_summary() { + //Get payment details + return this._paymentSummaryEnv; + } + get company() { + //Get company details + return this.env.pos.company; + } + get cashier() { + //Get cashier details + return this.env.pos.get_cashier(); + } + } + PaymentSummaryReceipt.template = 'PaymentSummaryReceipt'; + Registries.Component.add(PaymentSummaryReceipt); + return PaymentSummaryReceipt; +}); diff --git a/advanced_pos_reports/static/src/js/PaymentReceiptScreen.js b/advanced_pos_reports/static/src/js/PaymentReceiptScreen.js new file mode 100644 index 000000000..6220b2496 --- /dev/null +++ b/advanced_pos_reports/static/src/js/PaymentReceiptScreen.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.PaymentSummaryReceiptScreen', function (require) { + 'use strict'; + + const { useRef } = owl; + const Registries = require('point_of_sale.Registries'); + const AbstractReceiptScreen = require('point_of_sale.AbstractReceiptScreen'); + + const PaymentSummaryReceiptScreen = (AbstractReceiptScreen) => { + class PaymentSummaryReceiptScreen extends AbstractReceiptScreen { + /** + * @Override AbstractReceiptScreen + */ + constructor() { + super(...arguments); + this.paymentSummary = useRef('payment-summary'); + } + confirm() { + //Returns to the product screen when we click confirm + this.showScreen('ProductScreen'); + } + async printSummary() { + //Method to print the receipt + await this._printReceipt(); + } + } + PaymentSummaryReceiptScreen.template = 'PaymentSummaryReceiptScreen'; + return PaymentSummaryReceiptScreen; + }; + Registries.Component.addByExtending(PaymentSummaryReceiptScreen, AbstractReceiptScreen); + return PaymentSummaryReceiptScreen; +}); diff --git a/advanced_pos_reports/static/src/js/Product.js b/advanced_pos_reports/static/src/js/Product.js new file mode 100644 index 000000000..ceffb3130 --- /dev/null +++ b/advanced_pos_reports/static/src/js/Product.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.ProductSummaryButton', function (require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const Registries = require('point_of_sale.Registries'); + const { useListener } = require("@web/core/utils/hooks"); + + class ProductSummaryButton extends PosComponent { + /** + * @Override PosComponent + */ + setup() { + useListener('click', this._onClick); + } + _onClick() { + //Show product summary popup + this.showPopup('ProductSummaryPopup', { title: 'Product Summary', }); + } + } + ProductSummaryButton.template = 'ProductSummaryButton'; + ProductScreen.addControlButton({ + // Add button in product screen + component: ProductSummaryButton, + condition: function () { + return true; + }, + }); + Registries.Component.add(ProductSummaryButton); + return ProductSummaryButton; +}); diff --git a/advanced_pos_reports/static/src/js/ProductPopup.js b/advanced_pos_reports/static/src/js/ProductPopup.js new file mode 100644 index 000000000..59de37e9a --- /dev/null +++ b/advanced_pos_reports/static/src/js/ProductPopup.js @@ -0,0 +1,85 @@ +odoo.define('advanced_pos_reports.ProductSummaryPopup', function(require) { + 'use strict'; + + const { useState, useRef } = owl; + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { _lt } = require('@web/core/l10n/translation'); + + class ProductSummaryPopup extends AbstractAwaitablePopup { + /** + * @Override AbstractAwaitablePopup + */ + setup() { + super.setup(); + this.is_session = useRef("isSession") + this.date_section = useRef("dateSection") + this.state = useState({ + current_session: false, + start_date: "", + end_date: "" + }); + } + click_is_session(ev){ + //Check if the current session is enabled or not + var is_session = this.is_session.el; + var date_section = this.date_section.el; + if(is_session.checked){ + date_section.style.display = "none"; + } + else{ + date_section.style.display = "block"; + } + } + async confirm(event) { + // Get product summary + var is_session = this.state.current_session; + var start_date = this.state.start_date || ''; + var end_date = this.state.end_date || ''; + var order = this.env.pos.get_order()['sequence_number'] + var domain = [] + if(is_session){ + domain = [['session_id', '=', this.env.pos.pos_session.id]] + } + else{ + if (start_date.trim() === '' || end_date.trim() === '') { + return; + } + if (start_date > end_date) { + this.showPopup('ErrorPopup', { + title: this.env._t('Error'), + body: this.env._t('Start Date Greater than End Date.'), + }); + return; + } + domain = [['date_order', '>=', start_date + ' 00:00:00'], + ['date_order', '<=', end_date + ' 23:59:59']] + } + var orders = await this.rpc({ + model: 'pos.order', + method: 'search', + args: [domain], + }); + var order_ids = [] + orders.forEach(function(value, index) { + order_ids.push(value); + }); + var products = await this.rpc({ + model: 'pos.order', + method: 'get_product_summary', + args: [order, order_ids], + }); + this.showScreen('ProductSummaryReceiptScreen', { products: products, start_date: start_date, end_date: end_date}); + super.confirm(); + } + } + ProductSummaryPopup.template = 'ProductSummaryPopup'; + ProductSummaryPopup.defaultProps = { + confirmText: _lt('Print'), + cancelText: _lt('Cancel'), + array: [], + isSingleItem: false, + }; + Registries.Component.add(ProductSummaryPopup); + return ProductSummaryPopup; +}); diff --git a/advanced_pos_reports/static/src/js/ProductReceipt.js b/advanced_pos_reports/static/src/js/ProductReceipt.js new file mode 100644 index 000000000..7ba3c30f2 --- /dev/null +++ b/advanced_pos_reports/static/src/js/ProductReceipt.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.ProductSummaryReceipt', function(require) { + 'use strict'; + + const PosComponent = require('point_of_sale.PosComponent'); + const Registries = require('point_of_sale.Registries'); + + class ProductSummaryReceipt extends PosComponent { + /** + * @Override PosComponent + */ + constructor() { + super(...arguments); + this._productSummaryEnv = this.props.products + } + get products() { + //Get product details + return this._productSummaryEnv; + } + get company() { + //Get company details + return this.env.pos.company; + } + get cashier() { + //Get cashier details + return this.env.pos.get_cashier(); + } + } + ProductSummaryReceipt.template = 'ProductSummaryReceipt'; + Registries.Component.add(ProductSummaryReceipt); + return ProductSummaryReceipt; +}); diff --git a/advanced_pos_reports/static/src/js/ProductReceiptScreen.js b/advanced_pos_reports/static/src/js/ProductReceiptScreen.js new file mode 100644 index 000000000..96ec3b28c --- /dev/null +++ b/advanced_pos_reports/static/src/js/ProductReceiptScreen.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.ProductSummaryReceiptScreen', function (require) { + 'use strict'; + + const { useRef } = owl; + const Registries = require('point_of_sale.Registries'); + const AbstractReceiptScreen = require('point_of_sale.AbstractReceiptScreen'); + + const ProductSummaryReceiptScreen = (AbstractReceiptScreen) => { + class ProductSummaryReceiptScreen extends AbstractReceiptScreen { + /** + * @Override AbstractReceiptScreen + */ + constructor() { + super(...arguments); + this.paymentSummary = useRef('product-summary'); + } + confirm() { + //Returns to the product screen when we click confirm + this.showScreen('ProductScreen'); + } + async printSummary() { + //Method to print the receipt + await this._printReceipt(); + } + } + ProductSummaryReceiptScreen.template = 'ProductSummaryReceiptScreen'; + return ProductSummaryReceiptScreen; + }; + Registries.Component.addByExtending(ProductSummaryReceiptScreen, AbstractReceiptScreen); + return ProductSummaryReceiptScreen; +}); diff --git a/advanced_pos_reports/static/src/js/ReceiptScreen.js b/advanced_pos_reports/static/src/js/ReceiptScreen.js new file mode 100644 index 000000000..485f284e0 --- /dev/null +++ b/advanced_pos_reports/static/src/js/ReceiptScreen.js @@ -0,0 +1,31 @@ +odoo.define('advanced_pos_reports.CategorySummaryReceiptScreen', function (require) { + 'use strict'; + + const { useRef } = owl; + const Registries = require('point_of_sale.Registries'); + const AbstractReceiptScreen = require('point_of_sale.AbstractReceiptScreen'); + + const CategorySummaryReceiptScreen = (AbstractReceiptScreen) => { + class CategorySummaryReceiptScreen extends AbstractReceiptScreen { + /** + * @Override AbstractReceiptScreen + */ + setup() { + super.setup(); + this.categorySummary = useRef('catgeory-summary'); + } + confirm() { + //Returns to the product screen when we click confirm + this.showScreen('ProductScreen'); + } + async printSummary() { + //Method to print the receipt + await this._printReceipt(); + } + } + CategorySummaryReceiptScreen.template = 'CategorySummaryReceiptScreen'; + return CategorySummaryReceiptScreen; + }; + Registries.Component.addByExtending(CategorySummaryReceiptScreen, AbstractReceiptScreen); + return CategorySummaryReceiptScreen; +}); diff --git a/advanced_pos_reports/static/src/xml/CategoryReceipt_templates.xml b/advanced_pos_reports/static/src/xml/CategoryReceipt_templates.xml new file mode 100644 index 000000000..5100b4aff --- /dev/null +++ b/advanced_pos_reports/static/src/xml/CategoryReceipt_templates.xml @@ -0,0 +1,95 @@ + + + + +
+ + +
+
+ +

+ +

+
+
+
+ +
+
+ +
Tel:
+
+ +
: +
+
+ +
+
+ +
+
+ +
+
--------------------------------
+
Served by
+
+
+
+
+

+ Category Summary +

+ + + + + + + + + +
Start Date:
End Date:
+ + + + + + + + + + + + + + + + + + +
+ + + + + + +
CategoryQuantityTotal
+ + + + + +
Total: + +
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/Category_templates.xml b/advanced_pos_reports/static/src/xml/Category_templates.xml new file mode 100644 index 000000000..54fd90f02 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/Category_templates.xml @@ -0,0 +1,11 @@ + + + + +
+ + Category Summary +
+
+
diff --git a/advanced_pos_reports/static/src/xml/LocationPopup_templates.xml b/advanced_pos_reports/static/src/xml/LocationPopup_templates.xml new file mode 100644 index 000000000..798564513 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/LocationPopup_templates.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/advanced_pos_reports/static/src/xml/LocationReceiptScreen_templates.xml b/advanced_pos_reports/static/src/xml/LocationReceiptScreen_templates.xml new file mode 100644 index 000000000..8460d2c61 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/LocationReceiptScreen_templates.xml @@ -0,0 +1,27 @@ + + + + +
+
+
+ + + + Back + +
+
+
+ + Print Location Summary +
+
+ +
+
+
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/LocationReceipt_templates.xml b/advanced_pos_reports/static/src/xml/LocationReceipt_templates.xml new file mode 100644 index 000000000..5789dccac --- /dev/null +++ b/advanced_pos_reports/static/src/xml/LocationReceipt_templates.xml @@ -0,0 +1,75 @@ + + + + +
+ + +
+
+ +

+ +

+
+
+
+ +
+
+ +
Tel:
+
+ +
: +
+
+ +
+
+ +
+
+ +
+
--------------------------------
+
Served by
+
+
+
+
+

+ Location Summary +

+ + + + + + + + + + + + + + +
+ + + + + +
ProductQuantity
+ + + +
Total: + +
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/Location_templates.xml b/advanced_pos_reports/static/src/xml/Location_templates.xml new file mode 100644 index 000000000..1dde59f7b --- /dev/null +++ b/advanced_pos_reports/static/src/xml/Location_templates.xml @@ -0,0 +1,11 @@ + + + + +
+ + Location Summary +
+
+
diff --git a/advanced_pos_reports/static/src/xml/OrderPopup_templates.xml b/advanced_pos_reports/static/src/xml/OrderPopup_templates.xml new file mode 100644 index 000000000..6ec10f657 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/OrderPopup_templates.xml @@ -0,0 +1,68 @@ + + + + + + + diff --git a/advanced_pos_reports/static/src/xml/OrderReceiptScreen_templates.xml b/advanced_pos_reports/static/src/xml/OrderReceiptScreen_templates.xml new file mode 100644 index 000000000..ec6ddd7f9 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/OrderReceiptScreen_templates.xml @@ -0,0 +1,28 @@ + + + + +
+
+
+ + + + Back + +
+
+
+ + Print Order Summary +
+
+ +
+
+
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/OrderReceipt_templates.xml b/advanced_pos_reports/static/src/xml/OrderReceipt_templates.xml new file mode 100644 index 000000000..e37582b42 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/OrderReceipt_templates.xml @@ -0,0 +1,97 @@ + + + + +
+ + +
+
+ +

+ +

+
+
+
+ +
+
+ +
Tel:
+
+ +
: +
+
+ +
+
+ +
+
+ +
+
--------------------------------
+
Served by
+
+
+
+
+

+ Order Summary +

+ + + + + + + + + +
Start Date:
End Date:
+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
Order RefStatusDateTotal
+ + + + +
+
+ +
Total: + + + +
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/Order_templates.xml b/advanced_pos_reports/static/src/xml/Order_templates.xml new file mode 100644 index 000000000..e754cb5cc --- /dev/null +++ b/advanced_pos_reports/static/src/xml/Order_templates.xml @@ -0,0 +1,11 @@ + + + + +
+ + Order Summary +
+
+
diff --git a/advanced_pos_reports/static/src/xml/PaymentPopup_templates.xml b/advanced_pos_reports/static/src/xml/PaymentPopup_templates.xml new file mode 100644 index 000000000..7022c8c82 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/PaymentPopup_templates.xml @@ -0,0 +1,65 @@ + + + + + + + diff --git a/advanced_pos_reports/static/src/xml/PaymentReceiptScreen_templates.xml b/advanced_pos_reports/static/src/xml/PaymentReceiptScreen_templates.xml new file mode 100644 index 000000000..1a96dd608 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/PaymentReceiptScreen_templates.xml @@ -0,0 +1,30 @@ + + + + +
+
+
+ + + + Back + +
+
+
+ + Print Payment Summary +
+
+ +
+
+
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/PaymentReceipt_templates.xml b/advanced_pos_reports/static/src/xml/PaymentReceipt_templates.xml new file mode 100644 index 000000000..9b39434fa --- /dev/null +++ b/advanced_pos_reports/static/src/xml/PaymentReceipt_templates.xml @@ -0,0 +1,97 @@ + + + + +
+ + +
+
+ +

+ +

+
+
+
+ +
+
+ +
Tel:
+
+ +
: +
+
+ +
+
+ +
+
+ +
+
--------------------------------
+
Served by
+
+
+
+
+

+ Payment Summary +

+ +
+
Salesperson:
+
+
+ + + + + + + + + +
Start Date:
End Date:
+ + + + + + + + + + + + + + + + + +
+
+ + + + + +
Payment MethodAmount
+ + + +
Total: + +
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/Payment_templates.xml b/advanced_pos_reports/static/src/xml/Payment_templates.xml new file mode 100644 index 000000000..724d2552c --- /dev/null +++ b/advanced_pos_reports/static/src/xml/Payment_templates.xml @@ -0,0 +1,11 @@ + + + + +
+ + Payment Summary +
+
+
diff --git a/advanced_pos_reports/static/src/xml/Popup_templates.xml b/advanced_pos_reports/static/src/xml/Popup_templates.xml new file mode 100644 index 000000000..f6230bf4d --- /dev/null +++ b/advanced_pos_reports/static/src/xml/Popup_templates.xml @@ -0,0 +1,55 @@ + + + + + + + diff --git a/advanced_pos_reports/static/src/xml/ProductPopup_templates.xml b/advanced_pos_reports/static/src/xml/ProductPopup_templates.xml new file mode 100644 index 000000000..3fd156e9b --- /dev/null +++ b/advanced_pos_reports/static/src/xml/ProductPopup_templates.xml @@ -0,0 +1,55 @@ + + + + + + + diff --git a/advanced_pos_reports/static/src/xml/ProductReceiptScreen_templates.xml b/advanced_pos_reports/static/src/xml/ProductReceiptScreen_templates.xml new file mode 100644 index 000000000..571d100b0 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/ProductReceiptScreen_templates.xml @@ -0,0 +1,28 @@ + + + + +
+
+
+ + + + Back + +
+
+
+ + Print Product Summary +
+
+ +
+
+
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/ProductReceipt_templates.xml b/advanced_pos_reports/static/src/xml/ProductReceipt_templates.xml new file mode 100644 index 000000000..4b7cf0ee0 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/ProductReceipt_templates.xml @@ -0,0 +1,93 @@ + + + + +
+ + +
+
+ +

+ +

+
+
+
+ +
+
+ +
Tel:
+
+ +
: +
+
+ +
+
+ +
+
+ +
+
--------------------------------
+
Served by
+
+
+
+
+

+ Product Summary +

+ + + + + + + + + +
Start Date:
End Date:
+ + + + + + + + + + + + + + + + + + + +
+ + + + + +
ProductQuantity
+ [] + + + +
Total: + +
+
+
+
diff --git a/advanced_pos_reports/static/src/xml/Product_templates.xml b/advanced_pos_reports/static/src/xml/Product_templates.xml new file mode 100644 index 000000000..416167749 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/Product_templates.xml @@ -0,0 +1,11 @@ + + + + +
+ + Product Summary +
+
+
diff --git a/advanced_pos_reports/static/src/xml/ReceiptScreen_templates.xml b/advanced_pos_reports/static/src/xml/ReceiptScreen_templates.xml new file mode 100644 index 000000000..c0da64342 --- /dev/null +++ b/advanced_pos_reports/static/src/xml/ReceiptScreen_templates.xml @@ -0,0 +1,29 @@ + + + + +
+
+
+ + + + Back + +
+
+
+ + Print Category Summary +
+
+ +
+
+
+
+
+
diff --git a/advanced_pos_reports/wizard/__init__.py b/advanced_pos_reports/wizard/__init__.py new file mode 100644 index 000000000..73fee424f --- /dev/null +++ b/advanced_pos_reports/wizard/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import pos_sale_ongoing +from . import pos_sale_posted +from . import pos_sale_top_selling diff --git a/advanced_pos_reports/wizard/advanced_pos_reports_wizard.xml b/advanced_pos_reports/wizard/advanced_pos_reports_wizard.xml new file mode 100644 index 000000000..d993ae5e2 --- /dev/null +++ b/advanced_pos_reports/wizard/advanced_pos_reports_wizard.xml @@ -0,0 +1,33 @@ + + + + + Top Selling + pos.sale.top.selling + form + new + + + + Ongoing Sessions Report + pos.sale.ongoing + form + new + + + + Posted Sessions Report + pos.sale.posted + form + new + + + + + diff --git a/advanced_pos_reports/wizard/pos_sale_ongoing.py b/advanced_pos_reports/wizard/pos_sale_ongoing.py new file mode 100644 index 000000000..111af10a1 --- /dev/null +++ b/advanced_pos_reports/wizard/pos_sale_ongoing.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class PosSaleOngoing(models.TransientModel): + """Generate wizard for generate ongoing session report""" + _name = 'pos.sale.ongoing' + _description = 'Point of Sale Ongoing Session Report' + + session_ids = fields.Many2many('pos.session', + string='POS Ongoing Sessions', + required=True, + help="Currently ongoing sessions", + domain=[('state', '=', 'opened')]) + + def action_generate_report(self): + """Function to generate ongoing session report""" + data = {'session_ids': self.session_ids.ids} + return self.env.ref( + 'advanced_pos_reports.pos_ongoing_session_report').report_action( + [], data=data) diff --git a/advanced_pos_reports/wizard/pos_sale_ongoing_views.xml b/advanced_pos_reports/wizard/pos_sale_ongoing_views.xml new file mode 100644 index 000000000..1254674db --- /dev/null +++ b/advanced_pos_reports/wizard/pos_sale_ongoing_views.xml @@ -0,0 +1,23 @@ + + + + + pos.sale.ongoing.view.form + pos.sale.ongoing + +
+ + + +
+
+
+
+
+
diff --git a/advanced_pos_reports/wizard/pos_sale_posted.py b/advanced_pos_reports/wizard/pos_sale_posted.py new file mode 100644 index 000000000..b32a400c7 --- /dev/null +++ b/advanced_pos_reports/wizard/pos_sale_posted.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class PosSalePosted(models.TransientModel): + """Generate posted session report""" + _name = 'pos.sale.posted' + _description = 'Point of Sale Posted Session Report' + + session_ids = fields.Many2many('pos.session', + required=True, + string='POS Posted Sessions', + help="Pos posted sessions", + domain=[('state', '=', 'closed')]) + + def action_generate_report(self): + """Function to generate posted session report""" + data = {'session_ids': self.session_ids.ids} + return self.env.ref( + 'advanced_pos_reports.pos_posted_sessions_report').report_action( + [], data=data) diff --git a/advanced_pos_reports/wizard/pos_sale_posted_views.xml b/advanced_pos_reports/wizard/pos_sale_posted_views.xml new file mode 100644 index 000000000..13a780457 --- /dev/null +++ b/advanced_pos_reports/wizard/pos_sale_posted_views.xml @@ -0,0 +1,23 @@ + + + + + pos.sale.posted.view.form + pos.sale.posted + +
+ + + +
+
+
+
+
+
diff --git a/advanced_pos_reports/wizard/pos_sale_top_selling.py b/advanced_pos_reports/wizard/pos_sale_top_selling.py new file mode 100644 index 000000000..67df428c8 --- /dev/null +++ b/advanced_pos_reports/wizard/pos_sale_top_selling.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Sruthi Pavithran (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models, _ +from odoo.exceptions import ValidationError + + +class PosSaleTopSelling(models.TransientModel): + """Get top_selling product,category,customer from pos""" + _name = 'pos.sale.top.selling' + _description = 'Point of Sale Top Selling Product/Category/Customer Report' + + start_date = fields.Datetime(required=True, + string="Start Date", + help="Starting date") + end_date = fields.Datetime(required=True, + string="End Date", + help="Ending date") + top_selling = fields.Selection( + [('products', 'Products'), ('category', 'Categories'), + ('customers', 'Customers')], + string='Top Selling', default='products', + help="Select Top selling categories, products and customers") + no_of_products = fields.Integer(string="Number of Products", + help="Number of products") + no_of_categories = fields.Integer(string="No of Categories", + help="Number of categories") + no_of_customers = fields.Integer(string="Number of Customers", + help="Number of customers") + + def action_generate_report(self): + """Generate top_selling product,category,customer report from pos""" + if self.start_date > self.end_date: + raise ValidationError(_("The End Date must be greater than the " + "Start Date")) + data = { + 'start_date': self.start_date, 'end_date': self.end_date, + 'top_selling': self.top_selling + } + if self.top_selling == 'products': + data['no_of_products'] = self.no_of_products + return self.env.ref( + 'advanced_pos_reports.pos_top_selling_products_report' + ).report_action([], data=data) + elif self.top_selling == 'category': + data['no_of_categories'] = self.no_of_categories + return self.env.ref( + 'advanced_pos_reports.pos_top_selling_category_report' + ).report_action([], data=data) + elif self.top_selling == 'customers': + data['no_of_customers'] = self.no_of_customers + return self.env.ref( + 'advanced_pos_reports.pos_top_selling_customer_report' + ).report_action([], data=data) diff --git a/advanced_pos_reports/wizard/pos_sale_top_selling_views.xml b/advanced_pos_reports/wizard/pos_sale_top_selling_views.xml new file mode 100644 index 000000000..949988d48 --- /dev/null +++ b/advanced_pos_reports/wizard/pos_sale_top_selling_views.xml @@ -0,0 +1,34 @@ + + + + + pos.sale.top.selling.view.form + pos.sale.top.selling + +
+ + + + + + + + + + + + + +
+
+
+