[Vtigercrm-developers] Readonly fields at record-level?

Alan Lord (News) alanslists at gmail.com
Fri Jan 16 12:51:15 GMT 2015


On 07/01/15 21:06, Jonathan Sardo wrote:
> Hi!
>
> I think you can override the Field model to manage this.

Thanks for the suggestion.

To recap, I want to be able to make a bunch of fields (in Accounts, but 
that's not important) read-only based on the value of another field in 
the record (a Picklist value as it happens). So this is record level 
control not module level or user level.

Looking at the code, I can see I can override the isEditable() function 
in the Field model to return false for a given field id.

But to get the information regarding the current record's value (that 
will determine if it should be read-only or not) into the Field model 
for checking, it looks like I need to pass it into the Block model first 
via the getFields() function which is called from the {Detail or Edit} 
Record Structure models...

Is there an easier, or more straightforward mechanism to get the 
*current* record model (or even just a bool value) straight into the 
Field Model?

Thanks

Al



-- 
Libertus Solutions
http://www.libertus.co.uk



More information about the vtigercrm-developers mailing list