From 801f378fbfff929b74a4f0b79916a1d1b5eeefe8 Mon Sep 17 00:00:00 2001
From: yogeshwar <yogeshwar@vtigersolution.com>
Date: Wed, 24 Apr 2024 16:06:02 +0530
Subject: [PATCH] Fixes:Restricted Qty/Unit by updating automatically

---
 layouts/v7/modules/Vtiger/RelatedList.tpl | 2 +-
 modules/Products/views/InRelation.php     | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/layouts/v7/modules/Vtiger/RelatedList.tpl b/layouts/v7/modules/Vtiger/RelatedList.tpl
index 5566baeda..9e4c531f4 100644
--- a/layouts/v7/modules/Vtiger/RelatedList.tpl
+++ b/layouts/v7/modules/Vtiger/RelatedList.tpl
@@ -109,7 +109,7 @@
 											<a data-url="index.php?module=PriceBooks&view=ListPriceUpdate&record={$PARENT_RECORD->getId()}&relid={$RELATED_RECORD->getId()}&currentPrice={$LISTPRICE}"
 												class="editListPrice cursorPointer" data-related-recordid='{$RELATED_RECORD->getId()}' data-list-price={$LISTPRICE}
 										{else if $MODULE eq 'Products' && $RELATED_MODULE_NAME eq 'Products' && $TAB_LABEL === 'Product Bundles' && $RELATED_LIST_LINKS && $PARENT_RECORD->isBundle()}
-											{assign var=quantity value=$RELATED_RECORD->get($RELATION_FIELD->getName())}
+											{assign var=quantity value=$RELATED_RECORD->get('qty_per_unit')}
 											<a class="quantityEdit"
 												data-url="index.php?module=Products&view=SubProductQuantityUpdate&record={$PARENT_RECORD->getId()}&relid={$RELATED_RECORD->getId()}&currentQty={$quantity}"
 												onclick ="Products_Detail_Js.triggerEditQuantity('index.php?module=Products&view=SubProductQuantityUpdate&record={$PARENT_RECORD->getId()}&relid={$RELATED_RECORD->getId()}&currentQty={$quantity}');if(event.stopPropagation){ldelim}event.stopPropagation();{rdelim}else{ldelim}event.cancelBubble=true;{rdelim}"
diff --git a/modules/Products/views/InRelation.php b/modules/Products/views/InRelation.php
index 951ea07d2..eed5d0712 100644
--- a/modules/Products/views/InRelation.php
+++ b/modules/Products/views/InRelation.php
@@ -81,7 +81,6 @@ class Products_InRelation_View extends Vtiger_RelatedList_View {
 		$subProductsCostsInfo = array();
 		if ($moduleName === $relatedModuleName && $relationListView->tab_label === 'Product Bundles') {//Products && Child Products
 			$parentModuleModel = $parentRecordModel->getModule();
-			$relationField = $parentModuleModel->getField('qty_per_unit');
 
 			if ((!$request->get('sortorder') && !$request->get('page'))) {
 				$parentRecordModel->set('currency_id', getProductBaseCurrency($parentId, $parentModuleModel->getName()));
-- 
GitLab