diff --git a/top_selling_product_report/README.rst b/top_selling_product_report/README.rst new file mode 100644 index 000000000..aaabe644e --- /dev/null +++ b/top_selling_product_report/README.rst @@ -0,0 +1,19 @@ +Top/Least Selling Product Report v14 +==================================== +Top Selling and Least Selling Product Reports + +Installation +============ +- www.odoo.com/documentation/14.0/setup/install.html +- Install our custom addon + +Configuration +============= +No additional configurations needed + +Credits +======= +Developer: Ajmal JK @ cybrosys, Contact: odoo@cybrosys.com +V13 : Sreenath +V14 : Sayooj A O + diff --git a/top_selling_product_report/__init__.py b/top_selling_product_report/__init__.py new file mode 100644 index 000000000..0a7642f96 --- /dev/null +++ b/top_selling_product_report/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author:Cybrosys Techno Solutions(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import wizard +from . import report diff --git a/top_selling_product_report/__manifest__.py b/top_selling_product_report/__manifest__.py new file mode 100644 index 000000000..9abd58cd2 --- /dev/null +++ b/top_selling_product_report/__manifest__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# Author:Cybrosys Techno Solutions(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Top/Least Selling Product Report', + 'version': '14.0.1.0.0', + 'summary': 'Top Selling and Least Selling Product Reports', + 'description': 'Top Selling Products,Fast Moving Products,Most Selling Products,Top Growing Products,Least Selling Products,', + 'author': 'Cybrosys Techno solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'sale_management', 'stock', 'sale'], + 'category': 'Sale', + 'data': ['wizard/top_selling_wizard.xml', + 'report/top_selling_report.xml', + 'report/top_selling_report_template.xml', + 'security/ir.model.access.csv' + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/top_selling_product_report/doc/RELEASE_NOTES.md b/top_selling_product_report/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..bf7b24424 --- /dev/null +++ b/top_selling_product_report/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 17.10.2020 +#### Version 14.0.1.0.0 +##### ADD +- Initial commit for Top Selling Product Report diff --git a/top_selling_product_report/report/__init__.py b/top_selling_product_report/report/__init__.py new file mode 100644 index 000000000..3e8be5955 --- /dev/null +++ b/top_selling_product_report/report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author:Cybrosys Techno Solutions(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import top_selling_report diff --git a/top_selling_product_report/report/top_selling_report.py b/top_selling_product_report/report/top_selling_report.py new file mode 100644 index 000000000..6a4c3c08a --- /dev/null +++ b/top_selling_product_report/report/top_selling_report.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author:Cybrosys Techno Solutions(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from datetime import timedelta, date + +import dateutil.relativedelta +from dateutil.relativedelta import relativedelta + +from odoo import models + + +class CustomReport(models.AbstractModel): + _name = "report.top_selling_product_report.top_selling_reports" + _description = "Top selling products report" + + def _get_report_values(self, docids, data=None): + limit_value = data['period'] if data['period'] else None + date_option = data['date'] + date_selected_from = None + date_selected = None + date_selected_to = None + other_details = {} + + company_id = data['company'] + warehouse_id = data['warehouse'] + + from_date = date.today() - dateutil.relativedelta.relativedelta(years=100) + to_date = date.today() + dateutil.relativedelta.relativedelta(days=1) + + if date_option == 'days': + + from_date = date.today() - dateutil.relativedelta.relativedelta(days=11) + to_date = date.today() + dateutil.relativedelta.relativedelta(days=1) + date_selected = "Last 10 Days" + + elif date_option == 'last_month': + + date_limit = date.today() - dateutil.relativedelta.relativedelta(months=1) + from_date = date_limit.replace(day=1) + to_date = (date_limit + relativedelta(months=1, day=1)) - timedelta(1) + date_selected = "Last Month" + + elif date_option == 'curr_month': + + from_date = date.today().replace(day=1) + to_date = date.today() + dateutil.relativedelta.relativedelta(days=1) + date_selected = "Current Month" + + elif date_option == 'last_year': + + date_limit = date.today() - dateutil.relativedelta.relativedelta(years=1) + from_date = date_limit.replace(day=1) + to_date = (date_limit + relativedelta(months=12, day=1)) - timedelta(1) + date_selected = "Last Year" + + elif date_option == 'curr_year': + + date_limit = date.today() - dateutil.relativedelta.relativedelta(years=1) + from_date = date.today().replace(month=1, day=1) + to_date = date.today() + dateutil.relativedelta.relativedelta(days=1) + date_selected = "Current Year" + + elif date_option == 'select_period': + + from_date = data['from_date'] + to_date = data['to_date'] + date_selected_from = from_date + date_selected_to = to_date + + other_details.update({ + + 'limit': limit_value, + 'least': data['least'], + 'range': date_selected, + 'date_selected_from': date_selected_from, + 'date_selected_to': date_selected_to, + }) + + cr = self._cr + order = 'asc' if data['least'] else 'desc' + company_id = str(tuple(company_id)) if len(company_id) > 1 else "(" + str(company_id[0]) + ")" + warehouse_id = str(tuple(warehouse_id)) if len(warehouse_id) > 1 else "(" + str(warehouse_id[0]) + ")" + limit_clause = " limit'%s'" % limit_value if limit_value else "" + + query = ("""select sl.name as product_name,sum(product_uom_qty),pu.name from sale_order_line sl + JOIN sale_order so ON sl.order_id = so.id + JOIN uom_uom pu on sl.product_uom = pu.id + where so.date_order::DATE >= '%s'::DATE and + so.date_order::DATE <= '%s'::DATE and + sl.state = 'sale' and so.company_id in %s + and so.warehouse_id in %s + group by sl.name,pu.name order by sum %s""" % ( + from_date, to_date, company_id, warehouse_id, order)) + limit_clause + cr.execute(query) + dat = cr.dictfetchall() + + return { + 'data': dat, + 'other': other_details, + } diff --git a/top_selling_product_report/report/top_selling_report.xml b/top_selling_product_report/report/top_selling_report.xml new file mode 100644 index 000000000..066d7c3d0 --- /dev/null +++ b/top_selling_product_report/report/top_selling_report.xml @@ -0,0 +1,10 @@ + + + + Top Selling Product Report + top.selling + qweb-pdf + top_selling_product_report.top_selling_reports + top_selling_product_report.top_selling_reports + + diff --git a/top_selling_product_report/report/top_selling_report_template.xml b/top_selling_product_report/report/top_selling_report_template.xml new file mode 100644 index 000000000..c64f9c4a9 --- /dev/null +++ b/top_selling_product_report/report/top_selling_report_template.xml @@ -0,0 +1,95 @@ + + + + + + \ No newline at end of file diff --git a/top_selling_product_report/security/ir.model.access.csv b/top_selling_product_report/security/ir.model.access.csv new file mode 100644 index 000000000..a4c6a4946 --- /dev/null +++ b/top_selling_product_report/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_top_selling_user,access_top_selling_user_id,model_top_selling,sales_team.group_sale_manager,1,1,1,1 + diff --git a/top_selling_product_report/static/description/banner.png b/top_selling_product_report/static/description/banner.png new file mode 100644 index 000000000..5e852fd5e Binary files /dev/null and b/top_selling_product_report/static/description/banner.png differ diff --git a/top_selling_product_report/static/description/cybro_logo.png b/top_selling_product_report/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/top_selling_product_report/static/description/cybro_logo.png differ diff --git a/top_selling_product_report/static/description/icon.png b/top_selling_product_report/static/description/icon.png new file mode 100644 index 000000000..6a1e65aaf Binary files /dev/null and b/top_selling_product_report/static/description/icon.png differ diff --git a/top_selling_product_report/static/description/images/1top_least.png b/top_selling_product_report/static/description/images/1top_least.png new file mode 100644 index 000000000..8267124b6 Binary files /dev/null and b/top_selling_product_report/static/description/images/1top_least.png differ diff --git a/top_selling_product_report/static/description/images/2top_least.png b/top_selling_product_report/static/description/images/2top_least.png new file mode 100644 index 000000000..22db70c27 Binary files /dev/null and b/top_selling_product_report/static/description/images/2top_least.png differ diff --git a/top_selling_product_report/static/description/images/3top_least.png b/top_selling_product_report/static/description/images/3top_least.png new file mode 100644 index 000000000..f27ad5347 Binary files /dev/null and b/top_selling_product_report/static/description/images/3top_least.png differ diff --git a/top_selling_product_report/static/description/images/4top_least.png b/top_selling_product_report/static/description/images/4top_least.png new file mode 100644 index 000000000..f73bda5fe Binary files /dev/null and b/top_selling_product_report/static/description/images/4top_least.png differ diff --git a/top_selling_product_report/static/description/images/banner_lifeline_for_task.jpeg b/top_selling_product_report/static/description/images/banner_lifeline_for_task.jpeg new file mode 100644 index 000000000..4a467ea22 Binary files /dev/null and b/top_selling_product_report/static/description/images/banner_lifeline_for_task.jpeg differ diff --git a/top_selling_product_report/static/description/images/banner_project_report_xls_pdf.png b/top_selling_product_report/static/description/images/banner_project_report_xls_pdf.png new file mode 100644 index 000000000..3c430a7eb Binary files /dev/null and b/top_selling_product_report/static/description/images/banner_project_report_xls_pdf.png differ diff --git a/top_selling_product_report/static/description/images/banner_project_status_report.png b/top_selling_product_report/static/description/images/banner_project_status_report.png new file mode 100644 index 000000000..d1b689710 Binary files /dev/null and b/top_selling_product_report/static/description/images/banner_project_status_report.png differ diff --git a/top_selling_product_report/static/description/images/banner_subtask.jpeg b/top_selling_product_report/static/description/images/banner_subtask.jpeg new file mode 100644 index 000000000..f2b224110 Binary files /dev/null and b/top_selling_product_report/static/description/images/banner_subtask.jpeg differ diff --git a/top_selling_product_report/static/description/images/banner_task_deadline_reminder.jpeg b/top_selling_product_report/static/description/images/banner_task_deadline_reminder.jpeg new file mode 100644 index 000000000..998679818 Binary files /dev/null and b/top_selling_product_report/static/description/images/banner_task_deadline_reminder.jpeg differ diff --git a/top_selling_product_report/static/description/images/banner_task_statusbar.jpeg b/top_selling_product_report/static/description/images/banner_task_statusbar.jpeg new file mode 100644 index 000000000..2c57cbb7b Binary files /dev/null and b/top_selling_product_report/static/description/images/banner_task_statusbar.jpeg differ diff --git a/top_selling_product_report/static/description/images/checked.png b/top_selling_product_report/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/top_selling_product_report/static/description/images/checked.png differ diff --git a/top_selling_product_report/static/description/images/cybrosys.png b/top_selling_product_report/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/top_selling_product_report/static/description/images/cybrosys.png differ diff --git a/top_selling_product_report/static/description/images/least.png b/top_selling_product_report/static/description/images/least.png new file mode 100644 index 000000000..cf6ae4a9c Binary files /dev/null and b/top_selling_product_report/static/description/images/least.png differ diff --git a/top_selling_product_report/static/description/index.html b/top_selling_product_report/static/description/index.html new file mode 100644 index 000000000..03e7b39ec --- /dev/null +++ b/top_selling_product_report/static/description/index.html @@ -0,0 +1,312 @@ +
cybrosys-logo
+
+
+
+

Top/Least Selling Product Report

+

Top Selling and Least Selling Product Reports

+
+

Key Highlights

+
    +
  • Generates top/least selling product report.
  • +
  • Generates reports for certain time periods.
  • +
  • Report for a range of product.
  • + +
+
+
+
+
+
+
+
+ +
+
+ +

Overview

+
+

+ This module helps in generating top selling and least selling product pdf reports. One can generate top/least selling product report according to the company and warehouse for range of period.

+
+
+ +

Top/Least Selling Product Report

+
+
    +
  • + Generates top/least selling product report. +
  • + +
  • + Generates reports for certain time periods. +
  • + +
  • + HReport for a range of product. +
  • +
+
+ +
+
+

Screenshots

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

Suggested Products

+
+ +
+
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+ +
+
+

Trading

+

Easily procure and sell your products.

+
+
+
+
+ +
+
+

Manufacturing

+

Plan, track and schedule your operations.

+
+
+
+
+ +
+
+

Restaurant

+

Run your bar or restaurant methodical.

+
+
+
+
+ +
+
+

POS

+

Easy configuring and convivial selling.

+
+
+
+
+ +
+
+

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages.

+
+
+
+
+ +
+
+

Hotel Management

+

An all-inclusive hotel management application.

+
+
+
+
+ +
+
+

Education

+

A Collaborative platform for educational management.

+
+
+
+
+ +
+
+

Service Management

+

Keep track of services and invoice accordingly.

+
+
+
+
+
+ +
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com / info@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + + + + + +
+
+
+ \ No newline at end of file diff --git a/top_selling_product_report/wizard/__init__.py b/top_selling_product_report/wizard/__init__.py new file mode 100644 index 000000000..b10fd6260 --- /dev/null +++ b/top_selling_product_report/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author:Cybrosys Techno Solutions(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import top_selling_wizard diff --git a/top_selling_product_report/wizard/top_selling_wizard.py b/top_selling_product_report/wizard/top_selling_wizard.py new file mode 100644 index 000000000..15000b1e6 --- /dev/null +++ b/top_selling_product_report/wizard/top_selling_wizard.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author:Cybrosys Techno Solutions(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class TopSellingWizard(models.TransientModel): + _name = 'top.selling' + _description = 'Top selling Products' + + from_date = fields.Date(string='From') + to_date = fields.Date(string='To') + date = fields.Selection([('days', 'Last 10 Days'), ('curr_month', 'Current Month'), ('last_month', 'Last Month'), + ('curr_year', 'Current Year'), ('last_year', 'Last Year'), + ('select_period', 'Select Period')], + string="Top Selling product of", default='days') + period = fields.Char(string="Products Range", help="Enter number of products in report.") + least = fields.Boolean(string="Least Selling Product", default=False) + company = fields.Many2many('res.company', default=lambda self: self.env.user.company_id, string="Company") + warehouse = fields.Many2many('stock.warehouse', string="Warehouse") + + def print_report(self): + company_id = [] + warehouse_id = [] + + if self.company: + for val in self.company: + company_id.append(val.id) + else: + company = self.env['res.company'].search([]) + for val in company: + company_id.append(val.id) + + if self.warehouse: + for val in self.warehouse: + warehouse_id.append(val.id) + else: + warehouse = self.env['stock.warehouse'].search([]) + for val in warehouse: + warehouse_id.append(val.id) + + data = {'date': self.date, 'period': self.period, 'least': self.least, 'from_date': self.from_date, + 'to_date': self.to_date, 'company': company_id, 'warehouse': warehouse_id} + + return self.env.ref('top_selling_product_report.top_selling_pdf').report_action(self, data=data) diff --git a/top_selling_product_report/wizard/top_selling_wizard.xml b/top_selling_product_report/wizard/top_selling_wizard.xml new file mode 100644 index 000000000..275e758c7 --- /dev/null +++ b/top_selling_product_report/wizard/top_selling_wizard.xml @@ -0,0 +1,51 @@ + + + + Top/Least Selling Products + top.selling + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Top/Least Selling Products + top.selling + form + new + + + +
\ No newline at end of file