diff --git a/pos_partial_payment_odoo/README.rst b/pos_partial_payment_odoo/README.rst new file mode 100755 index 000000000..299d34181 --- /dev/null +++ b/pos_partial_payment_odoo/README.rst @@ -0,0 +1,42 @@ +.. 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 Partial Payment +=================== +Simplify Payments with Partial Payment in Odoo POS + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +Developer:(V16) Anfas Faisal K, 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/pos_partial_payment_odoo/__init__.py b/pos_partial_payment_odoo/__init__.py new file mode 100644 index 000000000..f03fb2c25 --- /dev/null +++ b/pos_partial_payment_odoo/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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/pos_partial_payment_odoo/__manifest__.py b/pos_partial_payment_odoo/__manifest__.py new file mode 100644 index 000000000..11bd08dca --- /dev/null +++ b/pos_partial_payment_odoo/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 Partial Payment', + 'version': '16.0.1.0.0', + 'category': 'Point of Sale', + 'summary': "Simplify Payments with Partial Payment in Odoo POS", + 'description': "In Odoo POS, partial payments allow customers to pay for " + "their purchases in multiple installments, making it " + "easier for customers to split payments or pay later. This " + "feature is especially helpful for businesses dealing with " + "larger orders or customers who prefer flexibility in " + "their payment options.", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'point_of_sale'], + 'data': [ + 'views/pos_config_views.xml', + 'views/pos_order_views.xml', + 'views/res_partner_views.xml', + ], + 'assets': { + 'point_of_sale.assets': [ + 'pos_partial_payment_odoo/static/src/js/payment_screen.js', + 'pos_partial_payment_odoo/static/src/js/models.js', + 'pos_partial_payment_odoo/static/src/js/ticket_screen.js', + 'pos_partial_payment_odoo/static/src/xml/payment_screen.xml', + ]}, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/pos_partial_payment_odoo/doc/RELEASE_NOTES.md b/pos_partial_payment_odoo/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..eaec5732f --- /dev/null +++ b/pos_partial_payment_odoo/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 19.12.2023 +#### Version 16.0.1.0.0 +### ADD + +- Initial Commit for POS Partial Payment diff --git a/pos_partial_payment_odoo/models/__init__.py b/pos_partial_payment_odoo/models/__init__.py new file mode 100644 index 000000000..4a00ebd19 --- /dev/null +++ b/pos_partial_payment_odoo/models/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 account_payment_register +from . import pos_config +from . import pos_order +from . import pos_session +from . import res_partner diff --git a/pos_partial_payment_odoo/models/account_payment_register.py b/pos_partial_payment_odoo/models/account_payment_register.py new file mode 100644 index 000000000..7708db66d --- /dev/null +++ b/pos_partial_payment_odoo/models/account_payment_register.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 AccountPaymentRegister(models.TransientModel): + """ + Model to inherit 'account.payment.register' for supering the Payment Button + to change functionality. + """ + _inherit = 'account.payment.register' + + def action_create_payments(self): + """ + Override the 'action_create_payments' method to set + 'is_partial_payment' to False for the current order associated with + the active session. + """ + res = super(AccountPaymentRegister,self).action_create_payments() + active_session = self.env['pos.session'].search( + [('state', '=', 'opened'), + ('user_id', '=', self.env.user.id)], limit=1) + if active_session: + current_order = self.env['pos.order'].search( + [('session_id', '=', active_session.id), + ('state', '=', 'invoiced')], limit=1) + if current_order: + current_order.write({'is_partial_payment': False}) + return res diff --git a/pos_partial_payment_odoo/models/pos_config.py b/pos_partial_payment_odoo/models/pos_config.py new file mode 100644 index 000000000..c8eb2ee49 --- /dev/null +++ b/pos_partial_payment_odoo/models/pos_config.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 PosConfig(models.Model): + """ + This class extends the 'pos.config' model to add the 'partial_payment' field + + The 'partial_payment' field allows configuring whether the Point of Sale + (POS) system should allow partial payments for orders. + """ + _inherit = 'pos.config' + + partial_payment = fields.Boolean(string='Allow Partial Payment', + default=True, + help="If enabled, the Point of Sale system" + "allows partial payments for orders.") diff --git a/pos_partial_payment_odoo/models/pos_order.py b/pos_partial_payment_odoo/models/pos_order.py new file mode 100644 index 000000000..f670ec0af --- /dev/null +++ b/pos_partial_payment_odoo/models/pos_order.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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, models, fields, _ +from odoo.exceptions import UserError +from odoo.osv.expression import AND +from odoo.tools import float_round, float_is_zero + + +class PosOrder(models.Model): + """ + This class extends the 'pos.order' model to introduce additional + functionality related to partial payments and order management in the + Point of Sale (POS) system. + + It adds fields and methods for tracking partial payments, computing due + amounts, and marking orders as paid. The class also includes a method to + search for partial orders based on specified criteria. + + """ + _inherit = 'pos.order' + + is_partial_payment = fields.Boolean(string="Is Partial Payment", + default=False, + help="Flag indicating whether this POS " + "order is a partial payment.") + due_amount = fields.Float(string="Amount Due", + compute='_compute_due_amount', + store=True, + help="The amount remaining to be paid for this" + "POS order.") + + @api.depends('amount_total', 'amount_paid') + def _compute_due_amount(self): + """ + Compute the due amount for the POS order. + + This method computes the difference between the total amount and the amount paid + for the POS order and updates the 'due_amount' field accordingly. + """ + for record in self: + record.due_amount = record.amount_total - record.amount_paid + + def _order_fields(self, ui_order): + """ + Prepare dictionary for create method + + This method prepares a dictionary of order fields for creating a POS order based + on the data from the user interface (UI) order. + """ + result = super()._order_fields(ui_order) + result['is_partial_payment'] = ui_order.get('is_partial_payment') + return result + + def action_pos_order_paid(self): + """ + Mark the POS order as paid. This method marks the POS order as + paid and ensures that it is fully paid based on the partial + payment. + """ + self.ensure_one() + # TODO: add support for mix of cash and non-cash payments when both cash_rounding and only_round_cash_method are True + if not self.config_id.cash_rounding \ + or self.config_id.only_round_cash_method \ + and not any( + p.payment_method_id.is_cash_count for p in self.payment_ids): + total = self.amount_total + else: + total = float_round(self.amount_total, + precision_rounding=self.config_id.rounding_method.rounding, + rounding_method=self.config_id.rounding_method.rounding_method) + isPaid = float_is_zero(total - self.amount_paid, + precision_rounding=self.currency_id.rounding) + if not isPaid: + pos_config = self.env['pos.config'].search([]) + for shop in pos_config: + if shop.partial_payment: + isPaid = True + if not isPaid and not self.config_id.cash_rounding: + raise UserError(_("Order %s is not fully paid.", self.name)) + elif not isPaid and self.config_id.cash_rounding: + currency = self.currency_id + if self.config_id.rounding_method.rounding_method == "HALF-UP": + maxDiff = currency.round( + self.config_id.rounding_method.rounding / 2) + else: + maxDiff = currency.round( + self.config_id.rounding_method.rounding) + + diff = currency.round(self.amount_total - self.amount_paid) + if not abs(diff) <= maxDiff: + raise UserError(_("Order %s is not fully paid.", self.name)) + self.write({'state': 'paid'}) + return True + + @api.model + def search_partial_order_ids(self, config_id, domain, limit, offset): + """Search for 'partial' orders that satisfy the given domain, + limit and offset.""" + default_domain = ['&', ('config_id', '=', config_id), + ('is_partial_payment', '=', True), '!', '|', + ('state', '=', 'draft'), ('state', '=', 'cancelled')] + real_domain = AND([domain, default_domain]) + ids = self.search(AND([domain, default_domain]), limit=limit, + offset=offset).ids + totalCount = self.search_count(real_domain) + return {'ids': ids, 'totalCount': totalCount} diff --git a/pos_partial_payment_odoo/models/pos_session.py b/pos_partial_payment_odoo/models/pos_session.py new file mode 100644 index 000000000..a30482090 --- /dev/null +++ b/pos_partial_payment_odoo/models/pos_session.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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): + """ + This class extends the 'pos.session' model to add functionality related to loading + parameters of the 'res.partner' model within the session + """ + _inherit = 'pos.session' + + def _loader_params_res_partner(self): + """ + This function loads the parameters of res.partner in the session. + ---------------------------------------- + @param self: object pointer + @return result: params of res.partner model + """ + result = super(PosSession, self)._loader_params_res_partner() + result['search_params']['fields'].append('prevent_partial_payment') + return result diff --git a/pos_partial_payment_odoo/models/res_partner.py b/pos_partial_payment_odoo/models/res_partner.py new file mode 100644 index 000000000..a9bfead09 --- /dev/null +++ b/pos_partial_payment_odoo/models/res_partner.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Anfas Faisal K (odoo@cybrosys.info) +# +# 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 ResPartner(models.Model): + """ + This class extends the 'res.partner' model to introduce the 'prevent_partial_payment' + field. + """ + _inherit = 'res.partner' + + prevent_partial_payment = fields.Boolean( + string="Dont allow Partial Payment in POS", + help="If enabled, partial payments will be prevented for Point of Sale " + "orders associated with this partner.") diff --git a/pos_partial_payment_odoo/static/description/assets/icons/check.png b/pos_partial_payment_odoo/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/check.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/chevron.png b/pos_partial_payment_odoo/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/chevron.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/cogs.png b/pos_partial_payment_odoo/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/cogs.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/consultation.png b/pos_partial_payment_odoo/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/consultation.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/ecom-black.png b/pos_partial_payment_odoo/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/ecom-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/education-black.png b/pos_partial_payment_odoo/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/education-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/hotel-black.png b/pos_partial_payment_odoo/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/hotel-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/license.png b/pos_partial_payment_odoo/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/license.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/lifebuoy.png b/pos_partial_payment_odoo/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/manufacturing-black.png b/pos_partial_payment_odoo/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/pos-black.png b/pos_partial_payment_odoo/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/pos-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/puzzle.png b/pos_partial_payment_odoo/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/puzzle.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/restaurant-black.png b/pos_partial_payment_odoo/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/service-black.png b/pos_partial_payment_odoo/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/service-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/trading-black.png b/pos_partial_payment_odoo/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/trading-black.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/training.png b/pos_partial_payment_odoo/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/training.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/update.png b/pos_partial_payment_odoo/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/update.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/user.png b/pos_partial_payment_odoo/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/user.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/icons/wrench.png b/pos_partial_payment_odoo/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/wrench.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/categories.png b/pos_partial_payment_odoo/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/categories.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/check-box.png b/pos_partial_payment_odoo/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/check-box.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/compass.png b/pos_partial_payment_odoo/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/compass.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/corporate.png b/pos_partial_payment_odoo/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/corporate.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/customer-support.png b/pos_partial_payment_odoo/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/customer-support.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/cybrosys-logo.png b/pos_partial_payment_odoo/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/cybrosys-logo.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/features.png b/pos_partial_payment_odoo/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/features.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/logo.png b/pos_partial_payment_odoo/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/logo.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/pictures.png b/pos_partial_payment_odoo/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/pictures.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/pie-chart.png b/pos_partial_payment_odoo/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/pie-chart.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/right-arrow.png b/pos_partial_payment_odoo/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/right-arrow.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/star.png b/pos_partial_payment_odoo/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/star.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/support.png b/pos_partial_payment_odoo/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/support.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/whatsapp.png b/pos_partial_payment_odoo/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/whatsapp.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/modules/1.png b/pos_partial_payment_odoo/static/description/assets/modules/1.png new file mode 100755 index 000000000..a0afb603e Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/modules/1.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/modules/2.png b/pos_partial_payment_odoo/static/description/assets/modules/2.png new file mode 100644 index 000000000..d1d3775d6 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/modules/2.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/modules/3.png b/pos_partial_payment_odoo/static/description/assets/modules/3.png new file mode 100644 index 000000000..759574472 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/modules/3.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/modules/4.png b/pos_partial_payment_odoo/static/description/assets/modules/4.png new file mode 100644 index 000000000..dcbd0cb06 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/modules/4.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/modules/5.png b/pos_partial_payment_odoo/static/description/assets/modules/5.png new file mode 100644 index 000000000..a77027978 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/modules/5.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/modules/6.png b/pos_partial_payment_odoo/static/description/assets/modules/6.png new file mode 100644 index 000000000..fd1f87699 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/modules/6.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/.gif.zip b/pos_partial_payment_odoo/static/description/assets/screenshots/.gif.zip new file mode 100644 index 000000000..86c278389 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/.gif.zip differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/1.png b/pos_partial_payment_odoo/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..2110dcce9 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/1.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/2.png b/pos_partial_payment_odoo/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..a91872e18 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/2.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/3.png b/pos_partial_payment_odoo/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..8580f0b2b Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/3.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/4.png b/pos_partial_payment_odoo/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..476cc53a3 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/4.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/6.png b/pos_partial_payment_odoo/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..ecaf1cf5a Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/6.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/8.png b/pos_partial_payment_odoo/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..5ba4fa061 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/8.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/9.png b/pos_partial_payment_odoo/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..168792e5a Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/9.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/screenshots/v16-hero.gif b/pos_partial_payment_odoo/static/description/assets/screenshots/v16-hero.gif new file mode 100644 index 000000000..855ec14d2 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/v16-hero.gif differ diff --git a/pos_partial_payment_odoo/static/description/banner.jpg b/pos_partial_payment_odoo/static/description/banner.jpg new file mode 100644 index 000000000..fc8615ce6 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/banner.jpg differ diff --git a/pos_partial_payment_odoo/static/description/icon.png b/pos_partial_payment_odoo/static/description/icon.png new file mode 100644 index 000000000..e16e49055 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/icon.png differ diff --git a/pos_partial_payment_odoo/static/description/index.html b/pos_partial_payment_odoo/static/description/index.html new file mode 100644 index 000000000..c34307d95 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/index.html @@ -0,0 +1,656 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ POS Partial Payment +

+

+ A Module For Configuring Partial Payment In POS. +

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview

+
+
+
+ The Odoo POS Partial Payment Module enables customers to make partial payments instead of paying the full amount at the point of sale . This feature offers flexibility in handling payments and allows for more convenient transaction processing. + + +
+
+ +
+

+ Features +

+
+
+
+ + Enables sellers to allow partial payment in POS for customers + +
+
+ + Register payments for the invoice from Odoo backend +
+ +
+ + Set partial payment option as per your wish + +
+
+
+
+ + +
+
+ +
+

Screenshots

+
+ +
+
+
+

+ Allow Partial Payment In Pos Session +

+

+ In the Pos Config Enable Partial Payment in POS to make Partial Payments in POS Session. +

+ +
+ +
+

+ Validating Partial Payment In POS +

+

+ You have to enable Invoice and Partial Payment in Payment Screen to Allow Partial Payment in POS Screen. +

+ +
+
+

+ Click On The Validate Button To Make Partial Payment In POS +

+ +
+
+

+ Once The Payment Is Done It Will Redirect Us To The Receipt Status Page +

+ +
+
+

+ POS Partial Payment View +

+

+ Provide option to see POS partial payments from the POS screen. +

+ +
+
+

+ Partial Payment Saved In The Backend +

+ +
+
+

+ Make Rest Of the Payment In The POS Backend +

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

+ 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

+
+
+
+
+
+
+
+ +
+
+
+
+
+ diff --git a/pos_partial_payment_odoo/static/src/js/models.js b/pos_partial_payment_odoo/static/src/js/models.js new file mode 100644 index 000000000..b5ffbc827 --- /dev/null +++ b/pos_partial_payment_odoo/static/src/js/models.js @@ -0,0 +1,26 @@ +/** @odoo-module **/ +import models from 'point_of_sale.models'; +import {Order} from 'point_of_sale.models'; +import Registries from "point_of_sale.Registries"; +// Define the Partial class +const Partial = (Order) => class Partial extends Order { + constructor() { + super(...arguments); + this.partial_payment = false + this.is_partial_payment = this.is_partial_payment || false; + } + set_order_suggestion(suggestion){ + this.is_partial_payment = is_partial_payment + } + //send order data to send to the server + export_as_JSON() { + const json = super.export_as_JSON(...arguments) + json.is_partial_payment = this.is_partial_payment ; + return json; + } + init_from_JSON(json) { + super.init_from_JSON(...arguments); + this.is_partial_payment = json.is_partial_payment; + } +}; +Registries.Model.extend(Order, Partial) \ No newline at end of file diff --git a/pos_partial_payment_odoo/static/src/js/payment_screen.js b/pos_partial_payment_odoo/static/src/js/payment_screen.js new file mode 100644 index 000000000..4036b53bb --- /dev/null +++ b/pos_partial_payment_odoo/static/src/js/payment_screen.js @@ -0,0 +1,76 @@ +odoo.define('pos_button.CustomButtonPaymentScreen', function (require) { + 'use strict'; + const { Gui } = require('point_of_sale.Gui'); + const PosComponent = require('point_of_sale.PosComponent'); + const { identifyError } = require('point_of_sale.utils'); + const ProductScreen = require('point_of_sale.ProductScreen'); + const { useListener } = require("@web/core/utils/hooks"); + const Registries = require('point_of_sale.Registries'); + const PaymentScreen = require('point_of_sale.PaymentScreen'); + const Chrome = require('point_of_sale.Chrome'); + const { useRef } = owl; + + // Define the PartialPaymentButtonPaymentScreen class + const PartialPaymentButtonPaymentScreen = (PaymentScreen) => + class extends PaymentScreen { + setup() { + super.setup(); + this.root = useRef('PartialPayment'); + } + //Partial Payment Button Functionality + PartialPaymentButton() { + if (this.currentOrder.partial_payment === false) { + this.currentOrder.partial_payment = true; + var validate = this.root.el + $(validate).addClass('highlight'); + } else { + this.currentOrder.partial_payment = false; + var validate = this.root.el + $(validate).removeClass('highlight'); + } + } + //Validate Payment Button Functionality + async validateOrder(isForceValidate) { + if (!this.currentOrder.partial_payment){ + await super.validateOrder(isForceValidate); + } + else{ + if (this.currentOrder.get_partner().prevent_partial_payment ) { + this.showPopup('ErrorPopup', { + title: this.env._t('Partial Payment Not Allowed'), + body: this.env._t( + 'The Customer is not allowed to make Partial Payments.' + ), + }); + return false; + }; + //If Invoice not Selected Show Error + if(!this.currentOrder.to_invoice){ + this.showPopup('ErrorPopup', { + title: this.env._t('Cannot Validate This Order'), + body: this.env._t( + 'You need to Set Invoice for Validating Partial Payments' + ), + }); + return false; + }; + //If amount is fully paid show error + if(!this.currentOrder.get_due()){ + this.showPopup('ErrorPopup', { + title: this.env._t('Cannot Validate This Order'), + body: this.env._t( + 'The Amount is Fully Paid Disable Partial Payment to Validate this Order' + ), + }); + return false; + }; + this.currentOrder.is_partial_payment = true + this._isOrderValid(isForceValidate) + await this._finalizeValidation(); + } + await super.validateOrder(isForceValidate); + } + }; + Registries.Component.extend(PaymentScreen, PartialPaymentButtonPaymentScreen); + return PartialPaymentButtonPaymentScreen; +}); diff --git a/pos_partial_payment_odoo/static/src/js/ticket_screen.js b/pos_partial_payment_odoo/static/src/js/ticket_screen.js new file mode 100644 index 000000000..4cf3ef2c1 --- /dev/null +++ b/pos_partial_payment_odoo/static/src/js/ticket_screen.js @@ -0,0 +1,79 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +const { Order } = require('point_of_sale.models'); +import TicketScreen from 'point_of_sale.TicketScreen'; + +patch(TicketScreen.prototype, 'TicketScreen', { + //Create a new filter in POS FRONT END + _getFilterOptions() { + const orderStates = this._getOrderStates(); + orderStates.set('SYNCED', { text: this.env._t('Paid') }); + orderStates.set('PARTIAL', { text: this.env._t('Partial') }); + return orderStates; + }, + //When Selecting Partial Payment Filter Function Works + async _onFilterSelected(event) { + this._state.ui.filter = event.detail.filter; + if (this._state.ui.filter == 'SYNCED') { + await this._fetchSyncedOrders(); + } + if (this._state.ui.filter == 'PARTIAL') { + await this._fetchPartialOrders(); + } + }, + //Search Function Overriding to add functionality Partial + async _onSearch(event) { + Object.assign(this._state.ui.searchDetails, event.detail); + if (this._state.ui.filter == 'SYNCED') { + this._state.syncedOrders.currentPage = 1; + await this._fetchSyncedOrders(); + } + if (this._state.ui.filter == 'PARTIAL') { + this._state.syncedOrders.currentPage = 1; + await this._fetchPartialOrders(); + } + }, + //Fetching Partial Orders + async _fetchPartialOrders() { + const domain = this._computeSyncedOrdersDomain(); + const limit = this._state.syncedOrders.nPerPage; + const offset = (this._state.syncedOrders.currentPage - 1) * this._state.syncedOrders.nPerPage; + const { ids, totalCount } = await this.rpc({ + model: 'pos.order', + method: 'search_partial_order_ids', + kwargs: { config_id: this.env.pos.config.id, domain, limit, offset }, + context: this.env.session.user_context, + }); + const idsNotInCache = ids.filter((id) => !(id in this._state.syncedOrders.cache)); + if (idsNotInCache.length > 0) { + const fetchedOrders = await this.rpc({ + model: 'pos.order', + method: 'export_for_ui', + args: [idsNotInCache], + context: this.env.session.user_context, + }); + // Check for missing products and partners and load them in the PoS + await this.env.pos._loadMissingProducts(fetchedOrders); + await this.env.pos._loadMissingPartners(fetchedOrders); + // Cache these fetched orders so that next time, no need to fetch + // them again, unless invalidated. See `_onInvoiceOrder`. + fetchedOrders.forEach((order) => { + this._state.syncedOrders.cache[order.id] = Order.create({}, { pos: this.env.pos, json: order }); + }); + } + this._state.syncedOrders.totalCount = totalCount; + this._state.syncedOrders.toShow = ids.map((id) => this._state.syncedOrders.cache[id]); + }, + //Adding Functionality POS FILTER to Show in POS FRONTEND + getFilteredOrderList() { + if (this._state.ui.filter == 'PARTIAL') return this._state.syncedOrders.toShow; + return this._super(...arguments); + }, + //Adding Functionality on Selecting Partial Order to be shown on POS FRONTEND + getSelectedSyncedOrder() { + if (this._state.ui.filter == 'PARTIAL') { + return this._state.syncedOrders.cache[this._state.ui.selectedSyncedOrderId]; + } + return this._super(...arguments); + } +}) diff --git a/pos_partial_payment_odoo/static/src/xml/payment_screen.xml b/pos_partial_payment_odoo/static/src/xml/payment_screen.xml new file mode 100644 index 000000000..3b28c2930 --- /dev/null +++ b/pos_partial_payment_odoo/static/src/xml/payment_screen.xml @@ -0,0 +1,23 @@ + + + + + + +
+
+ + Partial Payment +
+
+
+
+ + + PartialPayment + +
+
\ No newline at end of file diff --git a/pos_partial_payment_odoo/views/pos_config_views.xml b/pos_partial_payment_odoo/views/pos_config_views.xml new file mode 100644 index 000000000..9ef147753 --- /dev/null +++ b/pos_partial_payment_odoo/views/pos_config_views.xml @@ -0,0 +1,24 @@ + + + + + pos.config.view.form.inherit.pos.partial.payment.odoo + pos.config + + + +
+
+ +
+
+
+
+
+
+
+
diff --git a/pos_partial_payment_odoo/views/pos_order_views.xml b/pos_partial_payment_odoo/views/pos_order_views.xml new file mode 100644 index 000000000..0dbc5ba6e --- /dev/null +++ b/pos_partial_payment_odoo/views/pos_order_views.xml @@ -0,0 +1,61 @@ + + + + + pos.order.view.form.inherit.pos.partial.payment.odoo + pos.order + + + + + + + + + + + + + + + + + + diff --git a/pos_partial_payment_odoo/views/res_partner_views.xml b/pos_partial_payment_odoo/views/res_partner_views.xml new file mode 100644 index 000000000..de8123694 --- /dev/null +++ b/pos_partial_payment_odoo/views/res_partner_views.xml @@ -0,0 +1,14 @@ + + + + + res.partner.view.form.inherit.pos.partial.payment.odoo + res.partner + + + + + + + +