Re: [erpnext-dev] [erpnext-user-forum] User Permission for Cancel and Ammend

Hi Mahesh,

I am forwarding this on the developer's forum and I will add you to it. Please continue this discussion on the developer forum.

Thanks,
Anand.

On 19-Mar-2013, at 6:14 PM, Mahesh Malani <ma...@gmail.com> wrote:

Was exploring the possible options, but have failed to derive required result for the following user permission scenario.

Existing

USER-A is a accounts user. User-A does have permission to submit a sales invoice but doesnot have permission to cancel and ammend the same.

Expected.
USER-A is a accounts user. User-A has permission to submit a sales invoice, also Conditionally has permission to cancel and ammend IF sales invoice value is less than certain value, and IF sales invoice date = current date / todays date

same goes for Delivery note,
same goes for Sales Order
Same goes for Quotations too !!


The above may not be possible in standard settings, but can the developers guide / build script to help the above to achieved.

Awaiting replies.



Regards,
Mahesh




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hi Mahesh,

You should give "Cancel" permission to "Accounts User" role. And to restrict cancel permission based on grand total, you have to write small custom script. 

I have added a sample code on github wiki. Refer "Cancel permission base don grand total" section on this page https://github.com/webnotes/wnframework/wiki/Client-side-scripting


Regards,
Nabin Hait

On 19-Mar-2013, at 6:17 PM, Anand Doshi wrote:

Hi Mahesh,

I am forwarding this on the developer's forum and I will add you to it. Please continue this discussion on the developer forum.

Thanks,
Anand.

On 19-Mar-2013, at 6:14 PM, Mahesh Malani <ma...@gmail.com> wrote:

Was exploring the possible options, but have failed to derive required result for the following user permission scenario.

Existing

USER-A is a accounts user. User-A does have permission to submit a sales invoice but doesnot have permission to cancel and ammend the same.

Expected.
USER-A is a accounts user. User-A has permission to submit a sales invoice, also Conditionally has permission to cancel and ammend IF sales invoice value is less than certain value, and IF sales invoice date = current date / todays date

same goes for Delivery note,
same goes for Sales Order
Same goes for Quotations too !!


The above may not be possible in standard settings, but can the developers guide / build script to help the above to achieved.

Awaiting replies.



Regards,
Mahesh




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 





You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Hello Nahin,

I see a script is already written as per follows.

cur_frm.cscript.custom_before_cancel = function(doc) {
if (user_roles.indexOf("Accounts User")!=-1 && user_roles.indexOf("Accounts Manager")==-1
&& user_roles.indexOf("System Manager")==-1) {
if (flt(doc.grand_total) > 10000) {
msgprint("You can not cancel this transaction, because grand total
is greater than 10000");
validated = false;
}
}
}

My query is where do include this script ?
Sorry for a very basic question , as I am new to this.


Regards,
Mahesh


On Wed, Mar 20, 2013 at 11:53 AM, Nabin Hait <na…@gmail.com> wrote:

Hi Mahesh,

You should give "Cancel" permission to "Accounts User" role. And to restrict cancel permission based on grand total, you have to write small custom script.

I have added a sample code on github wiki. Refer "Cancel permission base don grand total" section on this page https://github.com/webnotes/wnframework/wiki/Client-side-scripting


Regards,
Nabin Hait

On 19-Mar-2013, at 6:17 PM, Anand Doshi wrote:

Hi Mahesh,

I am forwarding this on the developer's forum and I will add you to it. Please continue this discussion on the developer forum.

Thanks,
Anand.

On 19-Mar-2013, at 6:14 PM, Mahesh Malani <ma...@gmail.com> wrote:

Was exploring the possible options, but have failed to derive required result for the following user permission scenario.

Existing

USER-A is a accounts user. User-A does have permission to submit a sales invoice but doesnot have permission to cancel and ammend the same.


Expected.
USER-A is a accounts user. User-A has permission to submit a sales invoice, also Conditionally has permission to cancel and ammend IF sales invoice value is less than certain value, and IF sales invoice date = current date / todays date


same goes for Delivery note,
same goes for Sales Order
Same goes for Quotations too !!


The above may not be possible in standard settings, but can the developers guide / build script to help the above to achieved.


Awaiting replies.



Regards,
Mahesh




You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.








You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.



For more options, visit https://groups.google.com/groups/opt_out.







You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.



For more options, visit https://groups.google.com/groups/opt_out.







You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

HI Mahesh,

You have to insert this script in Custom Script for each of "Sales Order", "Delivery Note" and "Quotation".

Thanks,
Anand.

On 20-Mar-2013, at 5:01 PM, Mahesh <ma...@maheshengg.com> wrote:

Hello Nahin,

I see a script is already written as per follows.

cur_frm.cscript.custom_before_cancel = function(doc) {
    if (user_roles.indexOf("Accounts User")!=-1 && user_roles.indexOf("Accounts Manager")==-1
            && user_roles.indexOf("System Manager")==-1) {
        if (flt(doc.grand_total) > 10000) {
            msgprint("You can not cancel this transaction, because grand total \
                is greater than 10000");
            validated = false;
        }
    }
}

My query is where do include this script ?
Sorry for a very basic question , as I am new to this.


Regards,
Mahesh


On Wed, Mar 20, 2013 at 11:53 AM, Nabin Hait <na...@gmail.com> wrote:
Hi Mahesh,

You should give "Cancel" permission to "Accounts User" role. And to restrict cancel permission based on grand total, you have to write small custom script. 

I have added a sample code on github wiki. Refer "Cancel permission base don grand total" section on this page https://github.com/webnotes/wnframework/wiki/Client-side-scripting


Regards,
Nabin Hait

On 19-Mar-2013, at 6:17 PM, Anand Doshi wrote:

Hi Mahesh,

I am forwarding this on the developer's forum and I will add you to it. Please continue this discussion on the developer forum.

Thanks,
Anand.

On 19-Mar-2013, at 6:14 PM, Mahesh Malani <ma...@gmail.com> wrote:

Was exploring the possible options, but have failed to derive required result for the following user permission scenario.

Existing

USER-A is a accounts user. User-A does have permission to submit a sales invoice but doesnot have permission to cancel and ammend the same.


Expected.
USER-A is a accounts user. User-A has permission to submit a sales invoice, also Conditionally has permission to cancel and ammend IF sales invoice value is less than certain value, and IF sales invoice date = current date / todays date


same goes for Delivery note,
same goes for Sales Order
Same goes for Quotations too !!


The above may not be possible in standard settings, but can the developers guide / build script to help the above to achieved.


Awaiting replies.



Regards,
Mahesh




You received this message because you are subscribed to the Google Groups “ERPNext User’s Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 





You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.



For more options, visit https://groups.google.com/groups/opt_out.

 

 





You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.



For more options, visit https://groups.google.com/groups/opt_out.

 

 





You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 




You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

 

 

Great !
Got it. I will start with Invoice first. ( Sales Invoice )


Regards,
Mahesh

On Wed, Mar 20, 2013 at 5:04 PM, Anand Doshi <an…@iwebnotes.com> wrote:

HI Mahesh,

You have to insert this script in Custom Script for each of "Sales Order", "Delivery Note" and "Quotation".

Thanks,
Anand.

On 20-Mar-2013, at 5:01 PM, Mahesh <ma...@maheshengg.com> wrote:

Hello Nahin,

I see a script is already written as per follows.

cur_frm.cscript.custom_before_cancel = function(doc) {
    if (user_roles.indexOf("Accounts User")!=-1 && user_roles.indexOf("Accounts Manager")==-1
            && user_roles.indexOf("System Manager")==-1) {
        if (flt(doc.grand_total) > 10000) {
            msgprint("You can not cancel this transaction, because grand total \
                is greater than 10000");
            validated = false;
        }
    }
}

My query is where do include this script ?
Sorry for a very basic question , as I am new to this.


Regards,
Mahesh


On Wed, Mar 20, 2013 at 11:53 AM, Nabin Hait <na...@gmail.com> wrote:
Hi Mahesh,

You should give "Cancel" permission to "Accounts User" role. And to restrict cancel permission based on grand total, you have to write small custom script.

I have added a sample code on github wiki. Refer "Cancel permission base don grand total" section on this page https://github.com/webnotes/wnframework/wiki/Client-side-scripting


Regards,
Nabin Hait

On 19-Mar-2013, at 6:17 PM, Anand Doshi wrote:

Hi Mahesh,

I am forwarding this on the developer's forum and I will add you to it. Please continue this discussion on the developer forum.

Thanks,
Anand.

On 19-Mar-2013, at 6:14 PM, Mahesh Malani <ma...@gmail.com> wrote:

Was exploring the possible options, but have failed to derive required result for the following user permission scenario.

Existing

USER-A is a accounts user. User-A does have permission to submit a sales invoice but doesnot have permission to cancel and ammend the same.


Expected.
USER-A is a accounts user. User-A has permission to submit a sales invoice, also Conditionally has permission to cancel and ammend IF sales invoice value is less than certain value, and IF sales invoice date = current date / todays date


same goes for Delivery note,
same goes for Sales Order
Same goes for Quotations too !!


The above may not be possible in standard settings, but can the developers guide / build script to help the above to achieved.


Awaiting replies.



Regards,
Mahesh




You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-forum+un…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.








You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.



For more options, visit https://groups.google.com/groups/opt_out.








You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.



For more options, visit https://groups.google.com/groups/opt_out.








You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.







You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To post to this group, send email to er…@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.







You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

To post to this group, send email to er...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.