@ -0,0 +1,47 @@ |
|||
.. 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 |
|||
|
|||
Website Product Multi Uom |
|||
========================= |
|||
Select the Product's UOM before adding to Cart. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License v3.0 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V17) Anfas Faisal K @cybrosys, 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 <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import controllers |
|||
from . import models |
@ -0,0 +1,55 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': 'Website Product Multi Uom', |
|||
'version': '17.0.1.0.0', |
|||
'category': 'Website', |
|||
'summary': 'Select the Products UOM before adding to Cart', |
|||
'description': 'This module allows customers to select the preferred ' |
|||
'Unit of Measure (UOM) for products directly from the ' |
|||
'website before adding them to the cart. It provides a ' |
|||
'dropdown button for changing the UOM, similar to the ' |
|||
'pricelist dropdown, ensuring that the product price ' |
|||
'updates accordingly based on the selected UOM. This ' |
|||
'customization enhances the shopping experience by giving ' |
|||
'customers the flexibility to choose product quantities ' |
|||
'that best suit their needs.', |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['website_sale', 'uom', 'website_sale_product_configurator'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/website_sale_templates.xml', |
|||
], |
|||
'assets': { |
|||
'web.assets_frontend': [ |
|||
"/website_product_uom_multi/static/src/js/uom_button.js", |
|||
], |
|||
}, |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import website_sale |
|||
from . import variant |
|||
from . import product_configurator |
@ -0,0 +1,100 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
from odoo.addons.website_sale_product_configurator.controllers.main import \ |
|||
WebsiteSaleProductConfiguratorController |
|||
|
|||
|
|||
class WebsiteProductVariant(WebsiteSaleProductConfiguratorController): |
|||
""" |
|||
This class extends the WebsiteVariantSale controller to handle the submission |
|||
of optional product modals, ensuring that the Unit of Measure (UOM) is included |
|||
in the cart update operations. |
|||
""" |
|||
@http.route( |
|||
'/sale_product_configurator/show_advanced_configurator', |
|||
type='json', auth='public', methods=['POST'], website=True, |
|||
) |
|||
def show_advanced_configurator( |
|||
self, product_id, variant_values, add_qty=1, |
|||
force_dialog=False, |
|||
**kw, |
|||
): |
|||
""" |
|||
This method handles the request to display the advanced product |
|||
configurator, which allows users to configure product variants and |
|||
optional products. It checks if there are any optional products |
|||
that can be added to the cart, and if the product has variants |
|||
or is already configured. |
|||
""" |
|||
product = request.env['product.product'].browse(int(product_id)) |
|||
product_template = product.product_tmpl_id |
|||
combination = request.env['product.template.attribute.value'].browse( |
|||
variant_values) |
|||
has_optional_products = product.optional_product_ids.filtered( |
|||
lambda p: p._is_add_to_cart_possible(combination) |
|||
and ( |
|||
not request.website.prevent_zero_price_sale or p._get_contextual_price()) |
|||
) |
|||
already_configured = bool(combination) |
|||
if not force_dialog and not has_optional_products and ( |
|||
product.product_variant_count <= 1 or already_configured |
|||
): |
|||
# The modal is not shown if there are no optional products and |
|||
# the main product either has no variants or is already configured |
|||
return False |
|||
|
|||
add_qty = float(add_qty) |
|||
combination_info = product_template._get_combination_info( |
|||
combination=combination, |
|||
product_id=product.id, |
|||
add_qty=add_qty, |
|||
) |
|||
uom_id_session = request.session['uom_id'] |
|||
|
|||
if uom_id_session: |
|||
uom_id = request.env['uom.uom'].browse(int(uom_id_session)) |
|||
product = request.env['product.product'].sudo().browse(product_id) |
|||
default_uom_qty = uom_id._compute_quantity(1, product.uom_id) |
|||
updated_price = combination_info['list_price'] * default_uom_qty |
|||
combination_info.update({'price': updated_price}) |
|||
|
|||
return request.env['ir.ui.view']._render_template( |
|||
'website_sale_product_configurator.optional_products_modal', |
|||
{ |
|||
'product': product, |
|||
'product_template': product_template, |
|||
'combination': combination, |
|||
'combination_info': combination_info, |
|||
'add_qty': add_qty, |
|||
'parent_name': product.name, |
|||
'variant_values': variant_values, |
|||
'already_configured': already_configured, |
|||
'mode': kw.get('mode', 'add'), |
|||
'product_custom_attribute_values': kw.get( |
|||
'product_custom_attribute_values', None), |
|||
'no_attribute': kw.get('no_attribute', False), |
|||
'custom_attribute': kw.get('custom_attribute', False), |
|||
} |
|||
) |
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
from odoo.addons.website_sale.controllers.variant import \ |
|||
WebsiteSaleVariantController |
|||
|
|||
|
|||
class Vairant(WebsiteSaleVariantController): |
|||
@http.route('/website_sale/get_combination_info', type='json', |
|||
auth='public', |
|||
methods=['POST'], website=True) |
|||
def get_combination_info_website( |
|||
self, product_template_id, product_id, combination, add_qty, |
|||
uom=False, |
|||
parent_combination=None, |
|||
**kwargs |
|||
): |
|||
res = super( |
|||
Vairant, self).get_combination_info_website( |
|||
product_template_id=product_template_id, product_id=product_id, |
|||
combination=combination, add_qty=add_qty, |
|||
uom=uom, parent_combination=parent_combination, **kwargs) |
|||
request.session['uom_id'] = uom |
|||
if uom: |
|||
uom_id = request.env['uom.uom'].browse(int(uom)) |
|||
product = request.env['product.product'].sudo().browse(product_id) |
|||
default_uom_qty = uom_id._compute_quantity(add_qty, product.uom_id) |
|||
updated_price = res['list_price'] * default_uom_qty |
|||
res.update({'price': updated_price}) |
|||
return res |
@ -0,0 +1,206 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
import json |
|||
import logging |
|||
|
|||
from odoo import fields, http |
|||
from odoo.http import request |
|||
from odoo.tools.json import scriptsafe as json_scriptsafe |
|||
from odoo.addons.payment import utils as payment_utils |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
from odoo.addons.website_sale.controllers.main import WebsiteSale |
|||
from odoo.addons.website_sale_product_configurator.controllers.website_sale import \ |
|||
WebsiteSale as WebsiteVariantSale |
|||
|
|||
|
|||
class WebsiteProductUom(WebsiteSale): |
|||
""" |
|||
This class extends the WebsiteSale controller to include Unit of Measure |
|||
(UOM) in the shopping cart update operations. It overrides the |
|||
cart_update_json route to handle UOM-specific updates. |
|||
""" |
|||
|
|||
@http.route(['/shop/cart/update_json'], type='json', auth="public", |
|||
methods=['POST'], website=True, csrf=False) |
|||
def cart_update_json( |
|||
self, product_id, line_id=None, add_qty=None, set_qty=None, |
|||
display=True, |
|||
product_custom_attribute_values=None, |
|||
no_variant_attribute_values=None, uom_id=None, **kw |
|||
): |
|||
|
|||
""" |
|||
This route is called : |
|||
- When changing quantity from the cart. |
|||
- When adding a product from the wishlist. |
|||
- When adding a product to cart on the same page (without redirection). |
|||
""" |
|||
order = request.website.sale_get_order(force_create=True) |
|||
|
|||
if order.state != 'draft': |
|||
request.website.sale_reset() |
|||
if kw.get('force_create'): |
|||
order = request.website.sale_get_order(force_create=True) |
|||
else: |
|||
return {} |
|||
|
|||
if product_custom_attribute_values: |
|||
product_custom_attribute_values = json_scriptsafe.loads( |
|||
product_custom_attribute_values) |
|||
|
|||
if no_variant_attribute_values: |
|||
no_variant_attribute_values = json_scriptsafe.loads( |
|||
no_variant_attribute_values) |
|||
|
|||
values = order._cart_update( |
|||
product_id=product_id, |
|||
line_id=line_id, |
|||
add_qty=add_qty, |
|||
set_qty=set_qty, |
|||
product_custom_attribute_values=product_custom_attribute_values, |
|||
no_variant_attribute_values=no_variant_attribute_values, |
|||
uom=uom_id, |
|||
**kw |
|||
) |
|||
|
|||
values['notification_info'] = self._get_cart_notification_information( |
|||
order, [values['line_id']]) |
|||
values['notification_info']['warning'] = values.pop('warning', '') |
|||
request.session['website_sale_cart_quantity'] = order.cart_quantity |
|||
|
|||
if not order.cart_quantity: |
|||
request.website.sale_reset() |
|||
return values |
|||
|
|||
values['cart_quantity'] = order.cart_quantity |
|||
values['minor_amount'] = payment_utils.to_minor_currency_units( |
|||
order.amount_total, order.currency_id |
|||
), |
|||
values['amount'] = order.amount_total |
|||
|
|||
if not display: |
|||
return values |
|||
|
|||
values['cart_ready'] = order._is_cart_ready() |
|||
values['website_sale.cart_lines'] = request.env[ |
|||
'ir.ui.view']._render_template( |
|||
"website_sale.cart_lines", { |
|||
'website_sale_order': order, |
|||
'date': fields.Date.today(), |
|||
'suggested_products': order._cart_accessories() |
|||
} |
|||
) |
|||
values['website_sale.total'] = request.env[ |
|||
'ir.ui.view']._render_template( |
|||
"website_sale.total", { |
|||
'website_sale_order': order, |
|||
} |
|||
) |
|||
return values |
|||
|
|||
|
|||
class WebsiteProductVariant(WebsiteVariantSale): |
|||
""" |
|||
This class extends the WebsiteVariantSale controller to handle the submission |
|||
of optional product modals, ensuring that the Unit of Measure (UOM) is included |
|||
in the cart update operations. |
|||
""" |
|||
|
|||
@http.route( |
|||
'/shop/cart/update_option', |
|||
type='json', |
|||
auth='public', |
|||
methods=['POST'], |
|||
website=True, |
|||
multilang=False, |
|||
) |
|||
def cart_options_update_json(self, product_and_options, lang=None, |
|||
**kwargs): |
|||
"""This route is called when submitting the optional product modal. |
|||
The product without parent is the main product, the other are options. |
|||
Options need to be linked to their parents with a unique ID. |
|||
The main product is the first product in the list and the options |
|||
need to be right after their parent. |
|||
product_and_options { |
|||
'product_id', |
|||
'product_template_id', |
|||
'quantity', |
|||
'parent_unique_id', |
|||
'unique_id', |
|||
'product_custom_attribute_values', |
|||
'no_variant_attribute_values' |
|||
} |
|||
""" |
|||
if lang: |
|||
request.website = request.website.with_context(lang=lang) |
|||
|
|||
order = request.website.sale_get_order(force_create=True) |
|||
if order.state != 'draft': |
|||
request.session['sale_order_id'] = None |
|||
order = request.website.sale_get_order(force_create=True) |
|||
|
|||
product_and_options = json.loads(product_and_options) |
|||
if product_and_options: |
|||
# The main product is the first, optional products are the rest |
|||
main_product = product_and_options[0] |
|||
values = order._cart_update( |
|||
product_id=main_product['product_id'], |
|||
add_qty=main_product['quantity'], |
|||
product_custom_attribute_values=main_product[ |
|||
'product_custom_attribute_values'], |
|||
no_variant_attribute_values=main_product[ |
|||
'no_variant_attribute_values'], |
|||
uom=main_product['uom_id'], |
|||
**kwargs |
|||
) |
|||
|
|||
line_ids = [values['line_id']] |
|||
|
|||
if values['line_id']: |
|||
# Link option with its parent iff line has been created. |
|||
option_parent = {main_product['unique_id']: values['line_id']} |
|||
for option in product_and_options[1:]: |
|||
parent_unique_id = option['parent_unique_id'] |
|||
option_values = order._cart_update( |
|||
product_id=option['product_id'], |
|||
set_qty=option['quantity'], |
|||
linked_line_id=option_parent[parent_unique_id], |
|||
product_custom_attribute_values=option[ |
|||
'product_custom_attribute_values'], |
|||
no_variant_attribute_values=option[ |
|||
'no_variant_attribute_values'], |
|||
**kwargs |
|||
) |
|||
option_parent[option['unique_id']] = option_values[ |
|||
'line_id'] |
|||
line_ids.append(option_values['line_id']) |
|||
|
|||
values[ |
|||
'notification_info'] = self._get_cart_notification_information( |
|||
order, line_ids) |
|||
|
|||
values['cart_quantity'] = order.cart_quantity |
|||
request.session['website_sale_cart_quantity'] = order.cart_quantity |
|||
|
|||
return values |
@ -0,0 +1,7 @@ |
|||
## Module <website_product_uom_multi> |
|||
|
|||
#### 04.07.2024 |
|||
#### Version 17.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial Commit for Website Product Multi Uom |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import product_template |
|||
from . import sale_order |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, models |
|||
from odoo.http import request |
|||
|
|||
|
|||
class ProductProduct(models.Model): |
|||
""" |
|||
Inherits the product.template model to extend its functionality. |
|||
""" |
|||
_inherit = 'product.template' |
|||
|
|||
@api.model |
|||
def _get_contextual_price(self, product=None): |
|||
""" |
|||
Get the contextual price of a product based on the current pricelist, |
|||
quantity, unit of measure (UOM), and date. If the UOM is not specified |
|||
in the context, it checks the session for a UOM ID. |
|||
""" |
|||
self.ensure_one() |
|||
pricelist = self._get_contextual_pricelist() |
|||
quantity = self.env.context.get('quantity', 1.0) |
|||
uom_id = self.env.context.get('uom') |
|||
# Check if uom_id is available in the session |
|||
if not uom_id and request.session.get('uom_id'): |
|||
uom_id = request.session['uom_id'] |
|||
date = self.env.context.get('date') |
|||
uom = self.env['uom.uom'].browse(uom_id) if uom_id else self.uom_id |
|||
return pricelist._get_product_price(product or self, quantity, uom=uom, |
|||
date=date) |
@ -0,0 +1,142 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import models, _ |
|||
from odoo.exceptions import UserError |
|||
from odoo.http import request |
|||
|
|||
|
|||
class SaleOrder(models.Model): |
|||
""" |
|||
Inherits the sale.order model to extend its functionality. |
|||
""" |
|||
_inherit = 'sale.order' |
|||
|
|||
def _cart_update(self, product_id, line_id=None, add_qty=0, set_qty=0, |
|||
uom=None, **kwargs): |
|||
""" Add or set product quantity, add_qty can be negative """ |
|||
self.ensure_one() |
|||
self = self.with_company(self.company_id) |
|||
|
|||
if self.state != 'draft': |
|||
request.session.pop('sale_order_id', None) |
|||
request.session.pop('website_sale_cart_quantity', None) |
|||
raise UserError( |
|||
_('It is forbidden to modify a sales order which is not in draft status.')) |
|||
|
|||
product = self.env['product.product'].browse(product_id).exists() |
|||
uom_id = self.env['uom.uom'].browse(uom) |
|||
if add_qty and (not product or not product._is_add_to_cart_allowed()): |
|||
raise UserError( |
|||
_("The given product does not exist therefore it cannot be added to cart.")) |
|||
|
|||
if line_id is not False: |
|||
order_line = self._cart_find_product_line(product_id, line_id, |
|||
**kwargs)[:1] |
|||
if uom_id : |
|||
order_line_ids = order_line.order_id.order_line |
|||
current_product_ids = order_line_ids.filtered(lambda l: l.product_id.id == product_id) |
|||
if current_product_ids: |
|||
order_line = current_product_ids.filtered(lambda n: n.product_uom.id == uom_id.id) |
|||
|
|||
else: |
|||
order_line = self.env['sale.order.line'] |
|||
|
|||
try: |
|||
if add_qty: |
|||
add_qty = int(add_qty) |
|||
except ValueError: |
|||
add_qty = 1 |
|||
|
|||
try: |
|||
if set_qty: |
|||
set_qty = int(set_qty) |
|||
except ValueError: |
|||
set_qty = 0 |
|||
|
|||
quantity = 0 |
|||
if set_qty: |
|||
quantity = set_qty |
|||
elif add_qty is not None: |
|||
if order_line: |
|||
quantity = order_line.product_uom_qty + (add_qty or 0) |
|||
else: |
|||
quantity = add_qty or 0 |
|||
|
|||
if quantity > 0: |
|||
quantity, warning = self._verify_updated_quantity( |
|||
order_line, |
|||
product_id, |
|||
quantity, |
|||
**kwargs, |
|||
) |
|||
else: |
|||
# If the line will be removed anyway, there is no need to verify |
|||
# the requested quantity update. |
|||
warning = '' |
|||
|
|||
self._remove_delivery_line() |
|||
|
|||
order_line = self._cart_update_order_line(product_id, quantity, |
|||
order_line,uom_id, **kwargs) |
|||
|
|||
if ( |
|||
order_line |
|||
and order_line.price_unit == 0 |
|||
and self.website_id.prevent_zero_price_sale |
|||
and product.detailed_type not in self.env[ |
|||
'product.template']._get_product_types_allow_zero_price() |
|||
): |
|||
raise UserError(_( |
|||
"The given product does not have a price therefore it cannot be added to cart.", |
|||
)) |
|||
|
|||
return { |
|||
'line_id': order_line.id, |
|||
'quantity': quantity, |
|||
'option_ids': list(set(order_line.option_line_ids.filtered( |
|||
lambda l: l.order_id == order_line.order_id).ids)), |
|||
'warning': warning, |
|||
} |
|||
|
|||
|
|||
def _cart_update_order_line(self, product_id, quantity, order_line, uom_id, **kwargs): |
|||
""" |
|||
Update the order line in the cart based on the given product, |
|||
quantity, and UOM. |
|||
""" |
|||
self.ensure_one() |
|||
if order_line and quantity <= 0: |
|||
# Remove zero or negative lines |
|||
order_line.unlink() |
|||
order_line = self.env['sale.order.line'] |
|||
elif order_line: |
|||
# Update existing line |
|||
update_values = self._prepare_order_line_update_values(order_line, quantity, **kwargs) |
|||
if update_values: |
|||
self._update_cart_line_values(order_line, update_values) |
|||
elif quantity > 0: |
|||
# Create new line |
|||
order_line_values = self._prepare_order_line_values(product_id, quantity, **kwargs) |
|||
if uom_id: |
|||
order_line_values['product_uom'] = uom_id.id |
|||
order_line = self.env['sale.order.line'].sudo().create(order_line_values) |
|||
return order_line |
|
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 186 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 284 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 7.7 KiB |
@ -0,0 +1,680 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
|
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Odoo App 3 Index</title> |
|||
<!-- Bootstrap CSS --> |
|||
<link rel="stylesheet" |
|||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" |
|||
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" |
|||
crossorigin="anonymous"> |
|||
<link rel="stylesheet" |
|||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"> |
|||
<link rel="preconnect" href="https://fonts.googleapis.com"> |
|||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
|||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" |
|||
rel="stylesheet"> |
|||
</head> |
|||
<body> |
|||
<section> |
|||
<div class="container" |
|||
style="font-family: 'Inter', sans-serif !important;background-color: #fff !important;"> |
|||
<div class="row"> |
|||
<div class="col-sm-12 col-md-12 col-lg-12 d-flex justify-content-between flex-wrap align-items-sm-center" |
|||
style="border-bottom:1px solid rgba(0, 0, 0, 0.22)"> |
|||
<div class="my-3"> |
|||
<img src="assets/misc/Cybrosys_new.png" |
|||
style="width:auto !important; height:40px !important"> |
|||
</div> |
|||
<div class="my-3 d-flex align-items-center"> |
|||
<div class="text-center" |
|||
style="background-color:#017E84 !important;font-size: 0.8rem !important; color:#fff !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width: 120px !important;"> |
|||
Community |
|||
</div> |
|||
<div class="text-center" |
|||
style="background-color:#875A7B !important; color:#fff !important;font-size: 0.8rem !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important;min-width: 120px !important;"> |
|||
Enterprise |
|||
</div> |
|||
<div class="text-center" |
|||
style="background-color:#7C7BAD !important; color:#fff !important;font-size: 0.8rem !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width: 120px !important;"> |
|||
Odoo.sh |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-sm-12 col-md-12 col-lg-12 text-center d-flex align-items-center flex-column" |
|||
style="margin: 80px 0px !important;"> |
|||
<h1 style="font-size: 2.8rem;font-weight: 700; color: |
|||
#1A202C;"> |
|||
Website Product Multi UOM </h1> |
|||
<p class="my-3 mb-4" |
|||
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;"> |
|||
Select the Product's UOM before adding to Cart |
|||
</p> |
|||
<div style="width: 80%; margin-top: 3rem;"> |
|||
<img src="assets/screenshots/hero-v17.gif" |
|||
class="img-responsive" width="100%" height="auto"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="container mt-5 mb-5"> |
|||
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4"> |
|||
<p class="m-0" |
|||
style="font-weight: 600; font-size: 24px; color:#714b67 !important"> |
|||
Key Highlights |
|||
</p> |
|||
</div> |
|||
<div class="row py-4"> |
|||
<div class="col-md-6 col-sm-12 p-3"> |
|||
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px; |
|||
background: #FFF; |
|||
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); "> |
|||
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67; |
|||
display: flex; justify-content: center; align-items: center; |
|||
margin-right: 10px; flex-shrink: 0;"> |
|||
<i class="fa-solid fa-star " |
|||
style="color: #fff;font-size:14px;"></i> |
|||
</div> |
|||
<div> |
|||
<p style="color: #1A202C;font-weight: 600; |
|||
font-size: 1.2rem; margin-bottom: 2px;"> |
|||
Flexible UOM Selection in Website </div> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-6 col-sm-12 p-3"> |
|||
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px; |
|||
background: #FFF; |
|||
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); "> |
|||
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67; |
|||
display: flex; justify-content: center; align-items: center; |
|||
margin-right: 10px; flex-shrink: 0;"> |
|||
<i class="fa-solid fa-star " |
|||
style="color: #fff;font-size:14px;"></i> |
|||
</div> |
|||
<div> |
|||
<p style="color: #1A202C;font-weight: 600; |
|||
font-size: 1.2rem; margin-bottom: 2px;"> |
|||
Real Time Price Updates .</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-6 col-sm-12 p-3"> |
|||
<div class="d-flex h-100" style="padding: 30px;border-radius: 12px; |
|||
background: #FFF; |
|||
box-shadow: 1px 2px 3px 0px rgba(0, 0, 0, 0.25); "> |
|||
<div style="width: 36px; height: 36px; border-radius: 50%; background: #714B67; |
|||
display: flex; justify-content: center; align-items: center; |
|||
margin-right: 10px; flex-shrink: 0;"> |
|||
<i class="fa-solid fa-star " |
|||
style="color: #fff;font-size:14px;"></i> |
|||
</div> |
|||
<div> |
|||
<p style="color: #1A202C;font-weight: 600; |
|||
font-size: 1.2rem; margin-bottom: 2px;"> |
|||
UOM-based Checkout .</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="container rounded"> |
|||
<ul class="nav nav-tabs d-flex" |
|||
style="width: fit-content;margin: 0 auto;gap: 1rem;"> |
|||
<li class="col text-center py-2 text-nowrap " |
|||
style="color: #fff; background-color: #714B67;border-radius: 6px 6px 0px 0px;"> |
|||
<a |
|||
class="active show" data-toggle="tab" href="#tab1" |
|||
style="color: #fff;font-weight: 500; background-color: #714B67; text-decoration: none;"> |
|||
<i class="fa-regular fa-image pr-2" |
|||
style="color: #fff;"></i> |
|||
Screenshots</a></li> |
|||
<li class="col text-center py-2 text-nowrap " |
|||
style="color: #fff; background-color: #714B67;border-radius: 6px 6px 0px 0px;"> |
|||
<a |
|||
data-toggle="tab" href="#tab2" |
|||
style="color: #fff;font-weight: 500; text-decoration: none;"><i |
|||
class="fa-solid fa-star pr-2" |
|||
style="color: #fff;"></i>Features</a></li> |
|||
<li class="col text-center py-2 text-nowrap " |
|||
style="color: #fff; background-color: #714B67;border-radius: 6px 6px 0px 0px;"> |
|||
<a |
|||
data-toggle="tab" href="#tab3" |
|||
style="color: #fff;font-weight: 500; text-decoration: none; background-color: #714B67;"><i |
|||
class="fa-solid fa-book-open pr-2" |
|||
style="color: #fff;"></i>Released Notes</a></li> |
|||
</ul> |
|||
<div class="tab-content" |
|||
style="background-color: rgba(121, 113, 119, 0.04);"> |
|||
<div id="tab1" class="tab-pane fade in active show"> |
|||
<div class="col-lg-12 py-2" |
|||
style="padding: 1rem 4rem !important;"> |
|||
<div |
|||
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<div class="row justify-content-center p-3 w-100 m-0"> |
|||
<img src="assets/screenshots/1.png" |
|||
class="img-responsive" width="100%" |
|||
height="auto"> |
|||
</div> |
|||
<div class="px-3"> |
|||
<h4 class="mt-2" |
|||
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important"> |
|||
Select the UOM for the product and click on Add to Cart |
|||
</h4> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="col-lg-12 py-2" |
|||
style="padding: 1rem 4rem !important;"> |
|||
<div style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<div class="row justify-content-center p-3 w-100 m-0"> |
|||
<img src="assets/screenshots/2.png" |
|||
class="img-responsive" width="100%" |
|||
height="auto"> |
|||
</div> |
|||
<div class="px-3"> |
|||
<h4 class="mt-2" |
|||
style=" font-weight:600 !important; color:#282F33 !important; font-size:1.3rem !important"> |
|||
The Products will be spilited based on UOM in the Checkout page</h4> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div id="tab2" class="tab-pane fade"> |
|||
<div class="col-mg-12" style="padding: 1rem 4rem;"> |
|||
<ul style="list-style: none; padding: 1rem 0;font-weight: 500;"> |
|||
<li class="py-3" |
|||
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<span style="margin-right: 12px;"><img |
|||
src="assets/misc/star (1) 2.svg" |
|||
alt="" |
|||
width="16px"></span>Hide products price in website. |
|||
</li> |
|||
<li class="py-3" |
|||
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<span style="margin-right: 12px;"><img |
|||
src="assets/misc/star (1) 2.svg" |
|||
alt="" |
|||
width="16px"></span>Hide add to cart button in the website. |
|||
</li> |
|||
<li class="py-3" |
|||
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<span style="margin-right: 12px;"><img |
|||
src="assets/misc/star (1) 2.svg" |
|||
alt="" |
|||
width="16px"></span>Adds a button for price requests from merchants. |
|||
</li> |
|||
<li class="py-3" |
|||
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<span style="margin-right: 12px;"><img |
|||
src="assets/misc/star (1) 2.svg" |
|||
alt="" |
|||
width="16px"></span>Track all requests from the backend. |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
<div id="tab3" class="tab-pane fade"> |
|||
<div class="col-mg-12 active" style="padding: 1rem 4rem;"> |
|||
<div class="py-3" |
|||
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> |
|||
<div class="d-flex mb-3" |
|||
style="font-size: 0.8rem; font-weight: 500;"><span>Version |
|||
17.0.1.0.0</span><span |
|||
class="px-2">|</span><span |
|||
style="color: #714B67;font-weight: 600;">Released on:22nd February 2024</span> |
|||
</div> |
|||
<p class="m-0" |
|||
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;"> |
|||
Initial Commit for Website Call For Price.</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="container mt-5"> |
|||
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-5"> |
|||
<p class="m-0" |
|||
style="font-weight: 600; font-size: 24px; color:#000 !important"> |
|||
Related Products</p> |
|||
</div> |
|||
</div> |
|||
<div id="myCarousel" class="carousel slide py-3" data-ride="carousel"> |
|||
<div class="carousel-inner"> |
|||
<div class="carousel-item active"> |
|||
<div class="row p-4"> |
|||
<div class="col"> |
|||
<div class="p-3"> |
|||
<a href="https://apps.odoo.com/apps/modules/17.0/website_product_publish/" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;"> |
|||
<div style="width: 300px; "> |
|||
<img src="assets/modules/1.jpg" |
|||
alt="" width="100%" |
|||
height="auto"> |
|||
|
|||
</div> |
|||
<p class="text-center pt-2 text-black font-weight-bold"> |
|||
Quick Product Publish/Unpublish</p> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="col"> |
|||
<div class="p-3"> |
|||
<a href="https://apps.odoo.com/apps/modules/17.0/odoo_icecat_connector/" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;"> |
|||
<div style="width: 300px; "> |
|||
<img src="assets/modules/2.jpg" |
|||
alt="" width="100%" |
|||
height="auto"> |
|||
|
|||
</div> |
|||
<p class="text-center pt-2 text-black font-weight-bold"> |
|||
Odoo Icecat Connector</p> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="col"> |
|||
<div class="p-3"> |
|||
<a href="https://apps.odoo.com/apps/modules/17.0/shopping_through_agent/" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;"> |
|||
<div style="width: 300px; "> |
|||
<img src="assets/modules/3.jpg" |
|||
alt="" width="100%" |
|||
height="auto"> |
|||
|
|||
</div> |
|||
<p class="text-center pt-2 text-black font-weight-bold"> |
|||
Shopping Through Agent</p> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="carousel-item"> |
|||
<div class="row p-4"> |
|||
<div class="col"> |
|||
<div class="p-3"> |
|||
<a href="https://apps.odoo.com/apps/modules/17.0/website_upload_files/" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;"> |
|||
<div style="width: 300px; "> |
|||
<img src="assets/modules/4.jpg" |
|||
alt="" width="100%" |
|||
height="auto"> |
|||
|
|||
</div> |
|||
<p class="text-center pt-2 text-black font-weight-bold"> |
|||
Multiple Attachments In eCommerce Order</p> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="col"> |
|||
<div class="p-3"> |
|||
<a href="https://apps.odoo.com/apps/modules/17.0/website_multi_variant/" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;"> |
|||
<div style="width: 300px;"> |
|||
<img src="assets/modules/5.jpg" |
|||
alt="" width="100%" |
|||
height="auto"> |
|||
|
|||
</div> |
|||
<p class="text-center pt-2 text-black font-weight-bold"> |
|||
Website Multi Variant Add to Cart</p> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="col"> |
|||
<div class="p-3"> |
|||
<a href="https://apps.odoo.com/apps/modules/17.0/website_pdf_preview_snippet/" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;"> |
|||
<div style="width: 300px;"> |
|||
<img src="assets/modules/6.jpg" |
|||
alt="" width="100%" |
|||
height="auto"> |
|||
</div> |
|||
<p class="text-center pt-2 text-black font-weight-bold"> |
|||
Website PDF Preview Snippet</p> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<a class="carousel-control-prev" href="#myCarousel" |
|||
data-slide="prev" style="width: 35px; color: #000;"> |
|||
<span class="carousel-control-prev-icon"> |
|||
<i class="fa fa-chevron-left" |
|||
style="font-size: 24px;"></i> |
|||
</span> |
|||
</a> |
|||
<a class="carousel-control-next" href="#myCarousel" |
|||
data-slide="next" style="width: 35px; color: #000;"> |
|||
<span class="carousel-control-next-icon"> |
|||
<i class="fa fa-chevron-right" |
|||
style="font-size: 24px;"></i> |
|||
</span> |
|||
</a> |
|||
</div> |
|||
<div class="container mt-5"> |
|||
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4"> |
|||
<p class="m-0" |
|||
style="font-weight: 600; font-size: 24px; color:#000 !important"> |
|||
Our Services</p> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="container my-5"> |
|||
<div class="row py-3"> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#13EA36 ; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/cogs.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Customization</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#DBC711; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/wrench.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Implementation</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative; border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#FF6B6B ; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/lifebuoy.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Support</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative; border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#FFA801 ; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/user.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Hire |
|||
Odoo Developer</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative; border-radius: 4px;"> |
|||
|
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#54A0FF; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/puzzle.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Integration</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#6D7680 ; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/update.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Migration</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#786FA6 ; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/consultation.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Consultancy</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;position: relative;border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#F8A5C2 ; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/training.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Implementation</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-4 col-sm-6 px-4 py-4"> |
|||
<div |
|||
style="background-color: #fff; padding: 25px; text-align: center; box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px; position: relative;border-radius: 4px;"> |
|||
<div style="position: absolute; top: 0%; left: 50%; transform: translate(-50%, -50%);"> |
|||
<div style="background-color:#E6BE26; border-radius: 50%; padding: 15px; width: 68px; |
|||
height: 68px; display: inline-block; box-shadow:0px 4px 4px rgba(0, 0, 0, 0.25);"> |
|||
<img src="assets/icons/license.png" |
|||
alt="service-icon" width="38px" |
|||
height="auto"> |
|||
</div> |
|||
</div> |
|||
<p style="margin-top: 20px; font-weight: bold;">Odoo |
|||
Licensing Consultancy</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="container mt-5"> |
|||
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-4"> |
|||
<p class="m-0" |
|||
style="font-weight: 600; font-size: 24px; color:#000 !important"> |
|||
Our Industries</p> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="container"> |
|||
<div class="row my-5 py-4"> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100 " |
|||
style="border-right: 1px solid rgb(209, 209, 209); border-bottom: 1px solid rgb(209, 209, 209); padding: 30px; box-shadow: 6px 0 10px rgba(228, 227, 227, 0.373);"> |
|||
<img src="assets/icons/trading-black.png" width="42px" |
|||
height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;">Trading</p> |
|||
<p>Easily procure and sell your products</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style="border-right: 1px solid rgb(209, 209, 209);border-bottom: 1px solid rgb(209, 209, 209); padding: 30px;"> |
|||
<img src="assets/icons/pos-black.png" width="42px" |
|||
height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;">POS</p> |
|||
<p>Easy configuration and convivial experience</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style="border-right: 1px solid rgb(209, 209, 209);border-bottom: 1px solid rgba(0, 0, 0, 0.2); padding: 30px; box-shadow: 0 5px 10px rgba(228, 227, 227, 0.373)"> |
|||
<img src="assets/icons/education-black.png" width="42px" |
|||
height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;"> |
|||
Education</p> |
|||
<p>A platform for educational management</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style="border-bottom: 1px solid rgb(209, 209, 209); padding: 30px; "> |
|||
<img src="assets/icons/manufacturing-black.png" |
|||
width="42px" height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;"> |
|||
Manufacturing</p> |
|||
<p>Plan, track and schedule your operations</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style="border-right: 1px solid rgb(209, 209, 209); padding: 30px;"> |
|||
<img src="assets/icons/ecom-black.png" width="42px" |
|||
height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;">E-commerce & |
|||
Website</p> |
|||
<p>Mobile friendly, awe-inspiring product pages</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style="border-right: 1px solid rgb(209, 209, 209); padding: 30px;box-shadow: 0 -5px 10px rgba(228, 227, 227, 0.373);"> |
|||
<img src="assets/icons/service-black.png" width="42px" |
|||
height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;">Service |
|||
Management</p> |
|||
<p>Keep track of services and invoice</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style="border-right: 1px solid rgb(209, 209, 209); padding: 30px; "> |
|||
<img src="assets/icons/restaurant-black.png" |
|||
width="42px" height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;"> |
|||
Restaurant</p> |
|||
<p>Run your bar or restaurant methodically</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-3 col-sm-6 p-0"> |
|||
<div class="d-flex flex-column h-100" |
|||
style=" padding: 30px;box-shadow: -5px 0 10px rgba(228, 227, 227, 0.373);"> |
|||
<img src="assets/icons/hotel-black.png" width="42px" |
|||
height="auto" alt=""> |
|||
<p style="color: #714B67;font-weight: 600; margin-top: 10px; |
|||
font-size: 1.2rem; margin-bottom: 2px;">Hotel |
|||
Management</p> |
|||
<p>An all-inclusive hotel management application</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="container mt-5"> |
|||
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-5"> |
|||
<p class="m-0" |
|||
style="font-weight: 600; font-size: 24px; color:#000 !important"> |
|||
Support</p> |
|||
</div> |
|||
</div> |
|||
<div class="container my-5"> |
|||
<div class="row" style="background-color: #FFFAFE;"> |
|||
<div class="col-md-6 pb-4 d-flex align-items-center justify-content-center" |
|||
style="border-right: 1px solid #D9D9D9;"> |
|||
<div style="padding: 30px;"> |
|||
<div class="d-flex align-items-center"> |
|||
<img src="assets/misc/support (1) 1.svg" alt="" |
|||
width="60px" style="margin-right: 12px;"> |
|||
<div style="padding: 0px 8px;"> |
|||
<span |
|||
style="color: #714B67;font-size: 24px;font-weight: 600;padding-bottom: 1rem;">Need |
|||
Help?</span> |
|||
<p class="m-0" style="color:#718096;">Got |
|||
questions or need help? Get in touch.</p> |
|||
<div style="font-weight: 400;"><span><img |
|||
src="assets/misc/support-email.svg" |
|||
alt="" |
|||
width="18px" |
|||
style="filter: invert(1);margin-right: 0.8rem;"></span>odoo@cybrosys.com |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-6 pb-4 d-flex align-items-center justify-content-center"> |
|||
<div style="padding: 30px;"> |
|||
<div class="d-flex align-items-center"> |
|||
<img src="assets/misc/whatsapp 1.svg" alt="" |
|||
width="60px" style="margin-right: 12px;"> |
|||
<div> |
|||
<span style="color: #714B67;font-size: 24px;font-weight: 600;">WhatsApp</span> |
|||
<p class="m-0" style="color:#718096;">Say hi to |
|||
us on WhatsApp!</p> |
|||
<div style="font-weight: 400; font-size: 16px;"><span><img |
|||
src="assets/misc/phone.svg" |
|||
alt="" width="14px" |
|||
style="filter: invert(1); margin-right: 0.8rem;"></span>+91 |
|||
99456767686 |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
<!-- Optional JavaScript --> |
|||
<!-- jQuery first, then Popper.js, then Bootstrap JS --> |
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> |
|||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,214 @@ |
|||
/** @odoo-module **/ |
|||
import publicWidget from "@web/legacy/js/public/public_widget"; |
|||
import { WebsiteSale } from '@website_sale/js/website_sale'; |
|||
import { OptionalProductsModal } from "@website_sale_product_configurator/js/sale_product_configurator_modal"; |
|||
import { jsonrpc } from "@web/core/network/rpc_service"; |
|||
import VariantMixin from "@website_sale/js/sale_variant_mixin"; |
|||
|
|||
publicWidget.registry.UomDropDown = publicWidget.Widget.extend(VariantMixin,{ |
|||
selector: '.o_uom_dropdown', |
|||
events: { |
|||
'change #o_uom_dropdown': '_onChangeSelect', |
|||
|
|||
}, |
|||
init(ev) { |
|||
this._super(...arguments); |
|||
this.rpc = this.bindService("rpc"); |
|||
this.orm = this.bindService("orm"); |
|||
}, |
|||
|
|||
|
|||
_onChangeSelect: function(ev){ |
|||
var self = this |
|||
var $parent = $(ev.target).closest('.js_product'); |
|||
var $default_price = $parent.find(".oe_default_price:first .oe_currency_value"); |
|||
var quantity = $parent.find('.css_quantity'); |
|||
var price = $default_price.text().trim(); |
|||
var uom_id = ev.target.value |
|||
var productID = ev.target.getAttribute('data') |
|||
this._getCombinationInfo(ev) |
|||
}, |
|||
|
|||
_getCombinationInfo: function (ev) { |
|||
if ($(ev.target).hasClass('variant_custom_value')) { |
|||
return Promise.resolve(); |
|||
} |
|||
|
|||
const $parent = $(ev.target).closest('.js_product'); |
|||
if(!$parent.length){ |
|||
return Promise.resolve(); |
|||
} |
|||
const combination = this.getSelectedVariantValues($parent); |
|||
let parentCombination; |
|||
|
|||
if ($parent.hasClass('main_product')) { |
|||
parentCombination = $parent.find('ul[data-attribute_exclusions]').data('attribute_exclusions').parent_combination; |
|||
const $optProducts = $parent.parent().find(`[data-parent-unique-id='${$parent.data('uniqueId')}']`); |
|||
|
|||
for (const optionalProduct of $optProducts) { |
|||
const $currentOptionalProduct = $(optionalProduct); |
|||
const childCombination = this.getSelectedVariantValues($currentOptionalProduct); |
|||
const productTemplateId = parseInt($currentOptionalProduct.find('.product_template_id').val()); |
|||
jsonrpc('/website_sale/get_combination_info', { |
|||
'product_template_id': productTemplateId, |
|||
'product_id': this._getProductId($currentOptionalProduct), |
|||
'combination': childCombination, |
|||
'add_qty': parseInt($currentOptionalProduct.find('input[name="add_qty"]').val()), |
|||
'uom': parseInt($parent.find('select#o_uom_dropdown.form-control').val()), |
|||
'parent_combination': combination, |
|||
'context': this.context, |
|||
...this._getOptionalCombinationInfoParam($currentOptionalProduct), |
|||
}).then((combinationData) => { |
|||
if (this._shouldIgnoreRpcResult()) { |
|||
return; |
|||
} |
|||
this._onChangeCombination(ev, $currentOptionalProduct, combinationData); |
|||
this._checkExclusions($currentOptionalProduct, childCombination, combinationData.parent_exclusions); |
|||
}); |
|||
} |
|||
} else { |
|||
parentCombination = this.getSelectedVariantValues( |
|||
$parent.parent().find('.js_product.in_cart.main_product') |
|||
); |
|||
} |
|||
|
|||
return jsonrpc('/website_sale/get_combination_info', { |
|||
'product_template_id': parseInt($parent.find('.product_template_id').val()), |
|||
'product_id': this._getProductId($parent), |
|||
'combination': combination, |
|||
'add_qty': parseInt($parent.find('input[name="add_qty"]').val()), |
|||
'parent_combination': parentCombination, |
|||
'uom': parseInt($parent.find('select#o_uom_dropdown.form-control').val()), |
|||
'context': this.context, |
|||
...this._getOptionalCombinationInfoParam($parent), |
|||
}).then((combinationData) => { |
|||
if (this._shouldIgnoreRpcResult()) { |
|||
return; |
|||
} |
|||
this._onChangeCombination(ev, $parent, combinationData); |
|||
this._checkExclusions($parent, combination, combinationData.parent_exclusions); |
|||
}); |
|||
}, |
|||
}); |
|||
|
|||
|
|||
|
|||
publicWidget.registry.WebsiteSale.include({ |
|||
_updateRootProduct($form, productId) { |
|||
this.rootProduct = { |
|||
product_id: productId, |
|||
quantity: parseFloat($form.find('input[name="add_qty"]').val() || 1), |
|||
product_custom_attribute_values: this.getCustomVariantValues($form.find('.js_product')), |
|||
variant_values: this.getSelectedVariantValues($form.find('.js_product')), |
|||
no_variant_attribute_values: this.getNoVariantAttributeValues($form.find('.js_product')), |
|||
uom_id: parseInt($form.find('select#o_uom_dropdown.form-control').val()) // Include the uom_id in the rootProduct object
|
|||
}; |
|||
}, |
|||
|
|||
_getCombinationInfo: function (ev) { |
|||
if ($(ev.target).hasClass('variant_custom_value')) { |
|||
return Promise.resolve(); |
|||
} |
|||
|
|||
const $parent = $(ev.target).closest('.js_product'); |
|||
if(!$parent.length){ |
|||
return Promise.resolve(); |
|||
} |
|||
const combination = this.getSelectedVariantValues($parent); |
|||
let parentCombination; |
|||
|
|||
if ($parent.hasClass('main_product')) { |
|||
parentCombination = $parent.find('ul[data-attribute_exclusions]').data('attribute_exclusions').parent_combination; |
|||
|
|||
const $optProducts = $parent.parent().find(`[data-parent-unique-id='${$parent.data('uniqueId')}']`); |
|||
|
|||
for (const optionalProduct of $optProducts) { |
|||
const $currentOptionalProduct = $(optionalProduct); |
|||
const childCombination = this.getSelectedVariantValues($currentOptionalProduct); |
|||
const productTemplateId = parseInt($currentOptionalProduct.find('.product_template_id').val()); |
|||
jsonrpc('/website_sale/get_combination_info', { |
|||
'product_template_id': productTemplateId, |
|||
'product_id': this._getProductId($currentOptionalProduct), |
|||
'combination': childCombination, |
|||
'add_qty': parseInt($currentOptionalProduct.find('input[name="add_qty"]').val()), |
|||
'uom': parseInt($parent.find('select#o_uom_dropdown.form-control').val()), |
|||
'parent_combination': combination, |
|||
'context': this.context, |
|||
...this._getOptionalCombinationInfoParam($currentOptionalProduct), |
|||
}).then((combinationData) => { |
|||
if (this._shouldIgnoreRpcResult()) { |
|||
return; |
|||
} |
|||
this._onChangeCombination(ev, $currentOptionalProduct, combinationData); |
|||
this._checkExclusions($currentOptionalProduct, childCombination, combinationData.parent_exclusions); |
|||
}); |
|||
} |
|||
} else { |
|||
parentCombination = this.getSelectedVariantValues( |
|||
$parent.parent().find('.js_product.in_cart.main_product') |
|||
); |
|||
} |
|||
|
|||
return jsonrpc('/website_sale/get_combination_info', { |
|||
'product_template_id': parseInt($parent.find('.product_template_id').val()), |
|||
'product_id': this._getProductId($parent), |
|||
'combination': combination, |
|||
'add_qty': parseInt($parent.find('input[name="add_qty"]').val()), |
|||
'parent_combination': parentCombination, |
|||
'uom': parseInt($parent.find('select#o_uom_dropdown.form-control').val()), |
|||
'context': this.context, |
|||
...this._getOptionalCombinationInfoParam($parent), |
|||
}).then((combinationData) => { |
|||
if (this._shouldIgnoreRpcResult()) { |
|||
return; |
|||
} |
|||
this._onChangeCombination(ev, $parent, combinationData); |
|||
this._checkExclusions($parent, combination, combinationData.parent_exclusions); |
|||
}); |
|||
}, |
|||
|
|||
|
|||
}); |
|||
|
|||
OptionalProductsModal.include({ |
|||
|
|||
getAndCreateSelectedProducts: async function () { |
|||
const self = this; |
|||
const products = []; |
|||
for (const product of self.$modal.find('.js_product.in_cart')) { |
|||
const $item = $(product); |
|||
const quantity = parseFloat($item.find('input[name="add_qty"]').val().replace(',', '.') || 1); |
|||
const parentUniqueId = product.dataset.parentUniqueId; |
|||
const uniqueId = product.dataset.uniqueId; |
|||
const uomId = self.rootProduct.uom_id |
|||
const productCustomVariantValues = $item.find('.custom-attribute-info').data("attribute-value") || self.getCustomVariantValues($item); |
|||
const noVariantAttributeValues = $item.find('.no-attribute-info').data("attribute-value") || self.getNoVariantAttributeValues($item); |
|||
|
|||
const productID = await self.selectOrCreateProduct( |
|||
$item, |
|||
parseInt($item.find('input.product_id').val(), 10), |
|||
parseInt($item.find('input.product_template_id').val(), 10), |
|||
true |
|||
); |
|||
|
|||
products.push({ |
|||
'product_id': productID, |
|||
'product_template_id': parseInt($item.find('input.product_template_id').val(), 10), |
|||
'quantity': quantity, |
|||
'parent_unique_id': parentUniqueId, |
|||
'unique_id': uniqueId, |
|||
'uom_id': uomId, |
|||
'product_custom_attribute_values': productCustomVariantValues, |
|||
'no_variant_attribute_values': noVariantAttributeValues |
|||
}); |
|||
} |
|||
return products; |
|||
}, |
|||
_onChangeCombination: function (ev, $parent, combination) { |
|||
$parent |
|||
.find('.td-product_name .product-name') |
|||
.first() |
|||
.text(combination.display_name); |
|||
this._computePriceTotal(); |
|||
} |
|||
}); |
@ -0,0 +1,146 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!--This code snippet adds a "CUSTOMIZE PRODUCT" button after a specific |
|||
div element on a website page. It also includes functionality for |
|||
designing a product by allowing the user to select and change designs.--> |
|||
<template id="website_product_customization_product" |
|||
inherit_id="website_sale.product" |
|||
name="Website Product Multi Uom"> |
|||
<xpath expr="//div[@id='o_wsale_cta_wrapper']" position="after"> |
|||
<div class="o_uom_dropdown dropdown" style="margin-right:10px;width:136px;text-align:center;"> |
|||
<t t-set="current_uom" t-value="product.uom_id"/> |
|||
<select class="form-control" id="o_uom_dropdown" |
|||
t-att-data="product.id"> |
|||
<t t-foreach="product.uom_id.category_id.uom_ids" |
|||
t-as="uom"> |
|||
<option t-att-value="uom.id" |
|||
t-att-selected="current_uom.id == uom.id"> |
|||
<t t-esc="uom.name"/> |
|||
</option> |
|||
</t> |
|||
</select> |
|||
</div> |
|||
</xpath> |
|||
</template> |
|||
<template id="website_sale_inherit_cart_lines" |
|||
inherit_id="website_sale.cart_lines"> |
|||
<xpath expr="//div[@id='cart_products']/div" position="replace"> |
|||
<div t-foreach="website_sale_order.website_order_line" |
|||
t-as="line" |
|||
t-attf-class="o_cart_product d-flex align-items-stretch gap-3 #{line.linked_line_id and 'optional_product info'} #{not line_last and 'border-bottom pb-4'} #{line_index > 0 and 'pt-4'}" |
|||
t-attf-data-product-id="#{line.product_id and line.product_id.id}"> |
|||
<t t-if="line.product_id"> |
|||
<img t-if="line._is_not_sellable_line() and line.product_id.image_128" |
|||
t-att-src="image_data_uri(line.product_id.image_128)" |
|||
class="o_image_64_max img rounded" |
|||
t-att-alt="line.name_short"/> |
|||
<div t-else="" |
|||
t-field="line.product_id.image_128" |
|||
t-options="{'widget': 'image', 'qweb_img_responsive': False, 'class': 'o_image_64_max rounded'}"/> |
|||
<div class="flex-grow-1"> |
|||
<t t-call="website_sale.cart_line_product_link"> |
|||
<h6 t-field="line.name_short" |
|||
class="d-inline align-top h6 fw-bold"/> |
|||
</t> |
|||
<t t-call="website_sale.cart_line_description_following_lines"> |
|||
<t t-set="div_class" t-valuef="d-none d-md-block"/> |
|||
</t> |
|||
UOM = |
|||
<span t-esc="line.product_uom.name" |
|||
class="text-muted me-2"/> |
|||
<div> |
|||
<a href='#' |
|||
class="js_delete_product d-none d-md-inline-block small" |
|||
aria-label="Remove from cart" |
|||
title="Remove from cart">Remove |
|||
</a> |
|||
<button class="js_delete_product btn btn-light d-inline-block d-md-none" |
|||
title="remove"> |
|||
<i class="fa fa-trash-o"/> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
<div class="d-flex flex-column align-items-end"> |
|||
<div t-attf-class="css_quantity input-group mb-2" |
|||
name="website_sale_cart_line_quantity"> |
|||
<t t-if="not line._is_not_sellable_line()"> |
|||
<t t-if="show_qty"> |
|||
<a href="#" |
|||
class="js_add_cart_json btn btn-link d-inline-block border-end-0" |
|||
aria-label="Remove one" |
|||
title="Remove one"> |
|||
<i class="position-relative z-index-1 fa fa-minus"/> |
|||
</a> |
|||
<input type="text" |
|||
class="js_quantity quantity form-control border-start-0 border-end-0" |
|||
t-att-data-line-id="line.id" |
|||
t-att-data-product-id="line.product_id.id" |
|||
t-att-value="int(line.product_uom_qty) == line.product_uom_qty and int(line.product_uom_qty) or line.product_uom_qty"/> |
|||
<t t-if="line._get_shop_warning(clear=False)"> |
|||
<a href="#" class="btn btn-link"> |
|||
<i class='fa fa-warning text-warning' |
|||
t-att-title="line._get_shop_warning()" |
|||
role="img" |
|||
aria-label="Warning"/> |
|||
</a> |
|||
</t> |
|||
<a t-else="" |
|||
href="#" |
|||
class="js_add_cart_json d-inline-block float_left btn btn-link border-start-0" |
|||
aria-label="Add one" |
|||
title="Add one"> |
|||
<i class="fa fa-plus position-relative z-index-1"/> |
|||
</a> |
|||
</t> |
|||
<t t-else=""> |
|||
<input type="hidden" |
|||
class="js_quantity form-control quantity" |
|||
t-att-data-line-id="line.id" |
|||
t-att-data-product-id="line.product_id.id" |
|||
t-att-value="int(line.product_uom_qty) == line.product_uom_qty and int(line.product_uom_qty) or line.product_uom_qty"/> |
|||
</t> |
|||
</t> |
|||
<t t-else=""> |
|||
<span class="w-100 text-muted" |
|||
t-esc="int(line.product_uom_qty)"/> |
|||
<input type="hidden" |
|||
class="js_quantity quantity form-control" |
|||
t-att-data-line-id="line.id" |
|||
t-att-data-product-id="line.product_id.id" |
|||
t-att-value="line.product_uom_qty"/> |
|||
</t> |
|||
</div> |
|||
<div class="mb-0 h6 fw-bold text-end" |
|||
name="website_sale_cart_line_price"> |
|||
<t t-if="line.discount"> |
|||
<del t-attf-class="#{'text-danger mr8'}" |
|||
style="white-space: nowrap;" |
|||
t-out="line._get_displayed_unit_price() * line.product_uom_qty" |
|||
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/> |
|||
</t> |
|||
<t t-if="website.show_line_subtotals_tax_selection == 'tax_excluded'" |
|||
t-set='product_price' |
|||
t-value='line.price_subtotal'/> |
|||
<t t-else="" |
|||
t-set='product_price' |
|||
t-value='line.price_total'/> |
|||
<span t-out="product_price" |
|||
style="white-space: nowrap;" |
|||
t-options="{'widget': 'monetary', 'display_currency': website_sale_order.currency_id}"/> |
|||
<small t-if="not line._is_not_sellable_line() and line.product_id.base_unit_price" |
|||
class="cart_product_base_unit_price d-block text-muted" |
|||
groups="website_sale.group_show_uom_price"> |
|||
<t t-call='website_sale.base_unit_price'> |
|||
<t t-set='product' |
|||
t-value='line.product_id'/> |
|||
<t t-set='combination_info' |
|||
t-value="{'base_unit_price': product._get_base_unit_price(product_price/line.product_uom_qty)}"/> |
|||
</t> |
|||
</small> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</div> |
|||
</xpath> |
|||
</template> |
|||
</odoo> |