API for ERPNext

1,206 views
Skip to first unread message

Rushabh Mehta

unread,
Dec 19, 2012, 6:41:39 AM12/19/12
to erpnext-dev...@googlegroups.com, erpnext-user-forum@googlegroups.com Forum
Dear all,

Since there has been some interest off and on for this, I have created a very alpha level script for those who are interested to integrate other 3rd party tools into ERPNext.

The schematics are very simple and the script is pretty self-expalnatory.


Please ping us on the Developer Forum if you have any difficulty. If you are able to integrate any app, please share with us so other users can also benefit.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

Amin Zayani

unread,
Jan 4, 2013, 9:12:45 AM1/4/13
to erpnext-dev...@googlegroups.com, erpnext-user-forum@googlegroups.com Forum
Great!
Any chance you add a "read" method to fetch data from ERPNext? And include a simple example for fetching some doctype?

Thanks

Rushabh Mehta

unread,
Jan 7, 2013, 12:02:55 AM1/7/13
to erpnext-dev...@googlegroups.com
Just updated client.py with

webnotes.client.get

pass "doctype" and "name" as parameters

example:

cmd=webnotes.client.get&doctype=[doctype]&name=[name]

you will get a JSON object with a list of main record and the child records (if any)


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/yzLMPR9UcxsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta

Rushabh Mehta

unread,
Jan 7, 2013, 12:08:22 AM1/7/13
to erpnext-dev...@googlegroups.com

Amin Zayani

unread,
Jan 7, 2013, 6:43:02 AM1/7/13
to erpnext-dev...@googlegroups.com, jona...@fritzing.org
Thanks for making the 3rd party API script available. We are newbies at ERPNext, so please excuse the following questions if the answers should be obvious.

In our tests using the sample code fromhttps://github.com/webnotes/wnframework/blob/master/webnotes/utils/webclient.py, we have not been able to get past login--we get a 404 response.  We are trying variations of "http://{our local erpnext server}/webnotes/erpnext_master/public/server.py" as the server address.  Our ERPNext is installed simply on a Ubuntu 12.10 virtual machine on a local server and is also accessible outside our LAN through a subdomain of our site, so we were trying, for example, "http://{our local erpnext server}/public/server.py". Can you give us any hints about what the url should be? (We also tried "client.py" instead of "server.py").

We are also not entirely certain that we have updated ERPNext correctly in order to install the correct "client.py" file into the proper location. Can you tell us how to ascertain whether we have the correct file and it's in the expected place?  Once it's in the right place do we need to set any permissions? (because the repository updated is webnotes framework and we only update our ERPNext repository version)

Thanks.
To unsubscribe from this group, send email to erpnext-developer-forum+unsub...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/yzLMPR9UcxsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
--



Twitter: @rushabh_mehta

Rushabh Mehta

unread,
Jan 7, 2013, 7:10:56 AM1/7/13
to erpnext-dev...@googlegroups.com
Amin,

Thanks for making the 3rd party API script available. We are newbies at ERPNext, so please excuse the following questions if the answers should be obvious.

In our tests using the sample code fromhttps://github.com/webnotes/wnframework/blob/master/webnotes/utils/webclient.py, we have not been able to get past login--we get a 404 response.  We are trying variations of "http://{our local erpnext server}/webnotes/erpnext_master/public/server.py" as the server address.  Our ERPNext is installed simply on a Ubuntu 12.10 virtual machine on a local server and is also accessible outside our LAN through a subdomain of our site, so we were trying, for example, "http://{our local erpnext server}/public/server.py". Can you give us any hints about what the url should be? (We also tried "client.py" instead of "server.py").

Don't use /public/server.py --- just use {local erpnext server}/server.py

Since all requests are passed via server.py (and this should be accessible via your browser). So set "server" to that url (which is server.py replaced by app.html)

We are also not entirely certain that we have updated ERPNext correctly in order to install the correct "client.py" file into the proper location. Can you tell us how to ascertain whether we have the correct file and it's in the expected place?  Once it's in the right place do we need to set any permissions? (because the repository updated is webnotes framework and we only update our ERPNext repository version)

the webclient.py file can be anywhere because it accesses the system via http requests.

Also webclient.py is a template and you can use that code to access data from anywhere.

To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/QpP1CwrCuW8J.

Amin Zayani

unread,
Jan 7, 2013, 8:10:23 AM1/7/13
to erpnext-dev...@googlegroups.com
Thanks for the quick reply.  We should have thought to test the simplest server.py url. We get back the following json in response to the login.

{u'message': u'', u'exc': u'"Traceback (innermost last):\\n  File \\"../lib/webnotes/handler.py\\", line 159, in handle\\n execute_cmd(cmd)\\n  Fil
e \\"../lib/webnotes/handler.py\\", line 176, in execute_cmd\\n method = get_method(cmd)\\n  File \\"../lib/webnotes/handler.py\\", line 218, in ge
t_method\\n    method = globals()[cmd]\\n KeyError: u\\"[\'login\', \'login\']\\"\\n"'}

Any suggestions?

Thanks again.

PS: my colleague Jonathan will join this thread
Amin,

Rushabh Mehta

unread,
Jan 7, 2013, 8:43:00 AM1/7/13
to erpnext-dev...@googlegroups.com
Can you post the entire url? I think you need to pass login id and password as the url parameters

For example you can login via:

server.py?cmd=login&usr=Administrator&pwd=admin

If you are passwords are correctly set.


To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/9sfw-iCSHTkJ.

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

Jonathan

unread,
Jan 7, 2013, 9:02:48 AM1/7/13
to erpnext-dev...@googlegroups.com
Here's the redacted url returned from response.get().  Odd that all the params are doubled.

https://{server}/server.py?pwd={password}&cmd=login&usr={user}&pwd={password}&cmd=login&usr={user}

We are using the sample code llinked to earlier in the forum, only changing the server, user, and password parameters at the top (we also changed response.json.get() to response.json().get()--the code wouldn't work otherwise).

Thanks.
Amin,

To unsubscribe from this group, send email to erpnext-developer-forum+unsubscr...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/yzLMPR9UcxsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
--



Twitter: @rushabh_mehta



--



Twitter: @rushabh_mehta

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer-forum+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/QpP1CwrCuW8J.
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 post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer-forum+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/9sfw-iCSHTkJ.

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

Rushabh Mehta

unread,
Jan 7, 2013, 9:19:45 AM1/7/13
to erpnext-dev...@googlegroups.com
The test runs fine on my setup. I think your installation may be messed up.

What do you get when you run that from the browser?

Sent from mobile
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/AtBNp4DGZjsJ.

Jonathan

unread,
Jan 7, 2013, 9:47:39 AM1/7/13
to erpnext-dev...@googlegroups.com
Thanks for the suggestion. The problem seems to be the weird parameter-doubling from the 'requests' module.  Now the login is working...

- j

Jonathan

unread,
Jan 11, 2013, 1:30:00 PM1/11/13
to erpnext-dev...@googlegroups.com
Hi, sorry, me again.

We are trying to create--and optionally update--a Customer doctype based on the script that started this thread.  We are able to create a customer, but so far we have not been able to create a customer where the customer_name is different from the name.  In other words we have a unique name for the Customer ("johndoe123"), which is what we want the doctype to be referenced by, but we want the customer's name to be "John Doe". Once the Customer doctype is created we can change the customer name using the ERPNext API, but we were unable to create the customer that way or update it thereafter. In particular, the update function returns a message that says "Document has been modified after you have opened it."

Could you point us in the right direction?

Thanks.

Rushabh Mehta

unread,
Jan 11, 2013, 10:28:50 PM1/11/13
to erpnext-dev...@googlegroups.com
Jonathan, you have to "get" the customer after save, rename it and save gain. The system will only save if the incoming record's "modified" property matches with the one in the database to maintain version conflicts.

Sent from mobile
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/d1YRSsSA8U8J.

Jonathan

unread,
Jan 16, 2013, 2:19:26 PM1/16/13
to erpnext-dev...@googlegroups.com
Thanks for the reply. What we are trying to do is update a complex doctype from a script--specifically we are trying to update a BOM--that is to say, update some subset of BOM Items for a given BOM. The first approach was to try get_doc on an individual BOM Item, passing in the parent BOM name and the item_code of the particular Bom Item as parameters. Various experiments along those lines got us the response that get takes 2 arguments and only 1 is given.

The next approach was to read the entire BOM using get_doc (this works fine), modify the fields in question, then call update. But this puts the entire pile of json into the url. Experiments trying to move the data into the body of the POST didn't get anywhere.

Can you suggest a way forward?

Thanks very much.

- j

Rushabh Mehta

unread,
Jan 17, 2013, 12:49:25 AM1/17/13
to erpnext-dev...@googlegroups.com
Jonathan,

The way to do this would be to first get, update and push.

You can send the list of dicts (we call it a doclist) via a POST request. It should work - where are you getting stuck? Is there a specific error message?

- Rushabh


W: https://erpnext.com
T: @rushabh_mehta

To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/sso_-D03AMEJ.

Jonathan

unread,
Jan 21, 2013, 8:22:22 AM1/21/13
to erpnext-dev...@googlegroups.com
Hi.  I am still unable to get update to work and am asking two specific questions.

1. We have a BOM doctype which contains a number of individual BOM Item doctypes. Is it possible to read and update an individual BOM Item from a BOM doctype, or must one read the entire BOM and update the whole thing at once? So far I have only managed to read the entire BOM, but not an individual BOM Item.

2: Since I cannot so far read individual BOM Items, I am trying to update the entire BOM doctype. My update script works successfully if the BOM contains only a single BOM Item, but fails if there are two BOM Items. Why is that?

My script uses the same functions for get_doc(), login(), update(), etc. that you posted here: https://github.com/webnotes/wnframework/blob/master/webnotes/utils/webclient.py. In the original update function, the doclist is added to the params argument of requests.post(), which means the entire doclist is added to the request url. Specifically, I am doing the following:

doc = get_doc("BOM", bom)
rows = doc.json().get("message")
for row in rows
# change Qty if a certain condition is met
update(rows)

If there is one BOM Item in the BOM, the update is successful.  With two or more Bom Items, I get the following traceback:

Traceback (most recent call last):
  File "...\updateqty.py", line 187, in <module>
    main()
  File "...\updateqty.py", line 182, in main
    update(server, rows);
  File "...\updateqty.py", line 50, in update
    "doclist": json.dumps(doclist)
  File "...\updateqty.py", line 62, in request
    response = requests.post(server, cookies = {"sid": sid}, params=params)
  File "C:\Python27\lib\site-packages\requests\api.py", line 87, in post
    return request('post', url, data=data, **kwargs)
  File "C:\Python27\lib\site-packages\requests\api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 279, in request
    resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
  File "C:\Python27\lib\site-packages\requests\sessions.py", line 374, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\site-packages\requests\adapters.py", line 222, in send
    r.content
  File "C:\Python27\lib\site-packages\requests\models.py", line 550, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "C:\Python27\lib\site-packages\requests\models.py", line 496, in generate
    chunk = self.raw.read(chunk_size)
  File "C:\Python27\lib\site-packages\requests\packages\urllib3\response.py", line 148, in read
    return self._fp.read(amt)
  File "C:\Python27\lib\httplib.py", line 561, in read
    s = self.fp.read(amt)
  File "C:\Python27\lib\httplib.py", line 1298, in read
    return s + self._file.read(amt - len(s))
  File "C:\Python27\lib\socket.py", line 380, in read
    data = self._sock.recv(left)
socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host

If instead I try to extend the update to use the "data" argument (which puts the data into the body of the post rather than the url), something like:

response = requests.post(server, cookies = {"sid": sid}, params=params, data=data)

where params= {
"cmd": "webnotes.client.save"
}
and data= {
"doclist": json.dumps(doclist) 
}

I get the following result from ERPNext:

{u'message': u'', u'exc': u'"Traceback (innermost last):\\n  File \\"../lib/webnotes/handler.py\\", line 159, in handle\\n    execute_cmd(cmd)\\n  File \\"../lib/webnotes/handler.py\\", line 191, in execute_cmd\\n    ret = call(method, webnotes.form_dict)\\n  File \\"../lib/webnotes/handler.py\\", line 210, in call\\n    return fn(**newargs)\\n TypeError: save() takes exactly 1 argument (0 given)\\n"'}

Can you suggest the right approach for updating either individual BOM Items or the entire BOM?

Thank you for your help.


 

Rushabh Mehta

unread,
Jan 21, 2013, 9:30:54 AM1/21/13
to erpnext-dev...@googlegroups.com
Jonathan,

Your second approach is correct. You need to do a POST. You are not able send 2 items because of the URL limit in GET.

From the traceback, the parameters are not getting mapped correctly - can you debug the POST a bit?

I am sure you are pretty close to the solution.

best,
Rushabh



To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/BiY2q-sq-2gJ.

Jonathan

unread,
Jan 21, 2013, 12:46:46 PM1/21/13
to erpnext-dev...@googlegroups.com
Hi Rushabh,

Had to change the update() method to use both params and data arguments, and the requests module under both mac and windows didn't seem to fill in the POST request body. Finally got it all to work under linux.

def request(server, params=None, data=None):
    global sid
    
    if not sid: login()
    
    response = requests.post(server, cookies = {"sid": sid}, params=params, data=data)


Thanks for the suggestions.

- j

Rushabh Mehta

unread,
Jan 22, 2013, 1:52:05 AM1/22/13
to erpnext-dev...@googlegroups.com
Jonathan,

Great.

Are you running the latest update of the requests module? I did not encounter this error on my Mac.


Anyways, I updated the webclient.py to use posts when required.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/NDrHqRjqDQEJ.

Jonathan

unread,
Jan 29, 2013, 11:06:55 AM1/29/13
to erpnext-dev...@googlegroups.com
Hi Rushabh,

I have updated all the scripts, but I am happy enough if it all works under Linux.

Would it be possible to have a generalization of get_doc along the following lines:

def get_doc(server, doctype, name, value):
    return request(server, { "cmd":"webnotes.client.get", "doctype":doctype, name:value})

because, for example for retrieving a sales order, I may know the purchase order number but not the sales order name.

Thanks.

- j





Rushabh

Rushabh Mehta

unread,
Jan 30, 2013, 12:27:34 AM1/30/13
to erpnext-dev...@googlegroups.com
Jonathan,

I am assuming you want something like a search based on a filter. I think it should be possible.

- Rushabh


W: https://erpnext.com
T: @rushabh_mehta

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

To post to this group, send email to erpnext-dev...@googlegroups.com.

Rushabh Mehta

unread,
Jan 30, 2013, 12:37:22 AM1/30/13
to erpnext-dev...@googlegroups.com



W: https://erpnext.com
T: @rushabh_mehta

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

Jonathan

unread,
Jan 30, 2013, 7:18:59 AM1/30/13
to erpnext-dev...@googlegroups.com
Hi Rushabh,

Thanks, that great--I am already using the new code.

- j
Here you go:

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

Jonathan

unread,
Feb 5, 2013, 12:17:34 PM2/5/13
to erpnext-dev...@googlegroups.com
Hi Rushabh,

Is there already a script equivalent to "submit", or if not would you consider adding it?

Rushabh Mehta

unread,
Feb 5, 2013, 10:29:42 PM2/5/13
to erpnext-dev...@googlegroups.com
Added submit and cancel methods. Check webclient.py



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

To post to this group, send email to erpnext-dev...@googlegroups.com.

Jonathan

unread,
Feb 6, 2013, 10:49:17 AM2/6/13
to erpnext-dev...@googlegroups.com
Thanks for the quick turnaround. Is there a way to tell whether a document is saved, submitted, or cancelled?  I had guessed docstatus, but that doesn't seem to change, at least between saved and submittted.

Cheers,

- j

Rushabh Mehta

unread,
Feb 6, 2013, 10:02:02 PM2/6/13
to erpnext-dev...@googlegroups.com
Jonathan,

You are right, docstatus=0 is saved, 1 is submitted and 2 is cancelled. After every save, submit, a new doclist is returned in the response. Check the docstatus of the docs in that list, the status should have been updated.

best,
Rushabh


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

To post to this group, send email to erpnext-dev...@googlegroups.com.

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

Jonathan

unread,
Mar 10, 2013, 3:44:19 AM3/10/13
to erpnext-dev...@googlegroups.com, erpnext-user-forum@googlegroups.com Forum

Hi Rushabh,

Would there be any chance of adding a "print" to the API? I guess it would take doctype, name, and a format as arguments, and return (or somehow give access to) the pdf.

Thanks.

- j

Rushabh Mehta

unread,
Mar 11, 2013, 12:27:13 AM3/11/13
to erpnext-dev...@googlegroups.com
Jonathan,

Unfortunately thats not easy at the moment because our prints are build in the client (using JS). We are aware its a bad design and its on our re-write agenda. Will keep you updated on the forum when its done. Estimating about a month or so.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

--
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 post to this group, send email to erpnext-dev...@googlegroups.com.

Amin Zayani

unread,
May 7, 2013, 12:05:49 PM5/7/13
to erpnext-dev...@googlegroups.com, erpnext-user-forum@googlegroups.com Forum
Hi Rushabh,

is there any method to attach a file to adoctype using the API?

Thanks

Amin


On Wednesday, December 19, 2012 12:41:39 PM UTC+1, rushabh wrote:
Dear all,

Since there has been some interest off and on for this, I have created a very alpha level script for those who are interested to integrate other 3rd party tools into ERPNext.

The schematics are very simple and the script is pretty self-expalnatory.


Please ping us on the Developer Forum if you have any difficulty. If you are able to integrate any app, please share with us so other users can also benefit.

Rushabh Mehta

unread,
May 8, 2013, 1:01:00 AM5/8/13
to erpnext-dev...@googlegroups.com
Amin,

Here are the query (form) parameters for a POST call:

cmd=uploadfile
from_form=1
filename=[name of file]
filedata=[file data encoded as base64]
doctype=[name of doctype to attach to]
docname=[doc name to attach to]

OR to attach a file as URL

cmd=uploadfile
from_form=1
file_url=[url of the file to be attached]
doctype=[name of doctype to attach to]
docname=[doc name to attach to]

best,
Rushabh




--
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 post to this group, send email to erpnext-dev...@googlegroups.com.

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

Amin Zayani

unread,
May 30, 2013, 10:29:53 AM5/30/13
to erpnext-dev...@googlegroups.com
Hi Rushabh,

now that the print templates are server generated, is there any chance to have a "print" method accessible by the API?

Best regards,

Amin


On Monday, March 11, 2013 5:27:13 AM UTC+1, rushabh wrote:
Jonathan,

Unfortunately thats not easy at the moment because our prints are build in the client (using JS). We are aware its a bad design and its on our re-write agenda. Will keep you updated on the forum when its done. Estimating about a month or so.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

On 10-Mar-2013, at 1:14 PM, Jonathan <iras...@gmail.com> wrote:


Hi Rushabh,

Would there be any chance of adding a "print" to the API? I guess it would take doctype, name, and a format as arguments, and return (or somehow give access to) the pdf.

Thanks.

- j

--
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.

Rushabh Mehta

unread,
May 31, 2013, 1:25:54 AM5/31/13
to erpnext-dev...@googlegroups.com
Already is!

Example:


or


pass doctype, name, format and style to "print"

or pass page=print to server.py

(you need to be logged it to check this)

The only print format we have ready out of the box for server-side is SalesInvoice.

best,
Rushabh

W: https://erpnext.com
T: @rushabh_mehta

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

To post to this group, send email to erpnext-dev...@googlegroups.com.

Jonathan

unread,
Jun 3, 2013, 6:26:38 AM6/3/13
to erpnext-dev...@googlegroups.com

Hi Rushabh,

In certain doctypes, such as Sales Order, there is a button "Get Taxes and Charges" which calculates additional charges based on one of the templates found in "Sales Taxes and Charges Master List". We would like to invoke this functionality from the API, but it is all located in the ERPNext javascript client. One really nasty hack would be to bring up the page in a headless browser and "click" the button from a script. But trying to do this more cleanly by duplicating the calculation logic in our script, I have not had any luck accessing the templates from the API. 

Do you have any suggestions for how to move forward?

Thanks.

- j

 

Anand Doshi

unread,
Jun 3, 2013, 6:32:52 AM6/3/13
to erpnext-dev...@googlegroups.com
Hi Jonathan,

We have ported the calculation code to the server side, but it is still in testing. It should be released by end of this month.

This will calculate everything again on the server side. So it solves the problem for users pushing through API and also opens up the possibility of transaction import.

If you want it earlier, you can switch to the "responsive" branch of erpnext and wnframework repositories. (Warning: it is in alpha stage and under testing, though we are using it on our account)

Thanks,
Anand.

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

To post to this group, send email to erpnext-dev...@googlegroups.com.

Jonathan

unread,
Aug 19, 2013, 11:10:40 AM8/19/13
to erpnext-dev...@googlegroups.com
Hi Anand,

Sorry I am just now getting back to this. Perhaps I didn't phrase the original question very well. I am interested in somehow triggering this calculation from  the Web Service API, and preferably without importing client.py. Is that now possible?

Thanks.

- j

Anand Doshi

unread,
Aug 19, 2013, 11:15:14 AM8/19/13
to erpnext-dev...@googlegroups.com
Hi Jonathan,

Calculations are triggered automatically on save, in the validate method. So insert/save/submit calls will trigger calculations.

Thanks,
Anand.

--
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.

Jonathan

unread,
Aug 19, 2013, 11:48:12 AM8/19/13
to erpnext-dev...@googlegroups.com
Hi Anand,

Thanks for the very quick clarification. That is super.

The next thing to ask about is access to "print" functionality from the Web Service API. In other words, would it be possible to have a print function which given a doctype and an id (for example, a particular invoice) and maybe a template id, returns the html or pdf that would be generated by hitting the "print" button from within ERPNext?

Thanks,

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

Rushabh Mehta

unread,
Aug 19, 2013, 1:25:59 PM8/19/13
to erpnext-dev...@googlegroups.com
Jonathan,

The next thing to ask about is access to "print" functionality from the Web Service API. In other words, would it be possible to have a print function which given a doctype and an id (for example, a particular invoice) and maybe a template id, returns the html or pdf that would be generated by hitting the "print" button from within ERPNext?

Already posted on this thread earlier. Pls check.

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

Jonathan

unread,
Aug 19, 2013, 1:29:39 PM8/19/13
to erpnext-dev...@googlegroups.com
Oops, very sorry about that--it must be the drugs.

Cheers,

- j

Jonathan

unread,
Sep 17, 2013, 8:31:36 AM9/17/13
to erpnext-dev...@googlegroups.com
Hi,

Would it be possible (or is it already working somehow) to have a variant of the get_doc API call--using filters--that would return the list of names of all matching doctypes? I think at the moment get_doc returns the first match, which has been sufficient up to now.

Thanks very much,

- j

Rushabh Mehta

unread,
Sep 17, 2013, 12:31:37 PM9/17/13
to erpnext-dev...@googlegroups.com
Jonathan,

You can use this method:


Pass filters as a json dict.



W: https://erpnext.com
T: @rushabh_mehta

--
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.
Reply all
Reply to author
Forward
0 new messages