AnsweredAssumed Answered

TypeError: Cannot read property 'moduleList' of undefined in Reports Module.

Question asked by cormacio100 cormacio100 on Sep 28, 2015
I'm using SugarCRM pro v 6.5 and have made a customisation to a Rows and Columns report displaying Opportunities.
I added a reporting only field. The value displayed in the field is the opportunity amount / fx rate of opportunity.
I was able to add the new field in the edit screen initially the Customisation looks to have worked ok in the Listview but now when i click to edit the report the screen appears blank.

I get error TypeError: Cannot read property 'moduleList' of undefined in Reports Module on report.js line 527. Report.js does indeed appear to show module as undefined


              SUGAR.reports.filterFieldsMenu=myContextMenu;myContextMenu.render(document.body);myContextMenu.show();},buildTree:function(module){var module_str=module;if(typeof SUGAR.language.languages['app_list_strings']['moduleList'][module]!='undefined'){module_str=SUGAR.language.languages['app_list_strings']['moduleList'][module];} 


The method I followed to do this customisation is as follows:
Stage 1:
1. Created a custom vardef called - pr_amount_reporting - in custom/Extension/modules/Opportunities/Ext/Vardefs folder.

2. Copyied the vardef definition of the Opportunity Amount field into the pr_amount_reporting vardef and changed the name attribute of the vardef to pr_amount_reporting.

3. I set the reportable attribute on the custom vardef to true and false on the original vardef to prevent the original field from being available to reports.

4. Create corresponding LABEL to match vname from custom vardef in language Language file. 
custom/Extension/modules/Opportunities/Ext/Language/en_us.Provident.php
Ran a repair/rebuild (administration section) to create the new field

Stage 2:

1. In custom/modules/Opportunities create a logic_hooks.php file contains pointer t$hook_array['before_save'][] = Array(1, 'set Probability based on Forcast Category', 'custom/modules/Opportunities/opp_hook.php','OpportunityHook', 'updateProbability');
2. In the updateProbability function of opp_hook.php I added the logic
$bean->pr_amount_reporting = $bean->amount / $bean->pr_active_conversion_rate;


4. That saved save the amount by the active fx rate to the field in the database every time the record is saved.

--------------------
I have tried downloading a clean version of the code and started again but got the exact same error.

Any idea how to fix this error?

Outcomes