How to set permission level for individual row record in child table

88 views
Skip to first unread message

Madhukar Bansode

unread,
Jun 19, 2012, 7:40:02 AM6/19/12
to erpnext-dev...@googlegroups.com
Hello All,

Is there any way to implement something like setting permission level to child table row.?

for example

var b = getchildren('Billing History Details', doc.name, 'billing_history_details'); 
 for(i = 0; i<b.length; i++){
   if (b[i].invoice_no = ='123'){
         //SET PERMISSION to b[i]th record in child table LIKE b[i].per_level=2
    }
 }

Rushabh Mehta

unread,
Jun 19, 2012, 9:19:48 AM6/19/12
to erpnext-dev...@googlegroups.com
One idea I can think of is to override the click event in the grid and call the original function based on your condition. I think it should work.

Sent from  mobile
--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/W51A-3HGqVAJ.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/erpnext-developer-forum?hl=en.

Madhukar Bansode

unread,
Jun 19, 2012, 9:26:26 AM6/19/12
to erpnext-dev...@googlegroups.com
Rushbh,

Didn't get you,,,,,!!!! any sample code or elaboration of the process would be appreciated.

thanks
--
Thanks and Regards,
Madhukar S Bansode
New Indictrans technologies PVT.LTD.
Cell No.+91-7709199414
www.indictranstech.com


DECLAIMER
This e-mail has arrived in your e-mail Inbox from  New Indictrans Technologies Private Limited, Pune. Please do visit http://www.indictranstech.com/  to know more about New Indictrans Technologies Private Limited. This email is not spam. We follow 'US Unsolicited Electronic Mail Act of 2000', which states that an e-mail cannot be considered SPAM if it contains contact/removal information, which this e-mail does. This e-mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If, by an addressing or transmission error, this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or it's attachment(s) other than by its intended recipient(s) is strictly prohibited. Any opinions expressed in this email are those of the individual and not necessarily of the organisation. Before opening attachment(s), please scan the attachment for viruses.". In case & if you do not wish to receive e-mail (the way you have received it today for what so ever cause or reasons) in near future? Reply back to this emai l saying "Remove e-mail ID". Within two working days your ID will be removed.

Anand Doshi

unread,
Jun 19, 2012, 9:34:07 AM6/19/12
to erpnext-dev...@googlegroups.com
Hi,

If you want to set permission level of a whole column of the grid, you can use:
cur_frm.fields_dict.[fieldname of grid in parent
doctype].grid.get_field([fieldname of field in the grid]).df.permlevel
= 1

replace with appropriate fieldnames in [ ].

You can try using web console, if you have a form open.

Thanks,
Anand.

On Tue, Jun 19, 2012 at 6:56 PM, Madhukar Bansode

Rushabh Mehta

unread,
Jun 20, 2012, 1:01:55 AM6/20/12
to erpnext-dev...@googlegroups.com
_f.Grid.prototype.orig_cell_select = _f.Grid.prototype.cell_select

_f.Grid.prototype.cell_select = function(cell, ri, ci) {
     var row_doc = locals['Billing History Details'][cell.docname];
      if (row_doc.invoice_no = ='123'){  
        msgprint("Not editable");
      } else { 
        // editable
        this.orig_cell_select(cell, ri, ci); 
      }
}

I think this should work - you might have have to do minor tweaking. 

Next time you want me to baby-sit - give us some consulting fees :) or better - a few pull requests!

best,
Rushabh
Reply all
Reply to author
Forward
0 new messages