diff --git a/web_pay_shipping_methods/README.rst b/web_pay_shipping_methods/README.rst new file mode 100644 index 000000000..913e3b56e --- /dev/null +++ b/web_pay_shipping_methods/README.rst @@ -0,0 +1,46 @@ +.. 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 + +Web Pay Shipping Methods +======================== +This Module assists users to set shipping methods for payment acquirers which is selected in website sale. + +Configuration +============= +No additional configuration required + +Company +======= +* `Cybrosys Techno Solutions `__ + +License +======= +GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +======= +* Developer: (V14) RAHUL C 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 https://www.cybrosys.com. + +Further information +=================== +HTML Description: ``__ diff --git a/web_pay_shipping_methods/__init__.py b/web_pay_shipping_methods/__init__.py new file mode 100644 index 000000000..a0deabee8 --- /dev/null +++ b/web_pay_shipping_methods/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# +# 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 controllers +from . import models diff --git a/web_pay_shipping_methods/__manifest__.py b/web_pay_shipping_methods/__manifest__.py new file mode 100644 index 000000000..a6468d567 --- /dev/null +++ b/web_pay_shipping_methods/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# +# 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': "Web Pay Shipping Methods", + 'version': '14.0.1.0.0', + 'category': 'eCommerce', + 'summary': """Select shipping methods based on payment provider.""", + 'description': """The Shipping methods specified for a payment provider + will be only available while selecting a provider in website sale.""", + 'author': "Cybrosys Techno Solutions", + 'company': "Cybrosys Techno Solutions", + 'maintainer': "Cybrosys Techno Solutions", + 'website': "https://www.cybrosys.com", + 'depends': ['website_sale', 'website_sale_delivery', 'payment'], + 'data': [ + 'views/payment_acquirer_views.xml', + 'views/website_sale_delivery.xml', + 'views/assets.xml' + ], + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/web_pay_shipping_methods/controllers/__init__.py b/web_pay_shipping_methods/controllers/__init__.py new file mode 100644 index 000000000..24b24b293 --- /dev/null +++ b/web_pay_shipping_methods/controllers/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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 web_pay_shipping_methods diff --git a/web_pay_shipping_methods/controllers/web_pay_shipping_methods.py b/web_pay_shipping_methods/controllers/web_pay_shipping_methods.py new file mode 100644 index 000000000..f7a4b823b --- /dev/null +++ b/web_pay_shipping_methods/controllers/web_pay_shipping_methods.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# 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 http +from odoo.http import request + + +class PaymentAcquirer(http.Controller): + """Returns the shipping methods when this route is called.""" + + @http.route('/get/shipping/methods', type="json", auth="public", + website=True) + def get_shipping_methods(self, args): + """args: Contains the id of the payment provider selected from website. + Returns the delivery_carrier ids specified inside the payment + provider.""" + return [rec.id for rec in request.env['payment.acquirer'].sudo().browse( + int(args)).delivery_carrier_ids] diff --git a/web_pay_shipping_methods/doc/RELEASE_NOTES.md b/web_pay_shipping_methods/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..d1a7d67c1 --- /dev/null +++ b/web_pay_shipping_methods/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 09.01.2024 +#### Version 14.0.1.0.0 +#### ADD +- Initial commit for Web Pay Shipping Methods diff --git a/web_pay_shipping_methods/models/__init__.py b/web_pay_shipping_methods/models/__init__.py new file mode 100644 index 000000000..22414aec9 --- /dev/null +++ b/web_pay_shipping_methods/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# +# 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 payment_acquirer diff --git a/web_pay_shipping_methods/models/payment_acquirer.py b/web_pay_shipping_methods/models/payment_acquirer.py new file mode 100644 index 000000000..3bbf9a09b --- /dev/null +++ b/web_pay_shipping_methods/models/payment_acquirer.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Rahul CK() +# +# you can modify it under the terms of the GNU AFFERO GENERAL +# PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC +# LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from odoo import api, fields, models + + +class PaymentAcquirer(models.Model): + """Inherited payment_provider to add shipping method field""" + _inherit = 'payment.acquirer' + + delivery_carrier_ids = fields.Many2many('delivery.carrier', + string="Shipping Methods", + domain="[('website_published'," + " '=', True)]", + help="Add shipping methods which " + "will be available while " + "choosing this payment " + "provider") + + @api.model + def get_shipping_methods(self, args): + """Search the delivery carriers defined inside payment provider which + is clicked from website. + :param str args: id of the clicked payment provider + :return: recordset of the delivery carriers. + """ + data = [] + delivery_method_ids =\ + self.sudo().browse(int(args)).delivery_carrier_ids + for rec in delivery_method_ids: + data.append(rec.id) + return data diff --git a/web_pay_shipping_methods/static/description/banner.png b/web_pay_shipping_methods/static/description/banner.png new file mode 100644 index 000000000..4de54b4fc Binary files /dev/null and b/web_pay_shipping_methods/static/description/banner.png differ diff --git a/web_pay_shipping_methods/static/description/cybro_logo.png b/web_pay_shipping_methods/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/web_pay_shipping_methods/static/description/cybro_logo.png differ diff --git a/web_pay_shipping_methods/static/description/icon.png b/web_pay_shipping_methods/static/description/icon.png new file mode 100644 index 000000000..b661b14aa Binary files /dev/null and b/web_pay_shipping_methods/static/description/icon.png differ diff --git a/web_pay_shipping_methods/static/description/images/1.png b/web_pay_shipping_methods/static/description/images/1.png new file mode 100644 index 000000000..549aba8a3 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/1.png differ diff --git a/web_pay_shipping_methods/static/description/images/2.png b/web_pay_shipping_methods/static/description/images/2.png new file mode 100644 index 000000000..4908d554a Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/2.png differ diff --git a/web_pay_shipping_methods/static/description/images/3.png b/web_pay_shipping_methods/static/description/images/3.png new file mode 100644 index 000000000..668fd27bc Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/3.png differ diff --git a/web_pay_shipping_methods/static/description/images/4.png b/web_pay_shipping_methods/static/description/images/4.png new file mode 100644 index 000000000..27eaa610d Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/4.png differ diff --git a/web_pay_shipping_methods/static/description/images/5.png b/web_pay_shipping_methods/static/description/images/5.png new file mode 100644 index 000000000..5c95f7742 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/5.png differ diff --git a/web_pay_shipping_methods/static/description/images/6.png b/web_pay_shipping_methods/static/description/images/6.png new file mode 100644 index 000000000..0cfb293ec Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/6.png differ diff --git a/web_pay_shipping_methods/static/description/images/checked.png b/web_pay_shipping_methods/static/description/images/checked.png new file mode 100644 index 000000000..578cedb80 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/checked.png differ diff --git a/web_pay_shipping_methods/static/description/images/cybrosys.png b/web_pay_shipping_methods/static/description/images/cybrosys.png new file mode 100644 index 000000000..d76b5bafb Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/cybrosys.png differ diff --git a/web_pay_shipping_methods/static/description/images/hero.gif b/web_pay_shipping_methods/static/description/images/hero.gif new file mode 100644 index 000000000..b45f73580 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/hero.gif differ diff --git a/web_pay_shipping_methods/static/description/images/image_1.png b/web_pay_shipping_methods/static/description/images/image_1.png new file mode 100644 index 000000000..fc3ddb622 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/image_1.png differ diff --git a/web_pay_shipping_methods/static/description/images/image_2.png b/web_pay_shipping_methods/static/description/images/image_2.png new file mode 100644 index 000000000..1de8fb93f Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/image_2.png differ diff --git a/web_pay_shipping_methods/static/description/images/image_3.png b/web_pay_shipping_methods/static/description/images/image_3.png new file mode 100644 index 000000000..42b408512 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/image_3.png differ diff --git a/web_pay_shipping_methods/static/description/images/image_4.png b/web_pay_shipping_methods/static/description/images/image_4.png new file mode 100644 index 000000000..684b02bd8 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/image_4.png differ diff --git a/web_pay_shipping_methods/static/description/images/image_5.png b/web_pay_shipping_methods/static/description/images/image_5.png new file mode 100644 index 000000000..d6051ae53 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/image_5.png differ diff --git a/web_pay_shipping_methods/static/description/images/screenshot.zip b/web_pay_shipping_methods/static/description/images/screenshot.zip new file mode 100644 index 000000000..5afba6ad6 Binary files /dev/null and b/web_pay_shipping_methods/static/description/images/screenshot.zip differ diff --git a/web_pay_shipping_methods/static/description/index.html b/web_pay_shipping_methods/static/description/index.html new file mode 100644 index 000000000..9d40dbdd0 --- /dev/null +++ b/web_pay_shipping_methods/static/description/index.html @@ -0,0 +1,454 @@ +
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+ +
+
+
+

+ Web Pay Shipping Methods

+

+ Select Shipping Methods Based On Payment Acquirer +

+ +
+
+ + + +
+
+

+ Overview +

+
+ +
+

+ This Module assists users to set shipping methods for payment providers which is selected in website sale.

+
+ +
+
+
+

+ Features +

+
+ +
+
+

+ Community & Enterprise Support

+

+ Available in Odoo 14.0 Community and Enterprise.

+
+
+
+
+
+ Select shipping methods based on payment provider. +

+ Email address of partners in odoo will remain valid and maintain reliability in address details.

+

+ Can configure the shipping methods such that it can be selected only with certain payment providers.

+

+ Shipping methods of payment providers will be listed while we select the payment provider in website.

+
+
+ +
+
+

+ Screenshots +

+
+
+

Payment Acquirer

+ +
+ +
+

+ A new field is added in payment acquirer form to choose the shipping methods. +

+ +
+ +
+

+ Website payment page +

+ +
+ +
+

+ Shipping methods specified inside payment acquirers will be listed when an acquirer is selected. +

+ +
+ +
+

+ The selected shipping method is updated in the corresponding sale order. +

+ +
+ +
+ +
+
+

Suggested Products

+
+ + +
+
+ + + +
+

Our Service

+
+ +
+
+
+

Our Industries

+
+ +
+
+
+ +
+
+

Trading

+

Easily procure and sell your products.

+
+
+
+
+ +
+
+

Manufacturing

+

Plan, track and schedule your operations.

+
+
+
+
+ +
+
+

Restaurant

+

Run your bar or restaurant methodical.

+
+
+
+
+ +
+
+

POS

+

Easy configuring and convivial selling.

+
+
+
+
+ +
+
+

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages.

+
+
+
+
+ +
+
+

Hotel Management

+

An all-inclusive hotel management application.

+
+
+
+
+ +
+
+

Education

+

A Collaborative platform for educational management.

+
+
+
+
+ +
+
+

Service Management

+

Keep track of services and invoice accordingly.

+
+
+
+
+
+
+
+
+

Need Any Help?

+
+

If you have anything to share with us based on your use of this module, please let us know. We are ready to offer our support.

+
+

Email us

+

odoo@cybrosys.com

+
+
+

Contact Us

+ www.cybrosys.com +
+
+
+
+
+
+
+
+
+ +
+ + + +
+
+
+
+
\ No newline at end of file diff --git a/web_pay_shipping_methods/static/src/js/payment_form.js b/web_pay_shipping_methods/static/src/js/payment_form.js new file mode 100644 index 000000000..3a4979ce8 --- /dev/null +++ b/web_pay_shipping_methods/static/src/js/payment_form.js @@ -0,0 +1,73 @@ +odoo.define('web_pay_shipping_methods.payment_form_inherit', function (require) { +"use strict"; + + var PaymentForm = require('payment.payment_form'); + var ajax = require('web.ajax'); + var Dialog = require('web.Dialog'); + var core = require('web.core'); + var qweb = core.qweb; + var _t = core._t; + + PaymentForm.include({ + /** + * Function executes when payment provider is clicked and it checks if there are + * any shipping methods specified inside the payment provider to list them + * in website after the payment provider. + * + * @param {Object} ev Contains details about the payment provider. + */ + radioClickEvent: async function (ev) { + await this._super(...arguments); + var self = this; + this.dialogShown = false; + var delivery_method_div = this.$el[0]?.parentElement?.nextElementSibling; + var check_carrier = false + const pay_option_input = ev.currentTarget?.childNodes[1]?.children[0]; + await ajax.jsonRpc('/get/shipping/methods', 'call', { + 'args' : pay_option_input.dataset.acquirerId + }) + .then(function (data) { + var delivery_select_text = delivery_method_div.children[0]; + var delivery_method_card = delivery_method_div.children[1]; + if(delivery_method_card){ + var delivery_methods = delivery_method_card.children[0].children; + for(var delivery_index = 0; delivery_index < delivery_methods.length; delivery_index++){ + if(data == false){ + delivery_methods[delivery_index].style.display = 'none'; + delivery_select_text.style.display = 'none'; + } + for(let data_index = 0; data_index" + "No shipping methods available for this payment option" + "

" , + buttons: [ + { + text: _t("Close"), + close: true, + }, + ], + }).open(); + } + pay_option_input.checked = false; + } + }, + }); +}); diff --git a/web_pay_shipping_methods/views/assets.xml b/web_pay_shipping_methods/views/assets.xml new file mode 100644 index 000000000..60c488bd2 --- /dev/null +++ b/web_pay_shipping_methods/views/assets.xml @@ -0,0 +1,9 @@ + + + +