[Vtigercrm-developers] Am I doing something stupid?
Alan Lord (News)
alanslists at gmail.com
Wed Nov 5 17:40:10 GMT 2014
Add a UI10 to the Asset module that links to the SalesOrder module. Add
a relatedList on the SalesOrder so you can see any related Assets using
get_dependents_list(). (See code below)
Now. If you select a Sales Order from the Edit view of an Asset all is
fine and it works.
If I go to a Sales Order and Select an Asset, the popup closes with no
errors but doesn't add the record.
Is this still an issue with 6.1.0? I thought this would have been fixed
so that it would either:
1. Not show the related records that already have a UI10 populated
2. Alert the user that they are about to change the relationship if it
is already linked.
Al
> // Get a handle to the module
> $module = Vtiger_Module::getInstance('Assets');
> $salesorder = Vtiger_Module::getInstance('SalesOrder');
>
> // Get the main Block
> $block_main = Vtiger_Block::getInstance('LBL_ASSET_INFORMATION', $module);
>
> /*** Main Block ***/
> $field = Vtiger_Field::getInstance('relsalesorderid', $module);
> if ($field != false) {
> $field->unsetRelatedModules(Array('SalesOrder'));
> $field->delete();
> }
> $field = new Vtiger_Field();
> $field->name = 'relsalesorderid';
> $field->column = $field->name;
> $field->label = 'Sales Order';
> $field->columntype = 'INT(11)';
> $field->uitype = 10;
> $field->typeofdata = 'V~O';
> $block_main->addField($field);
> $field->setRelatedModules(Array('SalesOrder'));
> unset($field);
>
> $salesorder->unsetRelatedList($module, 'Assets', 'get_dependents_list');
> $salesorder->setRelatedList($module, 'Assets', Array('SELECT'), 'get_dependents_list');
--
Libertus Solutions
http://www.libertus.co.uk
More information about the vtigercrm-developers
mailing list