diff --git a/discount_limit/README.rst b/discount_limit/README.rst new file mode 100755 index 000000000..f2e9fda11 --- /dev/null +++ b/discount_limit/README.rst @@ -0,0 +1,43 @@ +================================================= +POS Discount Limit & Restrict Global Discount V14 +================================================= +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 `__ + +Credits +------- +* Developers: Mehjabin @ cybrosys, odoo@cybrosys.com + V14 Mily @ cybrosys + V15 Mily @ cybrosys + +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..6cc9d41e5 --- /dev/null +++ b/discount_limit/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +from . import models \ No newline at end of file diff --git a/discount_limit/__manifest__.py b/discount_limit/__manifest__.py new file mode 100644 index 000000000..0cdd35c64 --- /dev/null +++ b/discount_limit/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +{ + 'name': "POS Discount Limit", + 'summary': """ + This module is used to limit the discount on pos product category and + also restrict the global discount for selected cashiers.""", + 'description': """ + This module is used to limit the discount on pos product category and + also restrict the global discount for selected cashiers.""", + 'version': '14.0.1.0.0', + 'author': "Cybrosys Techno Solutions", + 'website': "https://www.cybrosys.com", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'category': 'Point of Sale', + 'depends': ['point_of_sale','hr'], + 'data': [ + 'views/views.xml', + 'views/restrict_discount_view.xml', + 'views/assets.xml', + ], + + 'images':[ + 'static/description/banner.png', + ], + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, + +} \ No newline at end of file diff --git a/discount_limit/doc/RELEASE_NOTES.md b/discount_limit/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..8e6720171 --- /dev/null +++ b/discount_limit/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 18.09.2021 +#### Version 14.0.1.0.0 +##### ADD +- Initial commit + diff --git a/discount_limit/models/__init__.py b/discount_limit/models/__init__.py new file mode 100644 index 000000000..6cc9d41e5 --- /dev/null +++ b/discount_limit/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2020-TODAY Cybrosys Technologies(). +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +from . import models \ No newline at end of file diff --git a/discount_limit/models/models.py b/discount_limit/models/models.py new file mode 100644 index 000000000..51c97faaa --- /dev/null +++ b/discount_limit/models/models.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +################################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2021-TODAY Cybrosys Technologies(). +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################### + +from odoo import models, fields, api + + +class DiscountLimitCategory(models.Model): + _inherit = 'pos.category' + + discount_limit = fields.Char(string="Discount Limit(%)") + apply_limit = fields.Boolean() + + +class RestrictDiscount(models.Model): + _inherit = 'hr.employee' + + has_pos_discount_control = fields.Boolean("Discount Control") + + +class ProductDiscountLimit(models.Model): + _inherit = 'product.product' + _inherit = 'product.template' + + pd_apply_limit = fields.Boolean() + product_discount_limit = fields.Char(string="Discount Limit(%)") + + +class DiscountLimit(models.Model): + _inherit = 'pos.config' + + apply_discount_limit = fields.Selection([ + ('product', 'Product'), + ('product_category', 'Product Category')], string="Apply Discount Limit") + + @api.onchange('apply_discount_limit') + def onchange_apply_discount_limit(self): + 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/security/ir.model.access.csv b/discount_limit/security/ir.model.access.csv new file mode 100644 index 000000000..24e89ab04 --- /dev/null +++ b/discount_limit/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_discount_limit_discount_limit,discount_limit.discount_limit,model_discount_limit_discount_limit,,1,0,0,0 \ No newline at end of file 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/logo.png b/discount_limit/static/description/assets/icons/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/discount_limit/static/description/assets/icons/logo.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/modules/approval_image.png b/discount_limit/static/description/assets/modules/approval_image.png new file mode 100644 index 000000000..84fe94e80 Binary files /dev/null and b/discount_limit/static/description/assets/modules/approval_image.png differ diff --git a/discount_limit/static/description/assets/modules/budget_image.png b/discount_limit/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..fe6aa6fe4 Binary files /dev/null and b/discount_limit/static/description/assets/modules/budget_image.png differ diff --git a/discount_limit/static/description/assets/modules/export_image.png b/discount_limit/static/description/assets/modules/export_image.png new file mode 100644 index 000000000..4e4ea0e51 Binary files /dev/null and b/discount_limit/static/description/assets/modules/export_image.png differ diff --git a/discount_limit/static/description/assets/modules/magento_image.png b/discount_limit/static/description/assets/modules/magento_image.png new file mode 100644 index 000000000..39de0820f Binary files /dev/null and b/discount_limit/static/description/assets/modules/magento_image.png differ diff --git a/discount_limit/static/description/assets/modules/pos_image.png b/discount_limit/static/description/assets/modules/pos_image.png new file mode 100644 index 000000000..c5932894b Binary files /dev/null and b/discount_limit/static/description/assets/modules/pos_image.png differ diff --git a/discount_limit/static/description/assets/modules/shopify_image.png b/discount_limit/static/description/assets/modules/shopify_image.png new file mode 100644 index 000000000..c6d92c16d Binary files /dev/null and b/discount_limit/static/description/assets/modules/shopify_image.png differ diff --git a/discount_limit/static/description/assets/screenshots/disc0.png b/discount_limit/static/description/assets/screenshots/disc0.png new file mode 100644 index 000000000..3ddc48365 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/disc0.png differ diff --git a/discount_limit/static/description/assets/screenshots/disc1.png b/discount_limit/static/description/assets/screenshots/disc1.png new file mode 100644 index 000000000..d06ac1f46 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/disc1.png differ diff --git a/discount_limit/static/description/assets/screenshots/disc2.png b/discount_limit/static/description/assets/screenshots/disc2.png new file mode 100644 index 000000000..46f2bf79b Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/disc2.png differ diff --git a/discount_limit/static/description/assets/screenshots/disc3.png b/discount_limit/static/description/assets/screenshots/disc3.png new file mode 100644 index 000000000..4a588a98b Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/disc3.png differ diff --git a/discount_limit/static/description/assets/screenshots/disc4.png b/discount_limit/static/description/assets/screenshots/disc4.png new file mode 100644 index 000000000..5bf34a7e0 Binary files /dev/null and b/discount_limit/static/description/assets/screenshots/disc4.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..97443e145 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..2aa92f3a9 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..e9a1f3ce6 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..54de392cc --- /dev/null +++ b/discount_limit/static/description/index.html @@ -0,0 +1,679 @@ + +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+ +
+
+
+
+ +
+
+
+

+ POS Discount Limit & Restrict Global Discount

+

+ An option to limit the discount for POS product categories and restrict the global discount for POS cashiers. +

+ +
+
+ + + + +
+
+

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

+
+ +
+
+ +
+
+

+ Community & Enterprise Support

+

+ Available in Odoo 14.0 Community and Enterprise.

+
+
+
+
+ +
+
+

+ Discount Limit

+

+ Discount limit field in POS product category.

+
+
+ +
+
+ +
+
+

+ Restrict the discount

+

+ Cannot give discount more than the specified limit in the pos product category.

+
+
+ +
+
+ +
+
+

+ Discount Control

+

+ Discount control Checkbox in HR settings.

+
+
+ +
+
+ +
+
+

+ Retail Management in Pos

+

+ Learn more on ultimate retail management with Odoo POS .

+
+
+ +
+ +
+
+

+ Screenshots +

+
+
+

+ Apply Discount Limit

+

+ Apply Discount Limit in Pos Config

+ +
+ +
+

+ Discount Limit

+

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

+ +
+ + +
+

+ Cashier Discount Control

+

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

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

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/discount_limit/static/src/js/dis.js b/discount_limit/static/src/js/dis.js new file mode 100644 index 000000000..3412770e3 --- /dev/null +++ b/discount_limit/static/src/js/dis.js @@ -0,0 +1,78 @@ +odoo.define('discount_limit.DiscountLimit', function (require) { + "use strict"; + + var models = require('point_of_sale.models'); + var field_utils = require('web.field_utils'); + var core = require('web.core'); + const _t = core._t; + const { Gui } = require('point_of_sale.Gui'); + models.load_fields('pos.category', 'discount_limit'); + models.load_fields('product.product', 'product_discount_limit'); + var _super_orderline = models.Orderline.prototype; + models.Orderline = models.Orderline.extend({ + set_discount: function(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 = 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; + this.trigger('change',this); + } 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("ErrorPopup", { + 'title': _t("Discount Not Possible"), + 'body': _t("You cannot apply discount above the discount limit."), + }); + } else { + var parsed_discount = isNaN(parseFloat(rounded)) ? 0 : field_utils.parse.float('' + rounded); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + this.trigger('change',this); + } + } else { + var parsed_discount = isNaN(parseFloat(rounded)) ? 0 : field_utils.parse.float('' + rounded); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + this.trigger('change',this); + } + } + }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("ErrorPopup", { + 'title': _t("Discount Not Possible"), + 'body': _t("You cannot apply discount above the discount limit."), + }); + } else { + var parsed_discount = isNaN(parseFloat(rounded)) ? 0 : field_utils.parse.float('' + rounded); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + this.trigger('change',this); + } + } else { + var parsed_discount = isNaN(parseFloat(rounded)) ? 0 : field_utils.parse.float('' + rounded); + var disc = Math.min(Math.max(parsed_discount || 0, 0),100); + this.discount = disc; + this.discountStr = '' + disc; + this.trigger('change',this); + } + } + } + + + }, + }); +}); + diff --git a/discount_limit/static/src/js/restrict.js b/discount_limit/static/src/js/restrict.js new file mode 100644 index 000000000..7794b0286 --- /dev/null +++ b/discount_limit/static/src/js/restrict.js @@ -0,0 +1,41 @@ +odoo.define('discount_limit.restrict', function (require) { +"use strict"; +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'); +models.load_fields("hr.employee","has_pos_discount_control"); + +const DiscountLimit = (DiscountButton) => + + class extends DiscountButton { + async onClick() { + var self=this; + if (this.env.pos.get_cashier().has_pos_discount_control===true){ + Gui.showPopup("ErrorPopup", { + 'title': _t('Discount Restricted'), + 'body': _t('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/views/assets.xml b/discount_limit/views/assets.xml new file mode 100644 index 000000000..ad9c61c93 --- /dev/null +++ b/discount_limit/views/assets.xml @@ -0,0 +1,10 @@ + +