Browse Source

May 18: [ADD] Initital Commit 'website_decimal_quantity'

pull/317/head
RisvanaCybro 11 months ago
parent
commit
1dc3e4e6ee
  1. 47
      website_decimal_quantity/README.rst
  2. 23
      website_decimal_quantity/__init__.py
  3. 46
      website_decimal_quantity/__manifest__.py
  4. 23
      website_decimal_quantity/controllers/__init__.py
  5. 216
      website_decimal_quantity/controllers/main.py
  6. 102
      website_decimal_quantity/controllers/website_sale_product_configurator.py
  7. 6
      website_decimal_quantity/doc/RELEASE_NOTES.md
  8. 22
      website_decimal_quantity/models/__init__.py
  9. 124
      website_decimal_quantity/models/sale_order.py
  10. BIN
      website_decimal_quantity/static/description/assets/icons/check.png
  11. BIN
      website_decimal_quantity/static/description/assets/icons/chevron.png
  12. BIN
      website_decimal_quantity/static/description/assets/icons/cogs.png
  13. BIN
      website_decimal_quantity/static/description/assets/icons/consultation.png
  14. BIN
      website_decimal_quantity/static/description/assets/icons/ecom-black.png
  15. BIN
      website_decimal_quantity/static/description/assets/icons/education-black.png
  16. BIN
      website_decimal_quantity/static/description/assets/icons/hotel-black.png
  17. BIN
      website_decimal_quantity/static/description/assets/icons/license.png
  18. BIN
      website_decimal_quantity/static/description/assets/icons/lifebuoy.png
  19. BIN
      website_decimal_quantity/static/description/assets/icons/manufacturing-black.png
  20. BIN
      website_decimal_quantity/static/description/assets/icons/pos-black.png
  21. BIN
      website_decimal_quantity/static/description/assets/icons/puzzle.png
  22. BIN
      website_decimal_quantity/static/description/assets/icons/restaurant-black.png
  23. BIN
      website_decimal_quantity/static/description/assets/icons/service-black.png
  24. BIN
      website_decimal_quantity/static/description/assets/icons/trading-black.png
  25. BIN
      website_decimal_quantity/static/description/assets/icons/training.png
  26. BIN
      website_decimal_quantity/static/description/assets/icons/update.png
  27. BIN
      website_decimal_quantity/static/description/assets/icons/user.png
  28. BIN
      website_decimal_quantity/static/description/assets/icons/wrench.png
  29. BIN
      website_decimal_quantity/static/description/assets/misc/categories.png
  30. BIN
      website_decimal_quantity/static/description/assets/misc/check-box.png
  31. BIN
      website_decimal_quantity/static/description/assets/misc/compass.png
  32. BIN
      website_decimal_quantity/static/description/assets/misc/corporate.png
  33. BIN
      website_decimal_quantity/static/description/assets/misc/customer-support.png
  34. BIN
      website_decimal_quantity/static/description/assets/misc/cybrosys-logo.png
  35. BIN
      website_decimal_quantity/static/description/assets/misc/features.png
  36. BIN
      website_decimal_quantity/static/description/assets/misc/logo.png
  37. BIN
      website_decimal_quantity/static/description/assets/misc/pictures.png
  38. BIN
      website_decimal_quantity/static/description/assets/misc/pie-chart.png
  39. BIN
      website_decimal_quantity/static/description/assets/misc/right-arrow.png
  40. BIN
      website_decimal_quantity/static/description/assets/misc/star.png
  41. BIN
      website_decimal_quantity/static/description/assets/misc/support.png
  42. BIN
      website_decimal_quantity/static/description/assets/misc/whatsapp.png
  43. BIN
      website_decimal_quantity/static/description/assets/modules/2.png
  44. BIN
      website_decimal_quantity/static/description/assets/modules/3.jpg
  45. BIN
      website_decimal_quantity/static/description/assets/modules/4.jpg
  46. BIN
      website_decimal_quantity/static/description/assets/modules/5.jpg
  47. BIN
      website_decimal_quantity/static/description/assets/modules/6.png
  48. BIN
      website_decimal_quantity/static/description/assets/modules/7.jpg
  49. BIN
      website_decimal_quantity/static/description/assets/screenshots/1.png
  50. BIN
      website_decimal_quantity/static/description/assets/screenshots/2.png
  51. BIN
      website_decimal_quantity/static/description/assets/screenshots/3.png
  52. BIN
      website_decimal_quantity/static/description/assets/screenshots/hero.gif
  53. BIN
      website_decimal_quantity/static/description/banner.png
  54. BIN
      website_decimal_quantity/static/description/icon.png
  55. 659
      website_decimal_quantity/static/description/index.html
  56. 83
      website_decimal_quantity/static/src/js/website_sale.js
  57. 28
      website_decimal_quantity/views/website_sale_product_configurator_templates.xml

47
website_decimal_quantity/README.rst

@ -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 Decimal Quantity
========================
This Module Allows Customers to Set Website-Shop Product Quantities in Decimal.
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) SANEEN 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>`__

23
website_decimal_quantity/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K @ cybrosys,(odoo@cybrosys.com)
#
# 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

46
website_decimal_quantity/__manifest__.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K @ cybrosys,(odoo@cybrosys.com)
#
# 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 Decimal Quantity',
'version': '17.0.1.0.0',
'category': 'Website',
'summary': 'The app allows to select quantity in decimal for products '
'in Website/Shop',
'description': """The app enables users to select quantities in decimal
values for products within the Website/Shop interface.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'depends': ['website_sale', 'website_sale_product_configurator'],
'data': ['views/website_sale_product_configurator_templates.xml'],
'assets': {
'web.assets_frontend': [
'/website_decimal_quantity/static/src/js/website_sale.js',
],
},
'images': ['static/description/banner.png'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

23
website_decimal_quantity/controllers/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K (<https://www.cybrosys.com>)
#
# 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 main
from . import website_sale_product_configurator

216
website_decimal_quantity/controllers/main.py

@ -0,0 +1,216 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K (<https://www.cybrosys.com>)
#
# 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 fields
from odoo import http
from odoo.http import request
from werkzeug.exceptions import NotFound
from odoo.tools.json import scriptsafe as json_scriptsafe
from odoo.addons.payment import utils as payment_utils
from odoo.addons.website_sale.controllers.main import WebsiteSale
class WebsiteSaleDecimal(WebsiteSale):
"""
WebsiteSaleDecimal extends WebsiteSale class to update the methods: cart,
cart_update, cart_update_json and cart_quantity.
"""
@http.route()
def cart(self, access_token=None, revive='', **post):
"""
Main cart management + abandoned cart revival
access_token: Abandoned cart SO access token
revive: Revival method when abandoned cart. Can be 'merge' or 'squash'
"""
order = request.website.sale_get_order()
if order and order.carrier_id:
# Express checkout is based on the amout of the sale order. If there is already a
# delivery line, Express Checkout form will display and compute the price of the
# delivery two times (One already computed in the total amount of the SO and one added
# in the form while selecting the delivery carrier)
order._remove_delivery_line()
if order and order.state != 'draft':
request.session['sale_order_id'] = None
order = request.website.sale_get_order()
request.session['website_sale_cart_quantity'] = round(
sum(order.mapped('website_order_line.product_uom_qty')), 1)
values = {}
if access_token:
abandoned_order = request.env['sale.order'].sudo().search(
[('access_token', '=', access_token)], limit=1)
if not abandoned_order: # wrong token (or SO has been deleted)
raise NotFound()
if abandoned_order.state != 'draft': # abandoned cart already finished
values.update({'abandoned_proceed': True})
elif revive == 'squash' or (
revive == 'merge' and not request.session.get(
'sale_order_id')): # restore old cart or merge with unexistant
request.session['sale_order_id'] = abandoned_order.id
return request.redirect('/shop/cart')
elif revive == 'merge':
abandoned_order.order_line.write(
{'order_id': request.session['sale_order_id']})
abandoned_order.action_cancel()
elif abandoned_order.id != request.session.get(
'sale_order_id'): # abandoned cart found, user have to choose what to do
values.update({'access_token': abandoned_order.access_token})
values.update({
'website_sale_order': order,
'date': fields.Date.today(),
'suggested_products': [],
})
if order:
order.order_line.filtered(
lambda l: not l.product_id.active).unlink()
values['suggested_products'] = order._cart_accessories()
values.update(self._get_express_shop_payment_values(order))
values.update(self._cart_values(**post))
return request.render("website_sale.cart", values)
@http.route()
def cart_update(
self, product_id, add_qty=1, set_qty=0,
product_custom_attribute_values=None,
no_variant_attribute_values=None,
express=False, **kwargs
):
"""This route is called when adding a product to cart (no options)."""
sale_order = request.website.sale_get_order(force_create=True)
if sale_order.state != 'draft':
request.session['sale_order_id'] = None
sale_order = request.website.sale_get_order(force_create=True)
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)
sale_order._cart_update(
product_id=int(product_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,
**kwargs
)
request.session[
'website_sale_cart_quantity'] = round(
sum(sale_order.mapped('website_order_line.product_uom_qty')), 1)
if express:
return request.redirect("/shop/checkout?express=1")
return request.redirect("/shop/cart")
@http.route()
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, **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,
**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'] = round(
sum(order.mapped('website_order_line.product_uom_qty')), 1)
if not order.cart_quantity:
request.website.sale_reset()
return values
values['cart_quantity'] = round(
sum(order.mapped('website_order_line.product_uom_qty')), 1)
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
@http.route()
def cart_quantity(self):
"""
This method updates the cart quantity count in the session based on
the order's website order lines.
"""
if 'website_sale_cart_quantity' not in request.session:
return request.website.sale_get_order().mapped(
'website_order_line.product_uom_qty')
return request.session['website_sale_cart_quantity']

102
website_decimal_quantity/controllers/website_sale_product_configurator.py

@ -0,0 +1,102 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K (<https://www.cybrosys.com>)
#
# 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
from odoo import http
from odoo.http import request
from odoo.addons.website_sale_product_configurator.controllers.main import WebsiteSaleProductConfiguratorController
class WebsiteSaleDecimal(WebsiteSaleProductConfiguratorController):
"""
WebsiteSaleDecimal extends WebsiteSale class to update the
methods: cart_options_update_json.
"""
@http.route()
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'],
**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'] = round(
sum(order.mapped('website_order_line.product_uom_qty')), 1)
request.session['website_sale_cart_quantity'] = round(
sum(order.mapped('website_order_line.product_uom_qty')), 1)
return values

6
website_decimal_quantity/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <website_decimal_quantity>
#### 16.04.2024
#### Version 17.0.1.0.0
#### ADD
- Initial Commit for Website Decimal Quantity.

22
website_decimal_quantity/models/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K (<https://www.cybrosys.com>)
#
# 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 sale_order

124
website_decimal_quantity/models/sale_order.py

@ -0,0 +1,124 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Saneen K (<https://www.cybrosys.com>)
#
# 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.exceptions import UserError
from odoo.http import request
class SaleOrder(models.Model):
_inherit = 'sale.order'
"""
Inherit the 'sale.order' model to overwrite the _compute_cart_info
and _cart_update functions.
"""
@api.depends('order_line.product_uom_qty', 'order_line.product_id')
def _compute_cart_info(self):
"""
Making cart_quantity integer is avoided in order
to represent it in decimal values
"""
for order in self:
order.cart_quantity = sum(order.mapped
('website_order_line.product_uom_qty'))
order.only_services = all(
line.product_id.type == 'service' for line in
order.website_order_line)
def _cart_update(self, product_id, line_id=None, add_qty=0, set_qty=0,
**kwargs):
""" Add or set product quantity, add_qty can be negative.
Making add_qty and set_qty integer are avoided in order
to represent them as decimal values.
"""
self.ensure_one()
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()
if 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 product.lst_price == 0 and \
product.website_id.prevent_zero_price_sale:
raise UserError(_("The given product does not have a price "
"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]
else:
order_line = self.env['sale.order.line']
try:
if add_qty:
pass
except ValueError:
add_qty = 1
try:
if set_qty:
pass
except ValueError:
set_qty = 0
quantity = 0
if set_qty:
quantity = set_qty
elif add_qty is not None:
if order_line:
quantity = int(order_line.product_uom_qty) + int(add_qty or 0)
else:
quantity = add_qty or 0
if float(quantity) > 0:
quantity, warning = self._verify_updated_quantity(
order_line,
product_id,
float(quantity),
**kwargs,
)
else:
# If the line will be removed anyway, there is no need to verify
# the requested quantity update.
warning = ''
if order_line and int(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 int(quantity) >= 0:
# Create new line
order_line_values = self._prepare_order_line_values(
product_id, quantity, **kwargs)
order_line = self.env['sale.order.line'].sudo().create(
order_line_values)
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,
}

BIN
website_decimal_quantity/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
website_decimal_quantity/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
website_decimal_quantity/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
website_decimal_quantity/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
website_decimal_quantity/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
website_decimal_quantity/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
website_decimal_quantity/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
website_decimal_quantity/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
website_decimal_quantity/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
website_decimal_quantity/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
website_decimal_quantity/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
website_decimal_quantity/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
website_decimal_quantity/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
website_decimal_quantity/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
website_decimal_quantity/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
website_decimal_quantity/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
website_decimal_quantity/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
website_decimal_quantity/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
website_decimal_quantity/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
website_decimal_quantity/static/description/assets/misc/categories.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
website_decimal_quantity/static/description/assets/misc/check-box.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
website_decimal_quantity/static/description/assets/misc/compass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
website_decimal_quantity/static/description/assets/misc/corporate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
website_decimal_quantity/static/description/assets/misc/customer-support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
website_decimal_quantity/static/description/assets/misc/cybrosys-logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
website_decimal_quantity/static/description/assets/misc/features.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
website_decimal_quantity/static/description/assets/misc/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
website_decimal_quantity/static/description/assets/misc/pictures.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
website_decimal_quantity/static/description/assets/misc/pie-chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
website_decimal_quantity/static/description/assets/misc/right-arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

BIN
website_decimal_quantity/static/description/assets/misc/star.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
website_decimal_quantity/static/description/assets/misc/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
website_decimal_quantity/static/description/assets/misc/whatsapp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
website_decimal_quantity/static/description/assets/modules/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
website_decimal_quantity/static/description/assets/modules/3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
website_decimal_quantity/static/description/assets/modules/4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
website_decimal_quantity/static/description/assets/modules/5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
website_decimal_quantity/static/description/assets/modules/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
website_decimal_quantity/static/description/assets/modules/7.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
website_decimal_quantity/static/description/assets/screenshots/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

BIN
website_decimal_quantity/static/description/assets/screenshots/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
website_decimal_quantity/static/description/assets/screenshots/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

BIN
website_decimal_quantity/static/description/assets/screenshots/hero.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
website_decimal_quantity/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
website_decimal_quantity/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

659
website_decimal_quantity/static/description/index.html

@ -0,0 +1,659 @@
<!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/logo.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 Decimal Quantity</h1>
<p class="my-3 mb-4"
style="max-width: 80%; font-weight: 400 !important; line-height: 32px; color: #718096;">In the Website/Shop Interface, Users have the
Capability to Specify Product Quantities Using Decimal
Values rather than being Limited to Whole Numbers.
</p>
<div style="width: 80%; margin-top: 3rem;">
<img src="assets/screenshots/hero.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;">
Allows to Select Quantity in Decimal for Products in Website.</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;">
Allows Users to Select Product in Decimal
Quantities from Product and Cart Page in Website/Shop.</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;">
Simultaneous Price Calculation in the Cart
According to the Selected Decimal Quantities.</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">
Decimal Product Quantity in Product Page.</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">
Decimal Product Quantity in Cart Page.</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/3.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">
Simultaneous Price Calculation in Cart.</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>Allows to Select Quantity in Decimal for Products 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>Allows Users to Select Product in Decimal
Quantities from Product and Cart Page in Website/Shop.
</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>Simultaneous Price Calculation in the Cart
According to the Selected Decimal Quantities.
</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:15th Apr 2024</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial commit for Website Decimal Quantity</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/product_visibility_website/" 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.png" alt="" width="100%" height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Website Product Visibility<p>
</div>
</a>
</div>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/venue_booking_management/" 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">Venue/Event Booking Management</p>
</div>
</a>
</div>
</div>
<div class="col">
<div class="p-3">
<a href="https://apps.odoo.com/apps/modules/17.0/website_hide_button/" 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">Hide Price, Add to Cart And Quantity Button In Website</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_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/5.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 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/6.png" 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/website_return_management/" style="color: #000; text-decoration: none;">
<div style="border:1px solid #CBCBCB !important;border-radius: 4px;">
<div style="width: 300px;">
<img src="assets/modules/7.jpg" alt="" width="100%" height="auto">
</div>
<p class="text-center pt-2 text-black font-weight-bold">Website Return Management</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>

83
website_decimal_quantity/static/src/js/website_sale.js

@ -0,0 +1,83 @@
/** @odoo-module **/
import publicWidget from "@web/legacy/js/public/public_widget";
import wSaleUtils from "@website_sale/js/website_sale_utils";
import { Component } from "@odoo/owl";
publicWidget.registry.WebsiteSale.include({
/**
* This module extends the website_sale module to support decimal quantity input for adding products to the cart.
* It overrides the _onClickAddCartJSON function from sale.VariantMixin to add support for decimal quantity input,
* and extends the WebsiteSale widget to handle updating cart quantities when a decimal quantity is entered.
*/
_onClickAddCartJSON(ev) {
ev.preventDefault();
var $link = $(ev.currentTarget);
var $input = $link.closest('.input-group').find("input");
var min = parseFloat($input.data("min") || 0);
var max = parseFloat($input.data("max") || Infinity);
var previousQty = parseFloat($input.val() || 0, 10);
var quantity = ($link.has(".fa-minus").length ? -0.1 : 0.1) + previousQty;
var newQt = quantity > min ? (quantity < max ? quantity : max) : min;
if (newQt !== previousQty) {
var newQty = newQt.toFixed(1);
$input.val(newQty).trigger('change');
}
newQty = newQt.toFixed(1);
return false;
},
/** Override the function _changeCartQuantity for changing the cart quantity **/
_changeCartQuantity: function ($input, value, $dom_optional, line_id, productIDs) {
$($dom_optional).toArray().forEach((elem) => {
$(elem).find('.js_quantity').text(value);
productIDs.push($(elem).find('span[data-product-id]').data('product-id'));
});
$input.data('update_change', true);
this.rpc("/shop/cart/update_json", {
line_id: line_id,
product_id: parseInt($input.data('product-id'), 10),
set_qty: value,
display: true,
}).then((data) => {
$input.data('update_change', false);
var check_value = parseFloat($input.val());
if (isNaN(check_value)) {
check_value = 1;
}
if (value !== check_value) {
$input.trigger('change');
return;
}
if (!data.cart_quantity) {
return window.location = '/shop/cart';
}
$input.val(data.quantity);
$('.js_quantity[data-line-id='+line_id+']').val(data.quantity).text(data.quantity);
wSaleUtils.updateCartNavBar(data);
wSaleUtils.showWarning(data.notification_info.warning);
// Propagating the change to the express checkout forms
Component.env.bus.trigger('cart_amount_changed', [data.amount, data.minor_amount]);
});
},
/** Override the function _onChangeCartQuantity **/
_onChangeCartQuantity: function (ev) {
ev.preventDefault();
var $input = $(ev.currentTarget);
if ($input.data('update_change')) {
return;
}
var value = parseFloat($input.val() || 0, 10);
if (isNaN(value)) {
value = 1;
}
var $dom = $input.closest('tr');
var $dom_optional = $dom.nextUntil(':not(.optional_product.info)');
var line_id = parseInt($input.data('line-id'), 10);
var productIDs = [parseInt($input.data('product-id'), 10)];
this._changeCartQuantity($input, value, $dom_optional, line_id, productIDs);
},
});

28
website_decimal_quantity/views/website_sale_product_configurator_templates.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- This template replaces the default quantity selector with a text input field
that allows for decimal values. -->
<template id="product_quantity_decimal"
inherit_id="website_sale_product_configurator.product_quantity_config"
name="Select Quantity">
<xpath expr="//div[hasclass('css_quantity')]" position="replace">
<div t-if="is_view_active('website_sale.product_quantity')"
class="css_quantity input-group">
<a class="btn btn-primary float_left js_add_cart_json"
aria-label="Remove one" title="Remove one" href="#">
<i class="fa fa-minus"/>
</a>
<input type="text"
class="js_quantity form-control quantity text-center"
style="max-width: 4rem"
data-min="1"
name="add_qty"
t-att-value="add_qty or 1"/>
<a class="btn btn-primary float_left js_add_cart_json"
aria-label="Add one" title="Add one" href="#">
<i class="fa fa-plus"/>
</a>
</div>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save