Browse Source

Dec 04: [FIX] Bug Fixed 'website_product_uom_multi'

pull/309/head
Cybrosys Technologies 8 months ago
parent
commit
05640b7bc1
  1. 2
      website_product_uom_multi/__manifest__.py
  2. 6
      website_product_uom_multi/doc/RELEASE_NOTES.md
  3. 25
      website_product_uom_multi/models/sale_order.py
  4. 12
      website_product_uom_multi/static/description/index.html

2
website_product_uom_multi/__manifest__.py

@ -21,7 +21,7 @@
################################################################################
{
'name': 'Website Product Multi Uom',
'version': '17.0.1.0.0',
'version': '17.0.1.0.1',
'category': 'Website',
'summary': 'Select the Products UOM before adding to Cart',
'description': 'This module allows customers to select the preferred '

6
website_product_uom_multi/doc/RELEASE_NOTES.md

@ -5,3 +5,9 @@
#### ADD
- Initial Commit for Website Product Multi Uom
#### 04.12.2024
#### Version 17.0.1.0.1
#### BUGFIX
- Fixed the uom issue on instant checkout

25
website_product_uom_multi/models/sale_order.py

@ -43,7 +43,13 @@ class SaleOrder(models.Model):
_('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)
uom_id = kwargs.pop('uom_id', None)
if uom is not None:
uom_id = uom
if uom_id:
uom_id = self.env['uom.uom'].browse(int(uom_id))
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."))
@ -51,15 +57,15 @@ class SaleOrder(models.Model):
if line_id is not False:
order_line = self._cart_find_product_line(product_id, line_id,
**kwargs)[:1]
if uom_id :
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)
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)
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)
@ -89,14 +95,13 @@ class SaleOrder(models.Model):
**kwargs,
)
else:
# If the line will be removed anyway, there is no need to verify
# the requested quantity update.
warning = ''
self._remove_delivery_line()
# Update order line
order_line = self._cart_update_order_line(product_id, quantity,
order_line,uom_id, **kwargs)
order_line, uom_id, **kwargs)
if (
order_line
@ -117,7 +122,6 @@ class SaleOrder(models.Model):
'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,
@ -134,7 +138,6 @@ class SaleOrder(models.Model):
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

12
website_product_uom_multi/static/description/index.html

@ -234,6 +234,18 @@
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial Commit for Website Call For Price.</p>
</div>
<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.1</span><span
class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:4th December 2024</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Fixed the uom issue on instant checkout</p>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save