Skip to content

create PO from SO link missing

We are actually creating PO's from SO's all the time. So I had to add a link to the "More" button in the SO. Why not add this link to vtiger in general, what speaks against such a link?

I added the following in the modules/SalesOrder/models/DetailView.php on line 36

$purchaseOrderModuleModel = Vtiger_Module_Model::getInstance('PurchaseOrder');
		if($currentUserModel->hasModuleActionPermission($purchaseOrderModuleModel->getId(), 'EditView')) {
		    $basicActionLink = array(
		            'linktype' => 'DETAILVIEW',
		            'linklabel' => vtranslate('LBL_CREATE').' '.vtranslate($purchaseOrderModuleModel->getSingularLabelKey(), 'PurchaseOrder'),
		            'linkurl' => $recordModel->getCreatePurchaseOrderUrl(),
		            'linkicon' => ''
		    );
		    $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
		}

And I added this function to modules/SalesOrder/models/Record.php

function getCreatePurchaseOrderUrl() {
	    $purchaseOrderModuleModel = Vtiger_Module_Model::getInstance('PurchaseOrder');
	
	    return "index.php?module=".$purchaseOrderModuleModel->getName()."&view=".$purchaseOrderModuleModel->getEditViewName()."&salesorder_id=".$this->getId();
	}

If you agree, I will make a merge request