Custom Script help: requiring Material Request reference for specific condition

29 views
Skip to first unread message

lxnow

unread,
Feb 25, 2014, 12:24:24 AM2/25/14
to erpnext-dev...@googlegroups.com
My intension to require a user to have a Material Request referenced in each stock entry line item (in Stock
Entry Details table) based on the following conditions:

1. purpose is material receipt
2. receiving location is Warehouse X (a specific warehouse)

In other words, for the specific Warehouse X, the user must create the Stock Entry from a Material Request if it is receiving via purpose material receipt. 

The script logic is to compare the # of line items vs the number of line items with a Material Request referenced. If # of lines > than lines with Material Request, the form should not save.

This is the more complete script: http://pastebin.com/Z3YJ52Se

Unfortunately, I think there is something wrong with the script as it makes saving the form not possible.

Nabin Hait

unread,
Feb 25, 2014, 2:15:02 AM2/25/14
to erpnext-dev...@googlegroups.com
--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/b247c936-41ea-45d3-93ba-9b6068e8e725%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

lxnow

unread,
Feb 25, 2014, 4:13:52 AM2/25/14
to erpnext-dev...@googlegroups.com
Thanks Nabin. Example works, but I had to add a closing parenthesis; have edited the wiki. And at least for hosted accounts, frappe.model.get doesn't work yet, so using wn.model.get instead.


On Tuesday, February 25, 2014 3:15:02 PM UTC+8, Nabin Hait wrote:
On 25-Feb-2014, at 10:54 am, lxnow <laur...@union.ph> wrote:

My intension to require a user to have a Material Request referenced in each stock entry line item (in Stock
Entry Details table) based on the following conditions:

1. purpose is material receipt
2. receiving location is Warehouse X (a specific warehouse)

In other words, for the specific Warehouse X, the user must create the Stock Entry from a Material Request if it is receiving via purpose material receipt. 

The script logic is to compare the # of line items vs the number of line items with a Material Request referenced. If # of lines > than lines with Material Request, the form should not save.

This is the more complete script: http://pastebin.com/Z3YJ52Se

Unfortunately, I think there is something wrong with the script as it makes saving the form not possible.

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
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+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages