diff --git a/pos_partial_payment_odoo/README.rst b/pos_partial_payment_odoo/README.rst new file mode 100755 index 000000000..87dabe0c7 --- /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:(V17) Ahammed Harshad P, 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..a61567d1c --- /dev/null +++ b/pos_partial_payment_odoo/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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..658547266 --- /dev/null +++ b/pos_partial_payment_odoo/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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': '17.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': [ + '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..ac961ad72 --- /dev/null +++ b/pos_partial_payment_odoo/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 13.06.2024 +#### Version 17.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..d7c8ecb39 --- /dev/null +++ b/pos_partial_payment_odoo/models/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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..9a8c0edf1 --- /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) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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..1e3aa5c13 --- /dev/null +++ b/pos_partial_payment_odoo/models/pos_config.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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..821761a0e --- /dev/null +++ b/pos_partial_payment_odoo/models/pos_order.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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..9e98f8ea1 --- /dev/null +++ b/pos_partial_payment_odoo/models/pos_session.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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..d74c2f745 --- /dev/null +++ b/pos_partial_payment_odoo/models/res_partner.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Ahammed Harshad (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="Don't 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/capture (1).png b/pos_partial_payment_odoo/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/capture (1).png differ 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/img.png b/pos_partial_payment_odoo/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/img.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/photo-capture.png b/pos_partial_payment_odoo/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/icons/photo-capture.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/Cybrosys R.png b/pos_partial_payment_odoo/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/misc/Cybrosys R.png differ diff --git a/pos_partial_payment_odoo/static/description/assets/misc/email.svg b/pos_partial_payment_odoo/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/phone.svg b/pos_partial_payment_odoo/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/star (1) 2.svg b/pos_partial_payment_odoo/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/support (1) 1.svg b/pos_partial_payment_odoo/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/support-email.svg b/pos_partial_payment_odoo/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/tick-mark.svg b/pos_partial_payment_odoo/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/whatsapp 1.svg b/pos_partial_payment_odoo/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/pos_partial_payment_odoo/static/description/assets/misc/whatsapp.svg b/pos_partial_payment_odoo/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/pos_partial_payment_odoo/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/1.png b/pos_partial_payment_odoo/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..4867c6181 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..6315d04da 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..8f6c36337 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..3ac7aa548 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..7523d5f31 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..bbcd3e06b 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..709a641e7 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/hero.gif b/pos_partial_payment_odoo/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..2866539e0 Binary files /dev/null and b/pos_partial_payment_odoo/static/description/assets/screenshots/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..20cf2561d 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..fa2b95b3d 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..183765fbf --- /dev/null +++ b/pos_partial_payment_odoo/static/description/index.html @@ -0,0 +1,629 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ POS Partial Payment

+

+ A Module For Configuring Partial Payment In POS. +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Enables Partial Payment

+

Enables sellers to allow partial payment in POS for customers. +

+
+
+
+
+
+
+ +
+
+

Register Payment in Backend

+

Register payments for the invoice from Odoo backend. +

+
+
+
+
+
+
+ +
+
+

Partial Payment On Wish

+

Set partial payment option as per your wish. +

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

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

+
+
+
+
+
+
+ +
+
+

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

+
+
+
+
+
+
+ +
+
+

+ 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

+
+
+
+
+
+
+
    +
  • + Available in Odoo 17.0 Community and Enterprise. +
  • +
  • + Manage Partial Payments. +
  • +
  • + Manage Payments in Backend. +
  • +
  • + Manage Partially paid list view. +
  • +
  • + Invoices partial paid orders. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:20st May 2024 +
+

+ + Initial Commit for POS Partial Payment.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

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

Odoo Customization

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

Odoo Implementation

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

Odoo Support

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

Hire Odoo Developer

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

Odoo Integration

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

Odoo Migration

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

Odoo Consultancy

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

Odoo Implementation

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

Odoo Licensing Consultancy

+
+
+
+
+
+
+

Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

Education

+

A platform for educational management

+
+
+
+
+ +

Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service Management

+

Keep track of services and invoice

+
+
+
+
+ +

Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to us on WhatsApp!

+
+91 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/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..6485a509a --- /dev/null +++ b/pos_partial_payment_odoo/static/src/js/models.js @@ -0,0 +1,25 @@ +/** @odoo-module **/ +import { Order } from "@point_of_sale/app/store/models"; +import { patch } from "@web/core/utils/patch"; + +// Define the Partial class +patch(Order.prototype, { + constructor() { + this.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; + } +}); 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..968353cc7 --- /dev/null +++ b/pos_partial_payment_odoo/static/src/js/payment_screen.js @@ -0,0 +1,68 @@ +/** @odoo-module **/ + +import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup"; +import { patch } from "@web/core/utils/patch"; +import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen"; +import { _t } from "@web/core/l10n/translation"; +import { useRef } from "@odoo/owl"; + +// patch the PaymentScreen class +patch(PaymentScreen.prototype, { + setup() { + super.setup(...arguments); + this.root = useRef('PartialPayment'); + }, + //Partial Payment Button Functionality + PartialPaymentButton() { + if (!this.currentOrder.get_partner()) { + this.env.services.popup.add(ErrorPopup, { + title: _t("No partner selected"), + body: _t("Please select partner."), + }); + return false; + }; + if (this.currentOrder.partial_payment === true) { + this.currentOrder.partial_payment = false; + var validate = this.root.el + validate.classList.add('disabled'); + } else if(this.currentOrder.get_partner()){ + this.currentOrder.partial_payment = true; + var validate = this.root.el + validate.classList.remove('disabled'); + } + }, + //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.env.services.popup.add(ErrorPopup, { + title: _t("Partial Payment Not Allowed"), + body: _t("The Customer is not allowed to make Partial Payments."), + }); + return false; + }; + //If Invoice not Selected Show Error + if(!this.currentOrder.to_invoice){ + this.env.services.popup.add(ErrorPopup, { + title: _t("Cannot Validate This Order"), + body: _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.env.services.popup.add(ErrorPopup, { + title: _t("Cannot Validate This Order"), + body: _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(); + } + } +}); 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..747433bf8 --- /dev/null +++ b/pos_partial_payment_odoo/static/src/js/ticket_screen.js @@ -0,0 +1,89 @@ +/** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { _t } from "@web/core/l10n/translation"; +import { deserializeDateTime, formatDateTime } from "@web/core/l10n/dates"; +import { Order } from "@point_of_sale/app/store/models"; +import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen"; + +const { DateTime } = luxon; + +patch(TicketScreen.prototype, { + //Create a new filter in POS FRONT END + _getFilterOptions() { + const orderStates = this._getOrderStates(); + orderStates.set('SYNCED', { text: _t('Paid') }); + orderStates.set('PARTIAL', { text: _t('Partial') }); + return orderStates; + }, + //When Selecting Partial Payment Filter Function Works + async onFilterSelected(selectedFilter) { + this._state.ui.filter = selectedFilter; + if (this._state.ui.filter == 'PARTIAL') { + await this._fetchPartialOrders(); + } + else { + super.onFilterSelected(selectedFilter); + } + }, + //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 config_id = this.pos.config.id; + const { ids, totalCount } = await this.orm.call( + "pos.order", + "search_partial_order_ids", + [], + { config_id, domain, limit, offset } + ); + const idsNotInCache = ids.filter((id) => !(id in this._state.syncedOrders.cache)); + const cacheDate = this._state.syncedOrders.cacheDate || DateTime.fromMillis(0); + const idsNotUpToDate = ids.filter((orderInfo) => { + return deserializeDateTime(orderInfo[1]) > cacheDate; + }); + const idsToLoad = idsNotInCache.concat(idsNotUpToDate).map((info) => info[0]); + if (idsNotInCache.length > 0) { + const fetchedOrders = await this.orm.call("pos.order", "export_for_ui", [idsNotInCache]); + // Check for missing products and partners and load them in the PoS + await this.pos._loadMissingProducts(fetchedOrders); + await this.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] = new Order( + { env: this.env }, + { pos: this.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 super.getFilteredOrderList(); + }, + //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]; + }else{ + return super.getSelectedSyncedOrder(); + } + } +}) 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..b937167df --- /dev/null +++ b/pos_partial_payment_odoo/static/src/xml/payment_screen.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + PartialPayment + + + 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..c03754deb --- /dev/null +++ b/pos_partial_payment_odoo/views/pos_config_views.xml @@ -0,0 +1,16 @@ + + + + + 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..456a45c1e --- /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 + + + + + + + +