diff --git a/top_selling_product_report/README.rst b/top_selling_product_report/README.rst new file mode 100644 index 000000000..dda64dcc1 --- /dev/null +++ b/top_selling_product_report/README.rst @@ -0,0 +1,20 @@ +Top/Least Selling Product Report v15 +==================================== +Top Selling and Least Selling Product Reports + +Installation +============ +- www.odoo.com/documentation/15.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 +V15 : Irfan @ cybrosys + 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..ffd835fd7 --- /dev/null +++ b/top_selling_product_report/__manifest__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2021-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': '15.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..6899a0dd2 --- /dev/null +++ b/top_selling_product_report/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 17.10.2020 +#### Version 15.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/assets/icons/check.png b/top_selling_product_report/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/check.png differ diff --git a/top_selling_product_report/static/description/assets/icons/chevron.png b/top_selling_product_report/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/chevron.png differ diff --git a/top_selling_product_report/static/description/assets/icons/cogs.png b/top_selling_product_report/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/cogs.png differ diff --git a/top_selling_product_report/static/description/assets/icons/consultation.png b/top_selling_product_report/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/consultation.png differ diff --git a/top_selling_product_report/static/description/assets/icons/ecom-black.png b/top_selling_product_report/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/ecom-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/education-black.png b/top_selling_product_report/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/education-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/hotel-black.png b/top_selling_product_report/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/hotel-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/license.png b/top_selling_product_report/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/license.png differ diff --git a/top_selling_product_report/static/description/assets/icons/lifebuoy.png b/top_selling_product_report/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/lifebuoy.png differ diff --git a/top_selling_product_report/static/description/assets/icons/logo.png b/top_selling_product_report/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/logo.png differ diff --git a/top_selling_product_report/static/description/assets/icons/manufacturing-black.png b/top_selling_product_report/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/manufacturing-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/pos-black.png b/top_selling_product_report/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/pos-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/puzzle.png b/top_selling_product_report/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/puzzle.png differ diff --git a/top_selling_product_report/static/description/assets/icons/restaurant-black.png b/top_selling_product_report/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/restaurant-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/service-black.png b/top_selling_product_report/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/service-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/trading-black.png b/top_selling_product_report/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/trading-black.png differ diff --git a/top_selling_product_report/static/description/assets/icons/training.png b/top_selling_product_report/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/training.png differ diff --git a/top_selling_product_report/static/description/assets/icons/update.png b/top_selling_product_report/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/update.png differ diff --git a/top_selling_product_report/static/description/assets/icons/user.png b/top_selling_product_report/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/user.png differ diff --git a/top_selling_product_report/static/description/assets/icons/wrench.png b/top_selling_product_report/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/top_selling_product_report/static/description/assets/icons/wrench.png differ diff --git a/top_selling_product_report/static/description/assets/modules/budget_image.png b/top_selling_product_report/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..b50130c7d Binary files /dev/null and b/top_selling_product_report/static/description/assets/modules/budget_image.png differ diff --git a/top_selling_product_report/static/description/assets/modules/credit_image.png b/top_selling_product_report/static/description/assets/modules/credit_image.png new file mode 100644 index 000000000..3ad04ecfd Binary files /dev/null and b/top_selling_product_report/static/description/assets/modules/credit_image.png differ diff --git a/top_selling_product_report/static/description/assets/modules/employee_image.png b/top_selling_product_report/static/description/assets/modules/employee_image.png new file mode 100644 index 000000000..30ad58232 Binary files /dev/null and b/top_selling_product_report/static/description/assets/modules/employee_image.png differ diff --git a/top_selling_product_report/static/description/assets/modules/gantt_image.png b/top_selling_product_report/static/description/assets/modules/gantt_image.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/top_selling_product_report/static/description/assets/modules/gantt_image.png differ diff --git a/top_selling_product_report/static/description/assets/modules/payroll_image.png b/top_selling_product_report/static/description/assets/modules/payroll_image.png new file mode 100644 index 000000000..7f2815273 Binary files /dev/null and b/top_selling_product_report/static/description/assets/modules/payroll_image.png differ diff --git a/top_selling_product_report/static/description/assets/modules/quotation_image.png b/top_selling_product_report/static/description/assets/modules/quotation_image.png new file mode 100644 index 000000000..499b1a72f Binary files /dev/null and b/top_selling_product_report/static/description/assets/modules/quotation_image.png differ diff --git a/top_selling_product_report/static/description/assets/screenshots/confirm_button.png b/top_selling_product_report/static/description/assets/screenshots/confirm_button.png new file mode 100644 index 000000000..498d9249c Binary files /dev/null and b/top_selling_product_report/static/description/assets/screenshots/confirm_button.png differ diff --git a/top_selling_product_report/static/description/assets/screenshots/draft_state.png b/top_selling_product_report/static/description/assets/screenshots/draft_state.png new file mode 100644 index 000000000..b802b91f6 Binary files /dev/null and b/top_selling_product_report/static/description/assets/screenshots/draft_state.png differ diff --git a/top_selling_product_report/static/description/assets/screenshots/hero.png b/top_selling_product_report/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..97de0f736 Binary files /dev/null and b/top_selling_product_report/static/description/assets/screenshots/hero.png differ diff --git a/top_selling_product_report/static/description/assets/screenshots/product_manager.png b/top_selling_product_report/static/description/assets/screenshots/product_manager.png new file mode 100644 index 000000000..19ccd9ee8 Binary files /dev/null and b/top_selling_product_report/static/description/assets/screenshots/product_manager.png differ diff --git a/top_selling_product_report/static/description/assets/screenshots/reset_to_draft.png b/top_selling_product_report/static/description/assets/screenshots/reset_to_draft.png new file mode 100644 index 000000000..e8d52bea0 Binary files /dev/null and b/top_selling_product_report/static/description/assets/screenshots/reset_to_draft.png differ diff --git a/top_selling_product_report/static/description/assets/screenshots/sale_order_line.png b/top_selling_product_report/static/description/assets/screenshots/sale_order_line.png new file mode 100644 index 000000000..d313cd42d Binary files /dev/null and b/top_selling_product_report/static/description/assets/screenshots/sale_order_line.png differ 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..1e9348d73 Binary files /dev/null and b/top_selling_product_report/static/description/banner.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..c28d48ee1 Binary files /dev/null and b/top_selling_product_report/static/description/icon.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..7c7a209d7 --- /dev/null +++ b/top_selling_product_report/static/description/index.html @@ -0,0 +1,624 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+
+

+ Product Approval

+

+ Approval Management provides users Approval Feature on product creation, and only approved products can + be used in sale orders +

+ +
+
+ + + + +
+
+

+ Overview +

+
+ +
+

+ Introducing Approval For Products in version 14 community. The module helps provides users with an + Approval Feature on product creation and only those approved products can be used in sale orders.

+ +
+
+ + +
+
+

+ Features +

+
+ +
+
+ +
+
+

+ Community & Enterprise Support

+

+ Available in Odoo 14.0 Community and Enterprise.

+
+
+
+
+ +
+
+

+ New User group Product Manager is created.

+
+
+ +
+
+ +
+
+

+ Only the Product Manager can Approve the products created.

+
+
+ +
+
+ +
+
+

+ By default the products creation will be in draft state.

+
+
+ +
+
+ +
+
+

+ Only the confirmed Products can be selected in Sale Order.

+
+
+
+
+ +
+
+

+ Product Manager Can also reset the confirm state to draft.

+
+
+ +
+ +
+
+

+ Screenshots +

+
+
+

+ New User group Product Manager is created

+ +
+ +
+

+ By default the products creation will be in draft state

+ + +
+ +
+

+ Product Manager can Approve the products created by clicking the confirm button

+ + +
+
+

+ Product Manager Can also reset the confirm state to draft

+ + +
+
+

+ only the confirmed Products can be selected in Sale Order

+ + +
+ +
+ + +
+
+

Suggested 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?

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