diff --git a/discount_limit/README.rst b/discount_limit/README.rst new file mode 100644 index 000000000..cdb0a73d9 --- /dev/null +++ b/discount_limit/README.rst @@ -0,0 +1,50 @@ +.. 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 & Restrict Global Discount +============================================= +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 + (V17) Farhana Jahan PT, 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..d46a02c17 --- /dev/null +++ b/discount_limit/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 models diff --git a/discount_limit/__manifest__.py b/discount_limit/__manifest__.py new file mode 100644 index 000000000..5ef988a76 --- /dev/null +++ b/discount_limit/__manifest__.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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': "POS Discount Limit & Restrict Global Discount", + 'version': '17.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': ['point_of_sale', 'hr','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': { + 'point_of_sale._assets_pos': [ + 'discount_limit/static/src/js/Orderline.js', + 'discount_limit/static/src/js/DiscountButton.js', + ], + }, + 'images': ['static/description/banner.jpg'], + '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..e560ac6b6 --- /dev/null +++ b/discount_limit/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module +#### 27.12.2023 +#### Version 17.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..5e78abc7c --- /dev/null +++ b/discount_limit/models/__init__.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 hr_employee +from . import pos_category +from . import pos_config +from . import pos_session +from . import product_product +from . import res_config_settings diff --git a/discount_limit/models/hr_employee.py b/discount_limit/models/hr_employee.py new file mode 100644 index 000000000..2f5261175 --- /dev/null +++ b/discount_limit/models/hr_employee.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 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..d71af16ba --- /dev/null +++ b/discount_limit/models/pos_category.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 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..7c7de061d --- /dev/null +++ b/discount_limit/models/pos_config.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 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..cdd9fc147 --- /dev/null +++ b/discount_limit/models/pos_session.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 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_product.py b/discount_limit/models/product_product.py new file mode 100644 index 000000000..265244aec --- /dev/null +++ b/discount_limit/models/product_product.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 models, fields + + +class ProductProduct(models.Model): + """Inheriting product_product model for adding Fields to + describe Discount Limit for POS""" + _inherit = 'product.product' + + 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..8cc1fd2e9 --- /dev/null +++ b/discount_limit/models/res_config_settings.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-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 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/capture (1).png b/discount_limit/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/discount_limit/static/description/assets/icons/capture (1).png differ 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/img.png b/discount_limit/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/discount_limit/static/description/assets/icons/img.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/photo-capture.png b/discount_limit/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/discount_limit/static/description/assets/icons/photo-capture.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/Cybrosys R.png b/discount_limit/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/discount_limit/static/description/assets/misc/Cybrosys R.png differ diff --git a/discount_limit/static/description/assets/misc/email.svg b/discount_limit/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/discount_limit/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/discount_limit/static/description/assets/misc/phone.svg b/discount_limit/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/discount_limit/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/discount_limit/static/description/assets/misc/star (1) 2.svg b/discount_limit/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/discount_limit/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/discount_limit/static/description/assets/misc/support (1) 1.svg b/discount_limit/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/discount_limit/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/discount_limit/static/description/assets/misc/support-email.svg b/discount_limit/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/discount_limit/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/discount_limit/static/description/assets/misc/tick-mark.svg b/discount_limit/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/discount_limit/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/discount_limit/static/description/assets/misc/whatsapp 1.svg b/discount_limit/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/discount_limit/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/discount_limit/static/description/assets/misc/whatsapp.svg b/discount_limit/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/discount_limit/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..6e54d74cc 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..7924f29fa 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..5bb126ca0 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.0.png b/discount_limit/static/description/assets/screenshots/4.0.png new file mode 100644 index 000000000..4b060e3aa Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/4.0.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..7e36f4973 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..d5eb2a57e 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..956eb792f 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..f03c829b2 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..f63ef81f1 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..63da3fff2 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..156d766b8 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/hero.gif differ diff --git a/discount_limit/static/description/banner.jpg b/discount_limit/static/description/banner.jpg new file mode 100644 index 000000000..017fc4c66 Binary files /dev/null and b/discount_limit/static/description/banner.jpg differ diff --git a/discount_limit/static/description/icon.png b/discount_limit/static/description/icon.png new file mode 100644 index 000000000..ccbc14d62 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..c5e4b837b --- /dev/null +++ b/discount_limit/static/description/index.html @@ -0,0 +1,835 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ POS Discount Limit & Restrict Global Discount

+

+ Limit the Discount on POS Product Category. +

+
+ +
+
+
+
+
+

+ Key Highlights +

+
+
+
+
+
+ +
+
+

+ Limit the discount for Products.

+

When apply + discount limit for Product Can't give the + discount greater than the specified limit. +

+
+
+
+
+
+
+ +
+
+

+ Limit the discount for product categories.

+

When apply + discount limit for product categories Can't give + the discount greater than the specified limit. +

+
+
+
+
+
+
+ +
+
+

+ Restrict global discount for selected POS + cashiers.

+

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

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

+ Choose Product on Limit the Discount Field + in POS Configuration Settings. +

+
+
+
+
+
+
+ +
+
+

+ Discount Limit Field in POS Product. +

+
+
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+ +
+
+

+ Choose Product category on Limit the + Discount Field in POS Configuration + Settings. +

+
+
+
+
+
+
+ +
+
+

+ Discount Limit Field in POS Product + category. +

+
+
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+ +
+
+

+ Discount Control check box in HR settings. +

+
+
+
+
+
+
+ +
+
+

+ Add employees who have restrictions on + discounts. +

+
+
+
+
+
+
+ +
+
+

+ Enable Global Discount in POS settings. +

+
+
+
+
+
+
+ +
+
+

+ Get Popup error while applying Global Discount +

+
+
+
+
+
+
+
    +
  • + Limit the discount for Products. +
  • +
  • + Limit the discount for product categories. +
  • +
  • + Restrict global discount for selected POS cashiers. +
      +
    • +
    • +
    +
  • + +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:27th Dev 2023 +
+

+ + Initial Commit for POS Discount Limit & Restrict + Global Discount.

+
+
+
+
+
+
+
+

+ Related Products

+
+
+ +
+
+

+ Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire + Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo + Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo + Implementation

+
+
+
+
+
+
+ service-icon +
+
+

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 + 99456767686 +
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/discount_limit/static/src/js/DiscountButton.js b/discount_limit/static/src/js/DiscountButton.js new file mode 100644 index 000000000..74d1d7440 --- /dev/null +++ b/discount_limit/static/src/js/DiscountButton.js @@ -0,0 +1,31 @@ +/** @odoo-module */ +import { _t } from "@web/core/l10n/translation"; +import { DiscountButton } from "@pos_discount/overrides/components/discount_button/discount_button"; +import { patch } from "@web/core/utils/patch"; +import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup"; +import { NumberPopup } from "@point_of_sale/app/utils/input_popups/number_popup"; +patch(DiscountButton.prototype, { + async click() { + /**Add Popup error when Cashier is not allowed for apply Discount Limit**/ + var self=this; + if (this.pos.get_cashier().has_pos_discount_control===true){ + this.popup.add(ErrorPopup, { + title: _t("Discount Restricted"), + body: _t("You must be granted access to apply discount."), + }); + return false; + } + else + { + var self = this; + const { confirmed, payload } = await this.popup.add(NumberPopup,{ + title: _t('Discount Percentage'), + startingValue: this.pos.config.discount_pc, + }); + if (confirmed) { + const val = Math.round(Math.max(0,Math.min(100,parseFloat(payload)))); + await self.apply_discount(val); + } + } + }, +}); diff --git a/discount_limit/static/src/js/Orderline.js b/discount_limit/static/src/js/Orderline.js new file mode 100644 index 000000000..77252c9f5 --- /dev/null +++ b/discount_limit/static/src/js/Orderline.js @@ -0,0 +1,95 @@ +/** @odoo-module */ +import { Orderline } from "@point_of_sale/app/store/models"; +import { patch } from "@web/core/utils/patch"; +import { parseFloat as oParseFloat } from "@web/views/fields/parsers"; +import { _t } from "@web/core/l10n/translation"; +import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup"; + +patch(Orderline.prototype, { + setup() { + super.setup(...arguments); + }, + set_discount(discount) { + /**Add Popup error when Discount Limit is applied for POS Orderline**/ + var order = this.pos.get_order(); + if (order) { + var pos_prod_id = order.selected_orderline.product.pos_categ_ids[0] + if (this.pos.config.apply_discount_limit == false) { + var parsed_discount = + typeof discount === "number" ? + discount : + isNaN(parseFloat(discount)) ? + 0 : + oParseFloat("" + 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) { + this.pos.popup.add(ErrorPopup, { + '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 : + oParseFloat("" + 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 : + oParseFloat("" + 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) { + this.pos.popup.add(ErrorPopup, { + '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 : + oParseFloat("" + 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 : + oParseFloat("" + discount); + var disc = Math.min(Math.max(parsed_discount || 0, 0), 100); + this.discount = disc; + this.discountStr = "" + disc; + } + } + } + } + + }, +}); \ No newline at end of file diff --git a/discount_limit/views/hr_employee_views.xml b/discount_limit/views/hr_employee_views.xml new file mode 100644 index 000000000..27d014844 --- /dev/null +++ b/discount_limit/views/hr_employee_views.xml @@ -0,0 +1,18 @@ + + + + + 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..e61560691 --- /dev/null +++ b/discount_limit/views/pos_category_views.xml @@ -0,0 +1,16 @@ + + + + + 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..3039ec0fa --- /dev/null +++ b/discount_limit/views/product_template_views.xml @@ -0,0 +1,17 @@ + + + + + product.product.view.form.inherit.discount.limit + + product.product + + + + + + + + + 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..4d41f7182 --- /dev/null +++ b/discount_limit/views/res_config_settings_views.xml @@ -0,0 +1,32 @@ + + + + + + res.config.settings.view.form.inherit.discount.limit + + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+
\ No newline at end of file