diff --git a/membership_in_pos/README.rst b/membership_in_pos/README.rst new file mode 100644 index 000000000..e838b5ad4 --- /dev/null +++ b/membership_in_pos/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Pos Membership +=============== +This is used to create membership types for customer and also this customer can +apply discounts for their orders using the membership code. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + +Credits +------- +Developer: (V16) Gayathri V +Contacts: 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/membership_in_pos/__init__.py b/membership_in_pos/__init__.py new file mode 100644 index 000000000..27deb32ab --- /dev/null +++ b/membership_in_pos/__init__.py @@ -0,0 +1,23 @@ +"""pos membership""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/membership_in_pos/__manifest__.py b/membership_in_pos/__manifest__.py new file mode 100644 index 000000000..7a9dd35df --- /dev/null +++ b/membership_in_pos/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Pos Membership', + 'version': '16.0.1.0.0', + 'category': 'Point of Sale', + 'summary': """This module is used to add membership discount in pos""", + 'description': """This is used to create membership types for customer and + also this customer can apply discounts for their orders using the membership + code.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['pos_sale', 'sale', 'pos_loyalty', 'pos_discount'], + 'data': { + 'security/ir.model.access.csv', + 'views/res_config_settings_views.xml', + 'views/customer_membership_views.xml', + 'views/membership_card_views.xml', + }, + 'assets': { + 'point_of_sale.assets': [ + 'membership_in_pos/static/src/js/AbstractAwaitablePopup.js', + 'membership_in_pos/static/src/js/PaymentScreen.js', + 'membership_in_pos/static/src/js/ProductScreen.js', + 'membership_in_pos/static/src/xml/membership_pop_up.xml', + 'membership_in_pos/static/src/xml/PaymentScreen.xml', + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/membership_in_pos/doc/RELEASE_NOTES.md b/membership_in_pos/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..81e09daf2 --- /dev/null +++ b/membership_in_pos/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 18.10.2023 +#### Version 16.0.1.0.0 +##### ADD +- Initial commit for Pos Membership diff --git a/membership_in_pos/models/__init__.py b/membership_in_pos/models/__init__.py new file mode 100644 index 000000000..97bdd00f2 --- /dev/null +++ b/membership_in_pos/models/__init__.py @@ -0,0 +1,26 @@ +"""Pos_membership""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import customer_membership +from . import membership_card +from . import pos_session +from . import res_config_settings diff --git a/membership_in_pos/models/customer_membership.py b/membership_in_pos/models/customer_membership.py new file mode 100644 index 000000000..411494651 --- /dev/null +++ b/membership_in_pos/models/customer_membership.py @@ -0,0 +1,38 @@ +"""Membership""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class CustomerMembership(models.Model): + """Creates membership types""" + _name = 'customer.membership' + _inherit = 'mail.thread' + _description = 'Customer Membership' + + name = fields.Char(string='Name', required=True, help='Name') + default_period = fields.Float(default=1, readonly="True", + string='Default Validity Period(Year)', + help='Default validity period in year') + _sql_constraints = [ + ('name_uniq', 'unique (name)', 'The membership name must be unique !') + ] diff --git a/membership_in_pos/models/membership_card.py b/membership_in_pos/models/membership_card.py new file mode 100644 index 000000000..a93fb9a16 --- /dev/null +++ b/membership_in_pos/models/membership_card.py @@ -0,0 +1,102 @@ +""""Pos membership""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from uuid import uuid4 +from odoo import api, fields, models, _ +from odoo import exceptions + + +class MembershipCard(models.Model): + """Creating membership card for the customers""" + _name = 'membership.card' + _inherit = 'mail.thread' + _description = 'Membership Card' + _rec_name = 'membership_id' + + membership_id = fields.Many2one('customer.membership', string='Membership', + required=True, help='Membership id') + customer_id = fields.Many2one('res.partner', string="Customer", + help='The customer') + issue_date = fields.Date(string="Issue Date", help='Issue date') + validity = fields.Float(string='Validity(days)', + compute='_compute_validity', + help='Validity of membership card') + expiry_date = fields.Date(string="Exp Date", default=fields.Date.today(), + help='Expiry date of membership card') + code = fields.Char(string="Code", help='Unique code for the card', + readonly=True) + membership_code_button = fields.Boolean(default=False, string="Visibility", + help='The code generation button visibility') + discount = fields.Float(string='Discount(%)', help='Discount percentage amount') + state = fields.Selection( + [('draft', 'Draft'), ('confirm', 'Confirm'), ('cancel', 'Cancel')], + default='draft', string='State', help='State of the membership') + + @api.onchange('expiry_date') + def _onchange_expiry_date(self): + """This is used to check the expiry date of the membership""" + if self.expiry_date < fields.Date.today(): + raise exceptions.ValidationError(_( + "Please select a Valid Date." + )) + + def generate_code(self): + """Used to generate the code for membership card""" + self.code = '550' + str(uuid4())[7:-18] + self.membership_code_button = True + + def action_membership_confirm(self): + """Used to confirm the membership""" + self.state = 'confirm' + + def action_membership_canceled(self): + """Cancels the membership""" + self.state = 'cancel' + + def _compute_validity(self): + """Computes the validity""" + for rec in self: + date = rec.expiry_date - rec.issue_date + rec.validity = date.days + + def membership_card_check(self, customer_input): + """Checks the validity of the membership card""" + val = self.env['membership.card'].search( + [('customer_id.id', '=', customer_input[0]['customer']), + ('code', '=', customer_input[0]['customerInput']), + ('expiry_date', '>', fields.Date.today()), + ('state', '=', 'confirm')]) + membership_discount = self.env['membership.card'].sudo().search([( + 'customer_id.id', '=', customer_input[0]['customer'])]).mapped( + 'discount') + membership_product = int( + self.env['ir.config_parameter'].sudo().get_param( + 'pos_membership_product_id')) + if val: + return { + 'customer_name': val.customer_id.name, + 'membership': val.membership_id.name, + 'discount': membership_discount[0], + 'product_id': membership_product, + } + else: + return 0 diff --git a/membership_in_pos/models/pos_session.py b/membership_in_pos/models/pos_session.py new file mode 100644 index 000000000..8e87dc840 --- /dev/null +++ b/membership_in_pos/models/pos_session.py @@ -0,0 +1,50 @@ +"""Pos membership""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, models + + +class PosSession(models.Model): + """This is used to load the models and fields to pos session""" + _inherit = 'pos.session' + + @api.model + def _pos_ui_models_to_load(self): + """This is used to load a new model to pos session""" + result = super()._pos_ui_models_to_load() + result += [ + 'res.config.settings', + ] + return result + + def _loader_params_res_config_settings(self): + """This is used to load the model fields""" + return { + 'search_params': { + 'fields': ['is_pos_module_pos_membership'], + } + } + + def _get_pos_ui_res_config_settings(self, params): + """This is used to load the model""" + return self.env['res.config.settings'].search_read( + **params['search_params']) diff --git a/membership_in_pos/models/res_config_settings.py b/membership_in_pos/models/res_config_settings.py new file mode 100644 index 000000000..7d8b35e25 --- /dev/null +++ b/membership_in_pos/models/res_config_settings.py @@ -0,0 +1,78 @@ +"""Pos membership""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Gayathri v (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import exceptions +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + """This class used to add fields in the settings model""" + _inherit = 'res.config.settings' + + pos_membership_product_id = fields.Many2one('product.product', + string="Membership Product", + help="Membership product", + compute='_compute_pos_membership_discount_product_id', + store=True, readonly=False) + is_pos_module_pos_membership = fields.Boolean(string="Pos Membership", + help="Pos module's pos membership") + + @api.depends('is_pos_module_pos_membership') + def _compute_pos_membership_discount_product_id(self): + """This is used to compute the default discount product of membership""" + for rec in self: + if rec.is_pos_module_pos_membership: + rec.pos_membership_product_id = self.env.ref( + 'point_of_sale.product_product_consumable').id + else: + rec.pos_membership_product_id = False + + def get_values(self): + """Getting the values from the transient model""" + res = super(ResConfigSettings, self).get_values() + params = self.env['ir.config_parameter'].sudo() + is_pos_module_pos_membership = params.get_param('membership_in_pos.' + 'is_pos_module_pos_membership') + res.update( + pos_membership_product_id=int( + self.env['ir.config_parameter'].sudo().get_param( + 'pos_membership_product_id')), + is_pos_module_pos_membership=is_pos_module_pos_membership + ) + return res + + @api.model + def set_values(self): + """ Set values for the fields """ + super().set_values() + self.env['ir.config_parameter'].sudo().set_param( + 'pos_membership_product_id', + self.pos_membership_product_id.id) + self.env['ir.config_parameter'].sudo().set_param( + 'membership_in_pos.is_pos_module_pos_membership', + self.is_pos_module_pos_membership) + if self.pos_membership_product_id: + if not (self.pos_membership_product_id.available_in_pos): + raise exceptions.UserError( + "The discount product seems misconfigured.Make sure it is " + "flagged as 'Can be Sold' and 'Available in Point of Sale") + diff --git a/membership_in_pos/security/ir.model.access.csv b/membership_in_pos/security/ir.model.access.csv new file mode 100644 index 000000000..191cbf4fd --- /dev/null +++ b/membership_in_pos/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_customer_membership,access.customer.membership,model_customer_membership,base.group_user,1,1,1,1 +access_membership_card,access.membership.card,model_membership_card,base.group_user,1,1,1,1 diff --git a/membership_in_pos/static/description/assets/icons/check.png b/membership_in_pos/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/check.png differ diff --git a/membership_in_pos/static/description/assets/icons/chevron.png b/membership_in_pos/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/chevron.png differ diff --git a/membership_in_pos/static/description/assets/icons/cogs.png b/membership_in_pos/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/cogs.png differ diff --git a/membership_in_pos/static/description/assets/icons/consultation.png b/membership_in_pos/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/consultation.png differ diff --git a/membership_in_pos/static/description/assets/icons/ecom-black.png b/membership_in_pos/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/ecom-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/education-black.png b/membership_in_pos/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/education-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/hotel-black.png b/membership_in_pos/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/hotel-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/license.png b/membership_in_pos/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/license.png differ diff --git a/membership_in_pos/static/description/assets/icons/lifebuoy.png b/membership_in_pos/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/lifebuoy.png differ diff --git a/membership_in_pos/static/description/assets/icons/manufacturing-black.png b/membership_in_pos/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/manufacturing-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/pos-black.png b/membership_in_pos/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/pos-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/puzzle.png b/membership_in_pos/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/puzzle.png differ diff --git a/membership_in_pos/static/description/assets/icons/restaurant-black.png b/membership_in_pos/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/restaurant-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/service-black.png b/membership_in_pos/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/service-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/trading-black.png b/membership_in_pos/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/trading-black.png differ diff --git a/membership_in_pos/static/description/assets/icons/training.png b/membership_in_pos/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/training.png differ diff --git a/membership_in_pos/static/description/assets/icons/update.png b/membership_in_pos/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/update.png differ diff --git a/membership_in_pos/static/description/assets/icons/user.png b/membership_in_pos/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/user.png differ diff --git a/membership_in_pos/static/description/assets/icons/wrench.png b/membership_in_pos/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/membership_in_pos/static/description/assets/icons/wrench.png differ diff --git a/membership_in_pos/static/description/assets/misc/categories.png b/membership_in_pos/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/categories.png differ diff --git a/membership_in_pos/static/description/assets/misc/check-box.png b/membership_in_pos/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/check-box.png differ diff --git a/membership_in_pos/static/description/assets/misc/compass.png b/membership_in_pos/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/compass.png differ diff --git a/membership_in_pos/static/description/assets/misc/corporate.png b/membership_in_pos/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/corporate.png differ diff --git a/membership_in_pos/static/description/assets/misc/customer-support.png b/membership_in_pos/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/customer-support.png differ diff --git a/membership_in_pos/static/description/assets/misc/cybrosys-logo.png b/membership_in_pos/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/cybrosys-logo.png differ diff --git a/membership_in_pos/static/description/assets/misc/features.png b/membership_in_pos/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/features.png differ diff --git a/membership_in_pos/static/description/assets/misc/logo.png b/membership_in_pos/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/logo.png differ diff --git a/membership_in_pos/static/description/assets/misc/pictures.png b/membership_in_pos/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/pictures.png differ diff --git a/membership_in_pos/static/description/assets/misc/pie-chart.png b/membership_in_pos/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/pie-chart.png differ diff --git a/membership_in_pos/static/description/assets/misc/right-arrow.png b/membership_in_pos/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/right-arrow.png differ diff --git a/membership_in_pos/static/description/assets/misc/star.png b/membership_in_pos/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/star.png differ diff --git a/membership_in_pos/static/description/assets/misc/support.png b/membership_in_pos/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/support.png differ diff --git a/membership_in_pos/static/description/assets/misc/whatsapp.png b/membership_in_pos/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/membership_in_pos/static/description/assets/misc/whatsapp.png differ diff --git a/membership_in_pos/static/description/assets/modules/5.gif b/membership_in_pos/static/description/assets/modules/5.gif new file mode 100644 index 000000000..8f40aab85 Binary files /dev/null and b/membership_in_pos/static/description/assets/modules/5.gif differ diff --git a/membership_in_pos/static/description/assets/modules/barcode.png b/membership_in_pos/static/description/assets/modules/barcode.png new file mode 100644 index 000000000..618e3e6c4 Binary files /dev/null and b/membership_in_pos/static/description/assets/modules/barcode.png differ diff --git a/membership_in_pos/static/description/assets/modules/fatoorah.png b/membership_in_pos/static/description/assets/modules/fatoorah.png new file mode 100644 index 000000000..991fc77ec Binary files /dev/null and b/membership_in_pos/static/description/assets/modules/fatoorah.png differ diff --git a/membership_in_pos/static/description/assets/modules/integration_biometric.png b/membership_in_pos/static/description/assets/modules/integration_biometric.png new file mode 100644 index 000000000..ed11bd818 Binary files /dev/null and b/membership_in_pos/static/description/assets/modules/integration_biometric.png differ diff --git a/membership_in_pos/static/description/assets/modules/product_brand.png b/membership_in_pos/static/description/assets/modules/product_brand.png new file mode 100644 index 000000000..1d2238b80 Binary files /dev/null and b/membership_in_pos/static/description/assets/modules/product_brand.png differ diff --git a/membership_in_pos/static/description/assets/modules/website_cart.png b/membership_in_pos/static/description/assets/modules/website_cart.png new file mode 100644 index 000000000..163485cfd Binary files /dev/null and b/membership_in_pos/static/description/assets/modules/website_cart.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/1.png b/membership_in_pos/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..458f65918 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/1.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/10.png b/membership_in_pos/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..6a0a8df81 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/10.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/11.png b/membership_in_pos/static/description/assets/screenshots/11.png new file mode 100644 index 000000000..3f86b0577 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/11.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/13.png b/membership_in_pos/static/description/assets/screenshots/13.png new file mode 100644 index 000000000..bc1193a08 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/13.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/2.png b/membership_in_pos/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..73005adbd Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/2.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/3.png b/membership_in_pos/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..724d03709 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/3.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/4.png b/membership_in_pos/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..aa03837d1 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/4.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/5.png b/membership_in_pos/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..48cf2c59a Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/5.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/6.png b/membership_in_pos/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..b2a9ff069 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/6.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/7.png b/membership_in_pos/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..b51e0e838 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/7.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/8.png b/membership_in_pos/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..c17f9dff7 Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/8.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/9.png b/membership_in_pos/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..9263f0b8d Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/9.png differ diff --git a/membership_in_pos/static/description/assets/screenshots/hero.gif b/membership_in_pos/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..a4561fd9e Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/hero.gif differ diff --git a/membership_in_pos/static/description/assets/screenshots/image6.png b/membership_in_pos/static/description/assets/screenshots/image6.png new file mode 100644 index 000000000..8132937fa Binary files /dev/null and b/membership_in_pos/static/description/assets/screenshots/image6.png differ diff --git a/membership_in_pos/static/description/banner.png b/membership_in_pos/static/description/banner.png new file mode 100644 index 000000000..d54eb732c Binary files /dev/null and b/membership_in_pos/static/description/banner.png differ diff --git a/membership_in_pos/static/description/icon.png b/membership_in_pos/static/description/icon.png new file mode 100644 index 000000000..b9b4ae940 Binary files /dev/null and b/membership_in_pos/static/description/icon.png differ diff --git a/membership_in_pos/static/description/index.html b/membership_in_pos/static/description/index.html new file mode 100644 index 000000000..5c9e8ab73 --- /dev/null +++ b/membership_in_pos/static/description/index.html @@ -0,0 +1,564 @@ +
+ +
+ +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ + + +

Pos Membership

+

It is used to add membership discounts to customers.

+ + + +
+ + +
+
+ +
+

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ The app is used to add membership discounts to the those customers having memberships. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + + Add membership Types. +
+
+ + Create membership and discounts for customers. +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

After installing the module a new menu will be appeared.

+ +
+
+

Go to settings and add the discount product.

+ +
+ +
+

Create membership types

+ +
+ +
+

Form view of membership.

+ +
+ +
+

Membership card for customers.

+ +
+ +
+

Form view of membership card.

+ +
+ +
+

Pos order for the customer having membership

+ +
+ +
+

Membership on the payment screen

+ +
+ +
+

Select the membership with the customer

+ +
+ +
+

Copy the code and check the membership

+ +
+ +
+

The discount will be applied

+ +
+
+

It will also shown in the receipt.

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

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

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

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/membership_in_pos/static/src/js/AbstractAwaitablePopup.js b/membership_in_pos/static/src/js/AbstractAwaitablePopup.js new file mode 100644 index 000000000..607de4d17 --- /dev/null +++ b/membership_in_pos/static/src/js/AbstractAwaitablePopup.js @@ -0,0 +1,101 @@ +odoo.define('membership_in_pos.MembershipPopup', function (require) { + 'use strict'; + const { Gui } = require('point_of_sale.Gui'); + const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); + const Registries = require('point_of_sale.Registries'); + const { _t } = require('web.core'); + var rpc = require('web.rpc'); + //Creates a pop up for membership + class MembershipPopup extends AbstractAwaitablePopup { + setup() { + super.setup(); + } + // This is used to check the customer has membership + async Membership_check(){ + var customer_details = [] + const customerInput = $('.card_code').val(); + var order = this.env.pos.get_order() + var customer = order.get_partner().id + customer_details.push({ + 'customerInput':customerInput, + 'customer':customer + }) + var self = this + //This is used to retrieve the customers membership details + var card = await rpc.query({ + model: 'membership.card', + method: 'membership_card_check', + args: [,customer_details] + }).then(function (card) { + self.env.pos.card = card + if (self.env.pos.card == 0){ + Gui.showPopup('ErrorPopup', { + title: _t('Membership'), + body: _t('Your Card is Expired/Please check you have membership.') + }); + } + }) + } + //Confirms the membership + async confirm() { + var order = this.env.pos.get_order(); + var lines = order.get_orderlines(); + if (this.env.pos.card){ + var product = this.env.pos.db.get_product_by_id(this.env.pos.card.product_id); + } + else{ + var product = 'undefined' + await this.showPopup('ErrorPopup', { + title : this.env._t("No Membership discount product found"), + body : this.env._t("The discount product seems misconfigured.Make sure it is flagged as 'Can be Sold' and 'Available in Point of Sale'.Also confirm the customer has membership card."), + }); + return; + } + // Remove existing discounts + lines.filter(line => line.get_product() === product) + .forEach(line => order.remove_orderline(line)); + let linesByTax = order.get_orderlines_grouped_by_tax_ids(); + for (let [tax_ids, lines] of Object.entries(linesByTax)) { + // Note that tax_ids_array is an Array of tax_ids that apply to these lines + // That is, the use case of products with more than one tax is supported. + let tax_ids_array = tax_ids.split(',').filter(id => id !== '').map(id => Number(id)); + let baseToDiscount = order.calculate_base_amount(tax_ids_array, lines.filter(ll => !ll.reward_id && (!this.env.pos.config.tip_product_id || ll.product.id !== this.env.pos.config.tip_product_id[0]))); + // We add the price as manually set to avoid re computation when changing customer. + let discount = - parseFloat(this.env.pos.card.discount) / 100.0 * baseToDiscount; + if (discount < 0) { + order.add_product(product, { + price: discount, + lst_price: discount, + tax_ids: tax_ids_array, + merge: false, + description: + `${ this.env.pos.card.discount}%, ` + + (tax_ids_array.length ? + _.str.sprintf( + this.env._t('Tax: %s'), + tax_ids_array.map(taxId => this.env.pos.taxes_by_id[taxId].amount + '%').join(', ') + ) : + this.env._t('No tax')), + extras: { + price_automatically_set: true, + }, + }); + } + } + this.env.posbus.trigger('close-popup', { + popupId: this.props.id, + response: { confirmed: true, payload: null}, + }); + } + } + //Create membership popup + MembershipPopup.template = 'MembershipPopup'; + MembershipPopup.defaultProps = { + confirmText: 'Ok', + cancelText: 'Cancel', + title: 'Membership Card', + body: '', + }; + Registries.Component.add(MembershipPopup); + return MembershipPopup; +}); diff --git a/membership_in_pos/static/src/js/PaymentScreen.js b/membership_in_pos/static/src/js/PaymentScreen.js new file mode 100644 index 000000000..35489a422 --- /dev/null +++ b/membership_in_pos/static/src/js/PaymentScreen.js @@ -0,0 +1,29 @@ +odoo.define('membership_in_pos.membership', function (require) { + 'use strict'; + var { PosGlobalState } = require('point_of_sale.models'); + const Registries = require('point_of_sale.Registries'); + const PaymentScreen = require('point_of_sale.PaymentScreen'); + const PosMembershipGlobalState = (PosGlobalState) => + class PosMembershipGlobalState extends PosGlobalState { + //@override + async _processData(loadedData) { + await super._processData(loadedData); + this.res_config = loadedData['res.config.settings']; + } + } + Registries.Model.extend(PosGlobalState, PosMembershipGlobalState); + //extends the payment screen + const CustomButtonPaymentScreen = (PaymentScreen) => + class extends PaymentScreen { + setup() { + super.setup(...arguments); + this.env.pos.membership = this.env.pos.res_config[this.env.pos.res_config.length-1].is_pos_module_pos_membership + } + async MemberShipButton() { + // click_membership shows the pop up + const { confirmed } = await this.showPopup('MembershipPopup'); + } + }; + Registries.Component.extend(PaymentScreen, CustomButtonPaymentScreen); + return CustomButtonPaymentScreen; +}); diff --git a/membership_in_pos/static/src/js/ProductScreen.js b/membership_in_pos/static/src/js/ProductScreen.js new file mode 100644 index 000000000..dca9ea558 --- /dev/null +++ b/membership_in_pos/static/src/js/ProductScreen.js @@ -0,0 +1,40 @@ +odoo.define('membership_in_pos.customer', function (require) { +"use strict"; + const Registries = require('point_of_sale.Registries'); + const ProductScreen = require('point_of_sale.ProductScreen'); + var { Gui } = require('point_of_sale.Gui'); + var core = require('web.core'); + var _t = core._t; + const PosCustomer = (ProductScreen) => + class extends ProductScreen { + setup(){ + super.setup(); + } + //To check where the customer has to be selected + async _onClickPay() { + if (this.env.pos.get_order().get_partner()){ + if (this.env.pos.get_order().orderlines.some(line => line.get_product().tracking !== 'none' && !line.has_valid_product_lot()) && (this.env.pos.picking_type.use_create_lots || this.env.pos.picking_type.use_existing_lots)) { + const { confirmed } = await this.showPopup('ConfirmPopup', { + title: this.env._t('Some Serial/Lot Numbers are missing'), + body: this.env._t('You are trying to sell products with serial/lot numbers, but some of them are not set.\nWould you like to proceed anyway?'), + confirmText: this.env._t('Yes'), + cancelText: this.env._t('No') + }); + if (confirmed) { + this.showScreen('PaymentScreen'); + } + } else { + this.showScreen('PaymentScreen'); + } + } + else{ + Gui.showPopup("ErrorPopup", { + 'title': _t("Customer"), + 'body': _t("You Must Select a Customer"), + }); + } + } + } + Registries.Component.extend(ProductScreen, PosCustomer); + return ProductScreen; +}); diff --git a/membership_in_pos/static/src/xml/PaymentScreen.xml b/membership_in_pos/static/src/xml/PaymentScreen.xml new file mode 100644 index 000000000..d214879ca --- /dev/null +++ b/membership_in_pos/static/src/xml/PaymentScreen.xml @@ -0,0 +1,19 @@ + + + + + + +
+
+ + Membership +
+
+
+ + +
+
+
diff --git a/membership_in_pos/static/src/xml/membership_pop_up.xml b/membership_in_pos/static/src/xml/membership_pop_up.xml new file mode 100644 index 000000000..35acc6c87 --- /dev/null +++ b/membership_in_pos/static/src/xml/membership_pop_up.xml @@ -0,0 +1,51 @@ + + + + + + diff --git a/membership_in_pos/views/customer_membership_views.xml b/membership_in_pos/views/customer_membership_views.xml new file mode 100644 index 000000000..9acf93d62 --- /dev/null +++ b/membership_in_pos/views/customer_membership_views.xml @@ -0,0 +1,53 @@ + + + + + Membership + customer.membership + tree,form + +

+ Generate Membership Types +

+
+
+ + + customer.membership.view.tree + customer.membership + + + + + + + + + customer.membership.view.form + customer.membership + +
+ + + + + + + + +
+ + +
+
+
+
+ + + +
diff --git a/membership_in_pos/views/membership_card_views.xml b/membership_in_pos/views/membership_card_views.xml new file mode 100644 index 000000000..67a92b63f --- /dev/null +++ b/membership_in_pos/views/membership_card_views.xml @@ -0,0 +1,90 @@ + + + + + Cards + membership.card + tree,form + +

+ Generate Membership Card Types +

+
+
+ + + membership.card.view.tree + membership.card + + + + + + + + + + + membership.card.view.form + membership.card + +
+
+ + +
+ + + + + + + + + + + + + + + + +