diff --git a/discount_limit/README.rst b/discount_limit/README.rst new file mode 100644 index 000000000..362a1fb06 --- /dev/null +++ b/discount_limit/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +POS Discount Limit +================== +This module adds an option to limit the discount for POS product categories and restrict the global discount for POS cashiers. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +======= +General Public License, version 3 (AGPL v3). +("https://www.odoo.com/documentation/16.0/legal/licenses.html") + +Credits +------- +Developer : (V16) Bhagyadev KP, Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your +issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/discount_limit/__init__.py b/discount_limit/__init__.py new file mode 100644 index 000000000..9c2c7f81d --- /dev/null +++ b/discount_limit/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 models diff --git a/discount_limit/__manifest__.py b/discount_limit/__manifest__.py new file mode 100644 index 000000000..51faaf920 --- /dev/null +++ b/discount_limit/__manifest__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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': "POS Discount Limit & Restrict Global Discount", + 'version': '16.0.1.0.0', + 'category': 'Point of Sale', + 'summary': """This module is used to limit the discount on pos + product category.""", + 'description': """This module is used to limit the discount on pos + product category and also restrict the global discount for selected cashiers.""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['web', 'pos_hr', 'pos_discount'], + 'data': [ + 'views/res_config_settings_views.xml', + 'views/product_template_views.xml', + 'views/pos_category_views.xml', + 'views/hr_employee_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'discount_limit/static/src/js/Orderline.js', + 'discount_limit/static/src/js/PosGlobalState.js', + 'discount_limit/static/src/js/DiscountButton.js', + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/discount_limit/doc/RELEASE_NOTES.md b/discount_limit/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..d3a396f84 --- /dev/null +++ b/discount_limit/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 28.01.2024 +#### Version 16.0.1.0.0 +##### ADD +- Initial Commit for POS Discount Limit & Restrict Global Discount diff --git a/discount_limit/models/__init__.py b/discount_limit/models/__init__.py new file mode 100644 index 000000000..6adf53a08 --- /dev/null +++ b/discount_limit/models/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 hr_employee +from . import pos_category +from . import pos_config +from . import product_template +from . import res_config_settings +from . import pos_session diff --git a/discount_limit/models/hr_employee.py b/discount_limit/models/hr_employee.py new file mode 100644 index 000000000..c2f193819 --- /dev/null +++ b/discount_limit/models/hr_employee.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 HrEmployee(models.Model): + """ + Inheriting the 'hr.employee' model to include a boolean field + indicating whether an employee has discount control permissions. + """ + _inherit = 'hr.employee' + + has_pos_discount_control = fields.Boolean(string="Discount Control", + help="Enable to control the" + " discount") diff --git a/discount_limit/models/pos_category.py b/discount_limit/models/pos_category.py new file mode 100644 index 000000000..d6070da6e --- /dev/null +++ b/discount_limit/models/pos_category.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 PosCategory(models.Model): + """ + Inheriting pos_category to include discount limit settings. + """ + _inherit = 'pos.category' + + discount_limit = fields.Char(string="Discount Limit(%)", + help="Discount Limit") + apply_limit = fields.Boolean(string="Apply Limit", help="Apply Limit") diff --git a/discount_limit/models/pos_config.py b/discount_limit/models/pos_config.py new file mode 100644 index 000000000..32b886106 --- /dev/null +++ b/discount_limit/models/pos_config.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 PosConfig(models.Model): + """ + Inheriting pos_config model to set discount limit for product/product + categories. + """ + _inherit = 'pos.config' + + apply_discount_limit = fields.Selection([ + ('product', 'Product'), + ('product_category', 'Product Category')], + string="Apply Discount Limit", + help="Select product or product category option to apply discount") diff --git a/discount_limit/models/pos_session.py b/discount_limit/models/pos_session.py new file mode 100644 index 000000000..b620be7b3 --- /dev/null +++ b/discount_limit/models/pos_session.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 models + + +class PosSession(models.Model): + """ + Inheriting pos_session module to load fields in pos session + """ + _inherit = 'pos.session' + + def _loader_params_product_product(self): + """Function to load product_discount_limit in pos session""" + result = super()._loader_params_product_product() + result['search_params']['fields'].extend( + ['product_discount_limit']) + return result + + def _loader_params_pos_category(self): + """Function to load discount_limit in pos session""" + result = super()._loader_params_pos_category() + result['search_params']['fields'].extend( + ['discount_limit']) + return result + + def _loader_params_hr_employee(self): + """Function to load has_pos_discount_control in pos""" + result = super()._loader_params_hr_employee() + result['search_params']['fields'].extend( + ['has_pos_discount_control']) + return result diff --git a/discount_limit/models/product_template.py b/discount_limit/models/product_template.py new file mode 100644 index 000000000..4ca0b3270 --- /dev/null +++ b/discount_limit/models/product_template.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 models, fields + + +class ProductTemplate(models.Model): + """Inheriting product_template model""" + _inherit = 'product.template' + + pd_apply_limit = fields.Boolean(string="Apply limit", help="Whether to apply") + product_discount_limit = fields.Float(string="Discount Limit(%)", + help="Product discount limit") diff --git a/discount_limit/models/res_config_settings.py b/discount_limit/models/res_config_settings.py new file mode 100644 index 000000000..710a2c966 --- /dev/null +++ b/discount_limit/models/res_config_settings.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P (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 api, fields, models + + +class ResConfigSettings(models.TransientModel): + """ + Inheriting res_config_settings model to set discount limit for + product/product categories + """ + _inherit = 'res.config.settings' + + limit_discount = fields.Boolean(string="Discount Limit", + help="Enable to apply limit on discount " + "limit", + config_parameter='discount_limit.' + 'limit_discount') + apply_discount_limit = fields.Selection([ + ('product', 'Product'), + ('product_category', 'Product Category')], + string="Apply Discount Limit", + related="pos_config_id.apply_discount_limit", + readonly=False, help="Select product or product category option" + " to apply discount") + + @api.onchange('apply_discount_limit') + def _onchange_apply_discount_limit(self): + """ + setting the discount_limit for product or product categories field + based on the apply_discount_limit option. + """ + products = self.env['product.product'].search( + [('available_in_pos', '=', True)]) + categories = self.env['pos.category'].search([]) + if self.apply_discount_limit == 'product': + for product in products: + product.pd_apply_limit = True + for category in categories: + category.apply_limit = False + else: + for category in categories: + category.apply_limit = True + for product in products: + product.pd_apply_limit = False diff --git a/discount_limit/static/description/assets/icons/check.png b/discount_limit/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/discount_limit/static/description/assets/icons/check.png differ diff --git a/discount_limit/static/description/assets/icons/chevron.png b/discount_limit/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/discount_limit/static/description/assets/icons/chevron.png differ diff --git a/discount_limit/static/description/assets/icons/cogs.png b/discount_limit/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/discount_limit/static/description/assets/icons/cogs.png differ diff --git a/discount_limit/static/description/assets/icons/consultation.png b/discount_limit/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/discount_limit/static/description/assets/icons/consultation.png differ diff --git a/discount_limit/static/description/assets/icons/ecom-black.png b/discount_limit/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/discount_limit/static/description/assets/icons/ecom-black.png differ diff --git a/discount_limit/static/description/assets/icons/education-black.png b/discount_limit/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/discount_limit/static/description/assets/icons/education-black.png differ diff --git a/discount_limit/static/description/assets/icons/hotel-black.png b/discount_limit/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/discount_limit/static/description/assets/icons/hotel-black.png differ diff --git a/discount_limit/static/description/assets/icons/license.png b/discount_limit/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/discount_limit/static/description/assets/icons/license.png differ diff --git a/discount_limit/static/description/assets/icons/lifebuoy.png b/discount_limit/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/discount_limit/static/description/assets/icons/lifebuoy.png differ diff --git a/discount_limit/static/description/assets/icons/manufacturing-black.png b/discount_limit/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/discount_limit/static/description/assets/icons/manufacturing-black.png differ diff --git a/discount_limit/static/description/assets/icons/pos-black.png b/discount_limit/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/discount_limit/static/description/assets/icons/pos-black.png differ diff --git a/discount_limit/static/description/assets/icons/puzzle.png b/discount_limit/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/discount_limit/static/description/assets/icons/puzzle.png differ diff --git a/discount_limit/static/description/assets/icons/restaurant-black.png b/discount_limit/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/discount_limit/static/description/assets/icons/restaurant-black.png differ diff --git a/discount_limit/static/description/assets/icons/service-black.png b/discount_limit/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/discount_limit/static/description/assets/icons/service-black.png differ diff --git a/discount_limit/static/description/assets/icons/trading-black.png b/discount_limit/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/discount_limit/static/description/assets/icons/trading-black.png differ diff --git a/discount_limit/static/description/assets/icons/training.png b/discount_limit/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/discount_limit/static/description/assets/icons/training.png differ diff --git a/discount_limit/static/description/assets/icons/update.png b/discount_limit/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/discount_limit/static/description/assets/icons/update.png differ diff --git a/discount_limit/static/description/assets/icons/user.png b/discount_limit/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/discount_limit/static/description/assets/icons/user.png differ diff --git a/discount_limit/static/description/assets/icons/wrench.png b/discount_limit/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/discount_limit/static/description/assets/icons/wrench.png differ diff --git a/discount_limit/static/description/assets/misc/categories.png b/discount_limit/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/discount_limit/static/description/assets/misc/categories.png differ diff --git a/discount_limit/static/description/assets/misc/check-box.png b/discount_limit/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/discount_limit/static/description/assets/misc/check-box.png differ diff --git a/discount_limit/static/description/assets/misc/compass.png b/discount_limit/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/discount_limit/static/description/assets/misc/compass.png differ diff --git a/discount_limit/static/description/assets/misc/corporate.png b/discount_limit/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/discount_limit/static/description/assets/misc/corporate.png differ diff --git a/discount_limit/static/description/assets/misc/customer-support.png b/discount_limit/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/discount_limit/static/description/assets/misc/customer-support.png differ diff --git a/discount_limit/static/description/assets/misc/cybrosys-logo.png b/discount_limit/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/discount_limit/static/description/assets/misc/cybrosys-logo.png differ diff --git a/discount_limit/static/description/assets/misc/features.png b/discount_limit/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/discount_limit/static/description/assets/misc/features.png differ diff --git a/discount_limit/static/description/assets/misc/logo.png b/discount_limit/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/discount_limit/static/description/assets/misc/logo.png differ diff --git a/discount_limit/static/description/assets/misc/pictures.png b/discount_limit/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/discount_limit/static/description/assets/misc/pictures.png differ diff --git a/discount_limit/static/description/assets/misc/pie-chart.png b/discount_limit/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/discount_limit/static/description/assets/misc/pie-chart.png differ diff --git a/discount_limit/static/description/assets/misc/right-arrow.png b/discount_limit/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/discount_limit/static/description/assets/misc/right-arrow.png differ diff --git a/discount_limit/static/description/assets/misc/star.png b/discount_limit/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/discount_limit/static/description/assets/misc/star.png differ diff --git a/discount_limit/static/description/assets/misc/support.png b/discount_limit/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/discount_limit/static/description/assets/misc/support.png differ diff --git a/discount_limit/static/description/assets/misc/whatsapp.png b/discount_limit/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/discount_limit/static/description/assets/misc/whatsapp.png differ diff --git a/discount_limit/static/description/assets/modules/l1.png b/discount_limit/static/description/assets/modules/l1.png new file mode 100644 index 000000000..e92318a72 Binary files /dev/null and b/discount_limit/static/description/assets/modules/l1.png differ diff --git a/discount_limit/static/description/assets/modules/l2.png b/discount_limit/static/description/assets/modules/l2.png new file mode 100644 index 000000000..9ac0edfdc Binary files /dev/null and b/discount_limit/static/description/assets/modules/l2.png differ diff --git a/discount_limit/static/description/assets/modules/l3.png b/discount_limit/static/description/assets/modules/l3.png new file mode 100644 index 000000000..d627b3329 Binary files /dev/null and b/discount_limit/static/description/assets/modules/l3.png differ diff --git a/discount_limit/static/description/assets/modules/l4.png b/discount_limit/static/description/assets/modules/l4.png new file mode 100644 index 000000000..339d16e3b Binary files /dev/null and b/discount_limit/static/description/assets/modules/l4.png differ diff --git a/discount_limit/static/description/assets/modules/l5.png b/discount_limit/static/description/assets/modules/l5.png new file mode 100644 index 000000000..202521d33 Binary files /dev/null and b/discount_limit/static/description/assets/modules/l5.png differ diff --git a/discount_limit/static/description/assets/modules/l6.png b/discount_limit/static/description/assets/modules/l6.png new file mode 100644 index 000000000..ed1a668fc Binary files /dev/null and b/discount_limit/static/description/assets/modules/l6.png differ diff --git a/discount_limit/static/description/assets/screenshots/1.png b/discount_limit/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..a4c1b0dd6 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/1.png differ diff --git a/discount_limit/static/description/assets/screenshots/2.png b/discount_limit/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..5598bac11 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/2.png differ diff --git a/discount_limit/static/description/assets/screenshots/3.png b/discount_limit/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..a284654a6 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/3.png differ diff --git a/discount_limit/static/description/assets/screenshots/4.png b/discount_limit/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..ee489d06e Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/4.png differ diff --git a/discount_limit/static/description/assets/screenshots/5.png b/discount_limit/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..2e4b7bfba Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/5.png differ diff --git a/discount_limit/static/description/assets/screenshots/6.png b/discount_limit/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..2ccf012a0 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/6.png differ diff --git a/discount_limit/static/description/assets/screenshots/7.png b/discount_limit/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..d72b4dac5 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/7.png differ diff --git a/discount_limit/static/description/assets/screenshots/8.png b/discount_limit/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..9a4f4e3a9 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/8.png differ diff --git a/discount_limit/static/description/assets/screenshots/9.png b/discount_limit/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..9f8d5070a Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/9.png differ diff --git a/discount_limit/static/description/assets/screenshots/hero.gif b/discount_limit/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..9704ad16e Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/hero.gif differ diff --git a/discount_limit/static/description/banner.png b/discount_limit/static/description/banner.png new file mode 100644 index 000000000..94c9287b6 Binary files /dev/null and b/discount_limit/static/description/banner.png differ diff --git a/discount_limit/static/description/icon.png b/discount_limit/static/description/icon.png new file mode 100644 index 000000000..83e831d3c Binary files /dev/null and b/discount_limit/static/description/icon.png differ diff --git a/discount_limit/static/description/index.html b/discount_limit/static/description/index.html new file mode 100644 index 000000000..9432f8814 --- /dev/null +++ b/discount_limit/static/description/index.html @@ -0,0 +1,676 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ POS Discount Limit & Restrict Global Discount +

+

+ Limit the discount for POS product, product categories + and restrict the global discount for POS cashiers.

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

+ Explore This + Module

+
+ + + +
+
+ +
+

+ Overview +

+
+
+
+ This app provides an option to set the discount limit for the pos + product categories and also restrict the global discount to the cashiers + who do not have discount control. +
+
+ + +
+
+ +
+

+ Features +

+
+
+
+
+ + Limit the discount for products. +
+
+
+
+
+
+ + Limit the discount for product categories. +
+
+
+
+
+
+ + Restrict global discount for selected POS cashiers +
+
+
+ + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

+ Discount Limit for Product +

+

+ Discount Limit Field in POS Product. +

+ + +
+
+
+
+

+ Discount Limit for Product category +

+

+ Discount Limit field in POS Product category . +

+ + +
+
+
+
+

+ Restrict Discount +

+

+ Can't give the discount greater than the specified limit. +

+ +
+
+
+
+

+ Discount Control +

+

+ Discount Control check box in HR settings. +

+ +
+
+
+
+

+ Enable Authorize employees +

+

+ Add employees who have restrictions on discounts. +

+ +
+
+
+
+

+ Global Discount +

+

+ Enable Global Discount in POS settings. +

+ +
+
+
+
+

+ Cashier Discount Control +

+

+ Cannot Apply Global Discount if Cashier has no Discount Control. +

+ +
+
+
+ + +
+
+

Related Modules

+

Explore our related modules

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

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

+
+
+
+
+ + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch. +

+ +

+ odoo@cybrosys.com +

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707 +

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/discount_limit/static/src/js/DiscountButton.js b/discount_limit/static/src/js/DiscountButton.js new file mode 100644 index 000000000..be47a3b08 --- /dev/null +++ b/discount_limit/static/src/js/DiscountButton.js @@ -0,0 +1,35 @@ +/** @odoo-module **/ +var models = require('point_of_sale.models'); +var core = require('web.core'); +var _t = core._t; +const { Gui } = require('point_of_sale.Gui'); +const Registries = require('point_of_sale.Registries'); +const DiscountButton = require('pos_discount.DiscountButton'); + +//Extending discount button to restrict discount option for selected employees +const DiscountLimit = (DiscountButton) => +class extends DiscountButton { + async onClick() { + var self=this; + if (this.env.pos.get_cashier().has_pos_discount_control===true){ + Gui.showPopup('ConfirmPopup', { + 'title': ('Discount Restricted'), + 'body': ('You must be granted access to apply discount.'), + }); + } + else + { + var self = this; + const { confirmed, payload } = await this.showPopup('NumberPopup',{ + title: this.env._t('Discount Percentage'), + startingValue: this.env.pos.config.discount_pc, + }); + if (confirmed) { + const val = Math.round(Math.max(0,Math.min(100,parseFloat(payload)))); + await self.apply_discount(val); + } + } + } +} +Registries.Component.extend(DiscountButton, DiscountLimit); +return DiscountButton; diff --git a/discount_limit/static/src/js/Orderline.js b/discount_limit/static/src/js/Orderline.js new file mode 100644 index 000000000..02874c2dc --- /dev/null +++ b/discount_limit/static/src/js/Orderline.js @@ -0,0 +1,69 @@ +/** @odoo-module **/ + +import { Orderline } from 'point_of_sale.models'; +import Registries from 'point_of_sale.Registries'; +import { patch } from '@web/core/utils/patch'; +const { Gui } = require('point_of_sale.Gui'); +var field_utils = require('web.field_utils'); +var core = require('web.core'); +const _t = core._t; +//Patching Orderline for set discount limit on product and product categories +patch(Orderline.prototype, 'discount_limit.patch', { + setup(){ + super.setup(); + }, + set_discount(discount){ + var order = this.pos.get_order(); + var pos_prod_id = order.selected_orderline.product.pos_categ_id[0] + if(this.pos.config.apply_discount_limit == false){ + var parsed_discount = typeof(discount) === 'number' ? discount : isNaN(parseFloat(discount)) ? 0 : field_utils.parse.float('' + discount); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + }else if(this.pos.config.apply_discount_limit == 'product_category'){ + var rounded = Math.round(discount); + if(Number.isInteger(pos_prod_id)){ + if(this.pos.db.category_by_id[pos_prod_id].discount_limit){ + if(rounded > this.pos.db.category_by_id[pos_prod_id].discount_limit){ + Gui.showPopup("ConfirmPopup", { + 'title': _t("Discount Not Possible"), + 'body': _t("You cannot apply discount above the discount limit."), + }); + } else { + var parsed_discount = typeof(discount) === 'number' ? discount : isNaN(parseFloat(discount)) ? 0 : field_utils.parse.float('' + discount); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + } + } else { + var parsed_discount = typeof(discount) === 'number' ? discount : isNaN(parseFloat(discount)) ? 0 : field_utils.parse.float('' + discount); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + } + } + }else if(this.pos.config.apply_discount_limit == 'product'){ + var rounded = Math.round(discount); + if(Number.isInteger(pos_prod_id)){ + if(this.get_product().product_discount_limit){ + if(rounded > this.get_product().product_discount_limit){ + Gui.showPopup("ConfirmPopup", { + 'title': _t("Discount Not Possible"), + 'body': _t("You cannot apply discount above the discount limit."), + }); + } else { + var parsed_discount = typeof(discount) === 'number' ? discount : isNaN(parseFloat(discount)) ? 0 : field_utils.parse.float('' + discount); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + } + } else { + var parsed_discount = typeof(discount) === 'number' ? discount : isNaN(parseFloat(discount)) ? 0 : field_utils.parse.float('' + discount); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + } + } + } + } +}); diff --git a/discount_limit/static/src/js/PosGlobalState.js b/discount_limit/static/src/js/PosGlobalState.js new file mode 100644 index 000000000..d0e3ee97e --- /dev/null +++ b/discount_limit/static/src/js/PosGlobalState.js @@ -0,0 +1,15 @@ +odoo.define('discount_limit.pos', function(require) { + "use strict"; + var { PosGlobalState } = require('point_of_sale.models'); + const Registries = require('point_of_sale.Registries'); +//loading model + const ProductPosGlobalState = (PosGlobalState) => class ProductPosGlobalState extends PosGlobalState { + async _processData(loadedData) { + await super._processData(...arguments); + this.product_template = loadedData['product.product']; + this.pos_category = loadedData['pos.category']; + this.hr_employee = loadedData['hr.employee']; + } + } + Registries.Model.extend(PosGlobalState, ProductPosGlobalState); +}); diff --git a/discount_limit/views/hr_employee_views.xml b/discount_limit/views/hr_employee_views.xml new file mode 100644 index 000000000..24031c17f --- /dev/null +++ b/discount_limit/views/hr_employee_views.xml @@ -0,0 +1,16 @@ + + + + + hr.employee.view.form.inherit.discount.limit + hr.employee + + + + + + + + + + diff --git a/discount_limit/views/pos_category_views.xml b/discount_limit/views/pos_category_views.xml new file mode 100644 index 000000000..733ca8c7d --- /dev/null +++ b/discount_limit/views/pos_category_views.xml @@ -0,0 +1,15 @@ + + + + + pos.category.view.form.inherit.discount.limit + pos.category + + + + + + + + + diff --git a/discount_limit/views/product_template_views.xml b/discount_limit/views/product_template_views.xml new file mode 100644 index 000000000..5b6c5c4a0 --- /dev/null +++ b/discount_limit/views/product_template_views.xml @@ -0,0 +1,15 @@ + + + + + product.template.view.form.inherit.discount.limit + product.template + + + + + + + + + diff --git a/discount_limit/views/res_config_settings_views.xml b/discount_limit/views/res_config_settings_views.xml new file mode 100644 index 000000000..0e4c22e1a --- /dev/null +++ b/discount_limit/views/res_config_settings_views.xml @@ -0,0 +1,30 @@ + + + + + res.config.settings.view.form.inherit.discount.limit + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+