Browse Source

NOV 29 : [ADD] Initial Commit 'advanced_pos_reports'

pull/295/head
Shijin V 1 year ago
parent
commit
39aec71053
  1. 48
      advanced_pos_reports/README.rst
  2. 24
      advanced_pos_reports/__init__.py
  3. 98
      advanced_pos_reports/__manifest__.py
  4. 6
      advanced_pos_reports/doc/RELEASE_NOTES.md
  5. 24
      advanced_pos_reports/models/__init__.py
  6. 42
      advanced_pos_reports/models/pos_config.py
  7. 76
      advanced_pos_reports/models/pos_order.py
  8. 42
      advanced_pos_reports/models/pos_payment.py
  9. 26
      advanced_pos_reports/report/__init__.py
  10. 38
      advanced_pos_reports/report/advanced_pos_reports.xml
  11. 111
      advanced_pos_reports/report/pos_ongoing_session_report.py
  12. 134
      advanced_pos_reports/report/pos_ongoing_session_templates.xml
  13. 116
      advanced_pos_reports/report/pos_posted_session_report.py
  14. 150
      advanced_pos_reports/report/pos_posted_session_templates.xml
  15. 71
      advanced_pos_reports/report/pos_top_selling_categories_report.py
  16. 65
      advanced_pos_reports/report/pos_top_selling_categories_templates.xml
  17. 66
      advanced_pos_reports/report/pos_top_selling_customers_report.py
  18. 64
      advanced_pos_reports/report/pos_top_selling_customers_templates.xml
  19. 76
      advanced_pos_reports/report/pos_top_selling_products_report.py
  20. 71
      advanced_pos_reports/report/pos_top_selling_products_templates.xml
  21. 4
      advanced_pos_reports/security/ir.model.access.csv
  22. BIN
      advanced_pos_reports/static/description/assets/icons/check.png
  23. BIN
      advanced_pos_reports/static/description/assets/icons/chevron.png
  24. BIN
      advanced_pos_reports/static/description/assets/icons/cogs.png
  25. BIN
      advanced_pos_reports/static/description/assets/icons/consultation.png
  26. BIN
      advanced_pos_reports/static/description/assets/icons/ecom-black.png
  27. BIN
      advanced_pos_reports/static/description/assets/icons/education-black.png
  28. BIN
      advanced_pos_reports/static/description/assets/icons/hotel-black.png
  29. BIN
      advanced_pos_reports/static/description/assets/icons/license.png
  30. BIN
      advanced_pos_reports/static/description/assets/icons/lifebuoy.png
  31. BIN
      advanced_pos_reports/static/description/assets/icons/manufacturing-black.png
  32. BIN
      advanced_pos_reports/static/description/assets/icons/pos-black.png
  33. BIN
      advanced_pos_reports/static/description/assets/icons/puzzle.png
  34. BIN
      advanced_pos_reports/static/description/assets/icons/restaurant-black.png
  35. BIN
      advanced_pos_reports/static/description/assets/icons/service-black.png
  36. BIN
      advanced_pos_reports/static/description/assets/icons/trading-black.png
  37. BIN
      advanced_pos_reports/static/description/assets/icons/training.png
  38. BIN
      advanced_pos_reports/static/description/assets/icons/update.png
  39. BIN
      advanced_pos_reports/static/description/assets/icons/user.png
  40. BIN
      advanced_pos_reports/static/description/assets/icons/wrench.png
  41. BIN
      advanced_pos_reports/static/description/assets/misc/categories.png
  42. BIN
      advanced_pos_reports/static/description/assets/misc/check-box.png
  43. BIN
      advanced_pos_reports/static/description/assets/misc/compass.png
  44. BIN
      advanced_pos_reports/static/description/assets/misc/corporate.png
  45. BIN
      advanced_pos_reports/static/description/assets/misc/customer-support.png
  46. BIN
      advanced_pos_reports/static/description/assets/misc/cybrosys-logo.png
  47. BIN
      advanced_pos_reports/static/description/assets/misc/features.png
  48. BIN
      advanced_pos_reports/static/description/assets/misc/logo.png
  49. BIN
      advanced_pos_reports/static/description/assets/misc/pictures.png
  50. BIN
      advanced_pos_reports/static/description/assets/misc/pie-chart.png
  51. BIN
      advanced_pos_reports/static/description/assets/misc/right-arrow.png
  52. BIN
      advanced_pos_reports/static/description/assets/misc/star.png
  53. BIN
      advanced_pos_reports/static/description/assets/misc/support.png
  54. BIN
      advanced_pos_reports/static/description/assets/misc/whatsapp.png
  55. BIN
      advanced_pos_reports/static/description/assets/modules/1.png
  56. BIN
      advanced_pos_reports/static/description/assets/modules/2.png
  57. BIN
      advanced_pos_reports/static/description/assets/modules/3.png
  58. BIN
      advanced_pos_reports/static/description/assets/modules/4.png
  59. BIN
      advanced_pos_reports/static/description/assets/modules/5.png
  60. BIN
      advanced_pos_reports/static/description/assets/modules/6.png
  61. BIN
      advanced_pos_reports/static/description/assets/screenshots/advance_003.png
  62. BIN
      advanced_pos_reports/static/description/assets/screenshots/advance_006.png
  63. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos.png
  64. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_01.png
  65. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt.png
  66. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_01.png
  67. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_02.png
  68. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_03.png
  69. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_04.png
  70. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_05.png
  71. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_06.png
  72. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_07.png
  73. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_08.png
  74. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_09.png
  75. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_10.png
  76. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_11.png
  77. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_12.png
  78. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_13.png
  79. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_14.png
  80. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_15.png
  81. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_16.png
  82. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_17.png
  83. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_18.png
  84. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_19.png
  85. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_20.png
  86. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_21.png
  87. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_22.png
  88. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_01.png
  89. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_02.png
  90. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_03.png
  91. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_04.png
  92. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_05.png
  93. BIN
      advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_06.png
  94. BIN
      advanced_pos_reports/static/description/assets/screenshots/hero.gif
  95. BIN
      advanced_pos_reports/static/description/assets/screenshots/report.png
  96. BIN
      advanced_pos_reports/static/description/assets/screenshots/report00.png
  97. BIN
      advanced_pos_reports/static/description/assets/screenshots/report01.png
  98. BIN
      advanced_pos_reports/static/description/assets/screenshots/report02.png
  99. BIN
      advanced_pos_reports/static/description/assets/screenshots/report2.png
  100. BIN
      advanced_pos_reports/static/description/assets/screenshots/report3.png

48
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 <https://cybrosys.com/>`__
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 <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

24
advanced_pos_reports/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import models
from . import report
from . import wizard

98
advanced_pos_reports/__manifest__.py

@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
{
'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,
}

6
advanced_pos_reports/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <advanced_pos_reports>
#### 29.11.2023
#### Version 16.0.1.0.0
#### ADD
- Initial Commit for Advanced POS Reports.

24
advanced_pos_reports/models/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import pos_config
from . import pos_order
from . import pos_payment

42
advanced_pos_reports/models/pos_config.py

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

76
advanced_pos_reports/models/pos_order.py

@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

42
advanced_pos_reports/models/pos_payment.py

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

26
advanced_pos_reports/report/__init__.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

38
advanced_pos_reports/report/advanced_pos_reports.xml

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Action for pos posted sessions report-->
<record id="pos_posted_sessions_report" model="ir.actions.report">
<field name="name">Posted Sessions</field>
<field name="model">report.advanced_pos_reports.report_pos_posted_session</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_pos_reports.report_pos_posted_session</field>
</record>
<!-- Action for pos ongoing sessions report -->
<record id="pos_ongoing_session_report" model="ir.actions.report">
<field name="name">Ongoing Sessions</field>
<field name="model">report.advanced_pos_reports.report_pos_ongoing_session</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_pos_reports.report_pos_ongoing_session</field>
</record>
<!-- Action for pos top-selling products report-->
<record id="pos_top_selling_products_report" model="ir.actions.report">
<field name="name">Top Selling Products Report</field>
<field name="model">report.advanced_pos_reports.report_pos_top_selling_products</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_pos_reports.report_pos_top_selling_products</field>
</record>
<!-- Action for pos top-selling categories report-->
<record id="pos_top_selling_category_report" model="ir.actions.report">
<field name="name">Top Selling Categories Report</field>
<field name="model">report.advanced_pos_reports.report_pos_top_selling_categories</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_pos_reports.report_pos_top_selling_categories</field>
</record>
<!-- Action for pos top-selling customers report-->
<record id="pos_top_selling_customer_report" model="ir.actions.report">
<field name="name">Top Selling Customers Report</field>
<field name="model">report.advanced_pos_reports.report_pos_top_selling_customers</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">advanced_pos_reports.report_pos_top_selling_customers</field>
</record>
</odoo>

111
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(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

134
advanced_pos_reports/report/pos_ongoing_session_templates.xml

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Template for ongoing session report-->
<template id="report_pos_ongoing_session">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<div class="text-center">
<h2>Ongoing Sessions Report</h2>
</div>
<table class="table table-lg">
<tbody>
<tr>
<td>Report Date:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "date"}'/>
</td>
</tr>
<tr>
<td>Report Time:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "datetime", "time_only": True}'/>
</td>
</tr>
<tr>
<td>Session(s):</td>
<td style="text-align: right;">
<t t-foreach="sessions" t-as="session">
<t t-esc="session.name"/>
</t>
</td>
</tr>
<tr>
<td>Status:</td>
<td style="text-align: right;">
Opened
</td>
</tr>
<tr>
<td>Opening Balance:</td>
<td style="text-align: right;">
<t t-esc="sum(sessions.mapped('cash_register_balance_start'))"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Sales Without Tax:</td>
<td style="text-align: right;">
<t t-esc="amount_total_without_tax"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Tax:</td>
<td style="text-align: right;">
<t t-esc="amount_total_tax"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Returns:</td>
<td style="text-align: right;">
<t t-esc="amount_return"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Total:</td>
<td style="text-align: right;">
<t t-esc="amount_total"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
</tbody>
</table>
<center>
<h3>Department Sales</h3>
</center>
<table class="table table-lg">
<tbody>
<t t-set="total" t-value="0"/>
<tr t-foreach='categories' t-as='category'>
<td>
<t t-esc="category['name']['en_US']"/>
</td>
<td style="text-align: right;">
<t t-esc="category['amount']"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
<t t-set="total"
t-value="total + category['amount']"/>
</tr>
<tr>
<td>Total</td>
<td style="text-align: right;">
<t t-esc="total"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
</tbody>
</table>
<center>
<h3>Payments</h3>
</center>
<table class="table table-sm">
<tbody>
<t t-set="total" t-value="0"/>
<tr t-foreach='payments' t-as='payment'>
<td>
<t t-esc="payment['name']['en_US']"/>
</td>
<td style="text-align: right;">
<t t-esc="payment['total']"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
<t t-set="total"
t-value="total + payment['total']"/>
</tr>
<tr>
<td>Total</td>
<td style="text-align: right;">
<t t-esc="total"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

116
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(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

150
advanced_pos_reports/report/pos_posted_session_templates.xml

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Template for posted session report of pos-->
<template id="report_pos_posted_session">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<div class="text-center">
<h2>Posted Sessions Report</h2>
</div>
<table class="table table-lg">
<tbody>
<tr>
<td>Report Date:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "date"}'/>
</td>
</tr>
<tr>
<td>Report Time:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "datetime", "time_only": True}'/>
</td>
</tr>
<tr>
<td>Session(s):</td>
<td style="text-align: right;">
<t t-foreach="sessions" t-as="session">
<t t-esc="session.name"/>
</t>
</td>
</tr>
<tr>
<td>Status:</td>
<td style="text-align: right;">
Closed
</td>
</tr>
<tr>
<td>Opening Balance:</td>
<td style="text-align: right;">
<t t-esc="sum(sessions.mapped('cash_register_balance_start'))"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Closing Balance:</td>
<td style="text-align: right;">
<t t-esc="sum(sessions.mapped('cash_register_balance_end_real'))"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Difference:</td>
<td style="text-align: right;">
<t t-esc="sum(sessions.mapped('cash_register_difference'))"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Sales Without Tax:</td>
<td style="text-align: right;">
<t t-esc="amount_total_without_tax"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Tax:</td>
<td style="text-align: right;">
<t t-esc="amount_total_tax"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Returns:</td>
<td style="text-align: right;">
<t t-esc="amount_return"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
<tr>
<td>Total:</td>
<td style="text-align: right;">
<t t-esc="amount_total"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
</tbody>
</table>
<br/>
<center>
<h3>Department Sales</h3>
</center>
<table class="table table-lg">
<tbody>
<t t-set="total" t-value="0"/>
<tr t-foreach='categories' t-as='category'>
<td>
<t t-esc="category['name']['en_US']"/>
</td>
<td style="text-align: right;">
<t t-esc="category['amount']"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
<t t-set="total"
t-value="total + category['amount']"/>
</tr>
<tr>
<td>Total</td>
<td style="text-align: right;">
<t t-esc="total"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
</tbody>
</table>
<br/>
<center>
<h3>Payments</h3>
</center>
<table class="table table-sm">
<tbody>
<t t-set="total" t-value="0"/>
<tr t-foreach='payments' t-as='payment'>
<td>
<t t-esc="payment['name']['en_US']"/>
</td>
<td style="text-align: right;">
<t t-esc="payment['total']"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
<t t-set="total"
t-value="total + payment['total']"/>
</tr>
<tr>
<td>Total</td>
<td style="text-align: right;">
<t t-esc="total"
t-options="{'widget': 'float', 'precision': currency_precision}"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

71
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(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

65
advanced_pos_reports/report/pos_top_selling_categories_templates.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Template for top_selling categories report of pos-->
<template id="report_pos_top_selling_categories">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<div class="text-center">
<h2>Top Selling Categories</h2>
</div>
<table class="table table-lg">
<tbody>
<tr>
<td>Report Date:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "date"}'/>
</td>
</tr>
<tr>
<td>Report Time:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "datetime", "time_only": True}'/>
</td>
</tr>
<tr>
<td>Start Date:</td>
<td style="text-align: right;">
<t t-esc="start_date"/>
</td>
</tr>
<tr>
<td>End Date:</td>
<td style="text-align: right;">
<t t-esc="end_date"/>
</td>
</tr>
</tbody>
</table>
<br/>
<table class="table table-lg">
<thead>
<th>Category</th>
<th style="text-align: right;">Total</th>
</thead>
<tbody>
<tr t-foreach="categories" t-as="category">
<td>
<t t-esc="category['name']['en_US']"/>
</td>
<td style="text-align: right;">
<t t-esc="category['amount']"/>
</td>
</tr>
<br/>
</tbody>
</table>
<br/>
</div>
</t>
</t>
</template>
</odoo>

66
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(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

64
advanced_pos_reports/report/pos_top_selling_customers_templates.xml

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Template for top_selling customers report of pos-->
<template id="report_pos_top_selling_customers">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<div class="text-center">
<h2>Top Customers</h2>
</div>
<table class="table table-lg">
<tbody>
<tr>
<td>Report Date:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "date"}'/>
</td>
</tr>
<tr>
<td>Report Time:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "datetime", "time_only": True}'/>
</td>
</tr>
<tr>
<td>Start Date:</td>
<td style="text-align: right;">
<t t-esc="start_date"/>
</td>
</tr>
<tr>
<td>End Date:</td>
<td style="text-align: right;">
<t t-esc="end_date"/>
</td>
</tr>
</tbody>
</table>
<br/>
<table class="table table-lg">
<thead>
<th>Customer</th>
<th style="text-align: right;">Amount</th>
</thead>
<tbody>
<tr t-foreach="customers" t-as="customer">
<td>
<t t-esc="customer['name']"/>
</td>
<td style="text-align: right;">
<t t-esc="customer['amount']"/>
</td>
</tr>
<br/>
</tbody>
</table>
<br/>
</div>
</t>
</t>
</template>
</odoo>

76
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(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
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

71
advanced_pos_reports/report/pos_top_selling_products_templates.xml

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Template for top_selling products report of pos-->
<template id="report_pos_top_selling_products">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<div class="text-center">
<h2>Top Selling Products</h2>
</div>
<table class="table table-lg">
<tbody>
<tr>
<td>Report Date:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "date"}'/>
</td>
</tr>
<tr>
<td>Report Time:</td>
<td style="text-align: right;">
<t t-esc="today"
t-options='{"widget": "datetime", "time_only": True}'/>
</td>
</tr>
<tr>
<td>Start Date:</td>
<td style="text-align: right;">
<t t-esc="start_date"/>
</td>
</tr>
<tr>
<td>End Date:</td>
<td style="text-align: right;">
<t t-esc="end_date"/>
</td>
</tr>
</tbody>
</table>
<br/>
<table class="table table-lg">
<thead>
<th>Product</th>
<th style="text-align: center;">Quantity</th>
<th style="text-align: right;">Unit</th>
</thead>
<tbody>
<tr t-foreach="products" t-as="product">
<td>
<t t-if="product['code']">[<t
t-esc="product['code']"/>]
</t>
<t t-esc="product['name']['en_US']"/>
</td>
<td style="text-align: center;">
<t t-esc="product['qty']"/>
</td>
<td style="text-align: right;">
<t t-esc="product['uom']['en_US']"/>
</td>
</tr>
<br/>
</tbody>
</table>
<br/>
</div>
</t>
</t>
</template>
</odoo>

4
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 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
3 access_pos_sale_ongoing_user access.pos.sale.ongoing.user model_pos_sale_ongoing point_of_sale.group_pos_manager 1 1 1 0
4 access_pos_sale_posted_user access.pos.sale.posted.user model_pos_sale_posted point_of_sale.group_pos_manager 1 1 1 0

BIN
advanced_pos_reports/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
advanced_pos_reports/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
advanced_pos_reports/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
advanced_pos_reports/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
advanced_pos_reports/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
advanced_pos_reports/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
advanced_pos_reports/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
advanced_pos_reports/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
advanced_pos_reports/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
advanced_pos_reports/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
advanced_pos_reports/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
advanced_pos_reports/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
advanced_pos_reports/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
advanced_pos_reports/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
advanced_pos_reports/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
advanced_pos_reports/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
advanced_pos_reports/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
advanced_pos_reports/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
advanced_pos_reports/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
advanced_pos_reports/static/description/assets/misc/categories.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
advanced_pos_reports/static/description/assets/misc/check-box.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
advanced_pos_reports/static/description/assets/misc/compass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
advanced_pos_reports/static/description/assets/misc/corporate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
advanced_pos_reports/static/description/assets/misc/customer-support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
advanced_pos_reports/static/description/assets/misc/cybrosys-logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
advanced_pos_reports/static/description/assets/misc/features.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
advanced_pos_reports/static/description/assets/misc/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
advanced_pos_reports/static/description/assets/misc/pictures.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
advanced_pos_reports/static/description/assets/misc/pie-chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
advanced_pos_reports/static/description/assets/misc/right-arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

BIN
advanced_pos_reports/static/description/assets/misc/star.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
advanced_pos_reports/static/description/assets/misc/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
advanced_pos_reports/static/description/assets/misc/whatsapp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
advanced_pos_reports/static/description/assets/modules/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
advanced_pos_reports/static/description/assets/modules/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
advanced_pos_reports/static/description/assets/modules/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
advanced_pos_reports/static/description/assets/modules/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
advanced_pos_reports/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
advanced_pos_reports/static/description/assets/modules/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advance_003.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advance_006.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_03.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_04.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_05.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_06.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_07.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_08.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_09.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_12.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_13.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_14.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_15.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_17.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_18.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_19.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_20.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_21.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_receipt_22.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_03.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_04.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_05.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/advanced_pos_report_06.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/hero.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/report.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/report00.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/report01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/report02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/report2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
advanced_pos_reports/static/description/assets/screenshots/report3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save