I would like to trigger this same functionality from within a server-side script, in order to create an email which would include the template-based generated html for the given Sales Invoice. Is the best approach still to use the above HTTP request, or is there an ERPNext python function directly available?
Thank you for any suggestions.
- j
–
Note:
If you are posting an issue,
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.
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.
I would like to trigger this same functionality from within a server-side script, in order to create an email which would include the template-based generated html for the given Sales Invoice. Is the best approach still to use the above HTTP request, or is there an ERPNext python function directly available?
Thank you for any suggestions.
- j
–
Note:
If you are posting an issue,
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.
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.
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.
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.
Thanks. I am not sure how to invoke the get_html function. For example, customizing on_update for a Sales Invoice, I have the following code:
def custom_on_update(self):
msgprint("got update " + self.doc.name)
import traceback
try:
result = self.get_html(self.doc, self.doclist)
except:
tb = traceback.format_exc()
msgprint(tb)
The first msgprint is shows up, but I get the following exception (visible in the second msgprint) when invoking get_html.
Traceback (most recent call last): File "", line 33, in custom_on_update AttributeError: 'CustomDocType' object has no attribute 'get_html'
I have tried other variations such as webnotes.get_html and self.doc.get_html with no success.
Thanks,
- j
–
Note:
If you are posting an issue,
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.
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.
On 18-Sep-2013, at 7:25 PM, Jonathan <ir...@gmail.com> wrote:
Thanks. I am not sure how to invoke the get_html function. For example, customizing on_update for a Sales Invoice, I have the following code:
def custom_on_update(self):
msgprint("got update " + self.doc.name)
import traceback
try:
result = self.get_html(self.doc, self.doclist)
except:
tb = traceback.format_exc()
msgprint(tb)
The first msgprint is shows up, but I get the following exception (visible in the second msgprint) when invoking get_html.
Traceback (most recent call last): File "", line 33, in custom_on_update AttributeError: 'CustomDocType' object has no attribute 'get_html'
I have tried other variations such as webnotes.get_html and self.doc.get_html with no success.
Thanks,
- j
–
Note:
If you are posting an issue,
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.
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.
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.
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.
Where the style is the name of a template. However, changing the style to another template, or even commenting out that line, does not seem to change the appearance of the result. Any suggestions?
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
Where the style is the name of a template. However, changing the style to another template, or even commenting out that line, does not seem to change the appearance of the result. Any suggestions?
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
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.
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.
I get a different result (html output) when using the web API approach (http://whatever.erpnext.com/web.py?page=print&doctype=Sales%20Invoice&name=INV-13-14-00027&format=SalesInvoice) vs. the server side script approach. I think this is because the web API approach is using a doctype template (a custom template we created which one can see on the Print Format List), but the server side script seems to get the css from a template file (classic, standard, or modern).
Looking at the code in print_format/print_format.py, it seems that get_html() only returns the html body, and does not use webnotes.form_dict.style. There is a separate call to return the css, get_print_style(), which takes the style ("standard", "modern", or "classic") as an argument.
Is there some way to make the server side script access the same template that the web API approach uses?
Thanks.
–
Note:
If you are posting an issue,
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.
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.
On 19-Sep-2013, at 4:33 PM, Jonathan <ir...@gmail.com> wrote:
Hi,
I get a different result (html output) when using the web API approach (http://whatever.erpnext.com/web.py?page=print&doctype=Sales%20Invoice&name=INV-13-14-00027&format=SalesInvoice) vs. the server side script approach. I think this is because the web API approach is using a doctype template (a custom template we created which one can see on the Print Format List), but the server side script seems to get the css from a template file (classic, standard, or modern).
Looking at the code in print_format/print_format.py, it seems that get_html() only returns the html body, and does not use webnotes.form_dict.style. There is a separate call to return the css, get_print_style(), which takes the style ("standard", "modern", or "classic") as an argument.
Is there some way to make the server side script access the same template that the web API approach uses?
Thanks.
–
Note:
If you are posting an issue,
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.
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.
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.
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.
Sorry, I don't understand. Below is the current server side script code for Sales Invoice. "Sales invoice Classic Footer" is set as the default template, but I seem to get "Standard". At some level, does the web api access the same "print" code as the server side script?
Thanks.
- j
------------------------
def custom_on_submit(self):
webnotes.form_dict.format = "SalesInvoice"
webnotes.form_dict.style = "Sales invoice Classic Footer" # "Standard" # "Classic" # "Modern" # "Standard" # not sure whether this template is being picked up in get_html()
import core.doctype.print_format.print_format
from webnotes.utils.email_lib import sendmail
body = None
css = None
try:
body = core.doctype.print_format.print_format.get_html(self.doc, self.doclist)
css = core.doctype.print_format.print_format.get_print_style("Sales invoice Classic Footer") # this just returns "Standard"
except:
tb = traceback.format_exc()
msgprint(tb)
msg = """
<html>
<head>
<style type="text/css">
"""
msg += css
msg += """
</style>
</head>
<body>
"""
msg += body
msg += """
</html>
"""
–
Note:
If you are posting an issue,
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.
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.
On 19-Sep-2013, at 11:57 PM, Jonathan <ir...@gmail.com> wrote:
Sorry, I don't understand. Below is the current server side script code for Sales Invoice. "Sales invoice Classic Footer" is set as the default template, but I seem to get "Standard". At some level, does the web api access the same "print" code as the server side script?
Thanks.
- j
------------------------
def custom_on_submit(self):
webnotes.form_dict.format = "SalesInvoice"
webnotes.form_dict.style = "Sales invoice Classic Footer" # "Standard" # "Classic" # "Modern" # "Standard" # not sure whether this template is being picked up in get_html()
import core.doctype.print_format.print_format
from webnotes.utils.email_lib import sendmail
body = None
css = None
try:
body = core.doctype.print_format.print_format.get_html(self.doc, self.doclist)
css = core.doctype.print_format.print_format.get_print_style("Sales invoice Classic Footer") # this just returns "Standard"
except:
tb = traceback.format_exc()
msgprint(tb)
msg = """
<html>
<head>
<style type="text/css">
"""
msg += css
msg += """
</style>
</head>
<body>
"""
msg += body
msg += """
</html>
"""
–
Note:
If you are posting an issue,
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.
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.
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.
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.
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.
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.
I am having trouble getting this to work again. In particular, render_page("print") seems to take a very long time, but return an empty result. Also when I try the web api approach: https://erpnext.url/web.py?page=print&doctype=Sales%20Invoice&name=INV01309&format=SalesInvoice, the return is the following empty document (see below). Do you have any suggestions about what I am doing wrong?
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.
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.
We’ve fixed this issue. Please update pull updates of 1310 branch.
Best,
Anand.
On 30-Oct-2013, at 2:39 pm, Jonathan <ir...@gmail.com> wrote:
Hi,
I am having trouble getting this to work again. In particular, render_page("print") seems to take a very long time, but return an empty result. Also when I try the web api approach: https://erpnext.url/web.py?page=print&doctype=Sales%20Invoice&name=INV01309&format=SalesInvoice, the return is the following empty document (see below). Do you have any suggestions about what I am doing wrong?
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.
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.
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.
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.
Thanks for the response and sorry for the belated reply. Is it sufficient to do git checkout origin 1310 and then restart the server, or are there further steps required?
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
On Thursday, November 14, 2013 8:42:40 PM UTC+5:30, Jonathan wrote:
Thanks for the response and sorry for the belated reply. Is it sufficient to do git checkout origin 1310 and then restart the server, or are there further steps required?
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
I had better clarify--I did not install ERPNext so I have no experience in this regard. Our ERPNext installation is currently on the master branch, the last commit is:
commit 865e62df61b53b3bf0b0e446e8c23e2dc99b68f2
Author: Nabin Hait <.....@...com>
Date: Mon Sep 23 23:28:46 2013 +0530
and git status responds:
# On branch master
# Your branch is behind 'origin/master' by 597 commits, and can be fast-forwarded.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# master.sql
Is it really sufficient simply to do git checkout origin 1310 on the live server--will all the data, custom forms, etc. be preserved? Or do I need to do some kind of backup, switch to the new branch, and restore.
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
On Friday, November 15, 2013 1:52:27 PM UTC+5:30, Jonathan wrote:
Hi Rushabh,
I had better clarify--I did not install ERPNext so I have no experience in this regard. Our ERPNext installation is currently on the master branch, the last commit is:
commit 865e62df61b53b3bf0b0e446e8c23e2dc99b68f2
Author: Nabin Hait <.....@...com>
Date: Mon Sep 23 23:28:46 2013 +0530
and git status responds:
# On branch master
# Your branch is behind 'origin/master' by 597 commits, and can be fast-forwarded.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# master.sql
Is it really sufficient simply to do git checkout origin 1310 on the live server--will all the data, custom forms, etc. be preserved? Or do I need to do some kind of backup, switch to the new branch, and restore.
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
Did the checkout and rebuild, then restarted the server. Things generally seem to work ok, except that I am unable to submit any document (save seems to work). The message when I try to submit is simply "Did not save".Would the fact that there is an untracked file called "master.sql" in /var/www/erpnext/app/ have any relevance?
Any suggestions?
Thanks.
- j
On Saturday, November 16, 2013 5:56:14 AM UTC+1, rushabh wrote:
Jonathan, should work.
Checkout and then rebuild. (lib/wnf.py --build)
On Friday, November 15, 2013 1:52:27 PM UTC+5:30, Jonathan wrote:
Hi Rushabh,
I had better clarify--I did not install ERPNext so I have no experience in this regard. Our ERPNext installation is currently on the master branch, the last commit is:
commit 865e62df61b53b3bf0b0e446e8c23e2dc99b68f2
Author: Nabin Hait <.....@...com>
Date: Mon Sep 23 23:28:46 2013 +0530
and git status responds:
# On branch master
# Your branch is behind 'origin/master' by 597 commits, and can be fast-forwarded.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# master.sql
Is it really sufficient simply to do git checkout origin 1310 on the live server--will all the data, custom forms, etc. be preserved? Or do I need to do some kind of backup, switch to the new branch, and restore.
Thanks.
- j
–
Note:
If you are posting an issue,
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.
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.
The browser’s javascript console should give you an error trace. It should help to figure out the problem.
Best,
Anand Doshi.
On 20 November 2013 at 11:01:10 pm, Jonathan (ir...@gmail.com) wrote:
Hi,
Did the checkout and rebuild, then restarted the server. Things generally
seem to work ok, except that I am unable to submit any document (save seems
to work). The message when I try to submit is simply “Did not save”.Would
the fact that there is an untracked file called “master.sql” in
/var/www/erpnext/app/ have any relevance?
Any suggestions?
Thanks.
j
On Saturday, November 16, 2013 5:56:14 AM UTC+1, rushabh wrote:
Jonathan, should work.
Checkout and then rebuild. (lib/wnf.py --build)
On Friday, November 15, 2013 1:52:27 PM UTC+5:30, Jonathan wrote:
Hi Rushabh,
I had better clarify–I did not install ERPNext so I have no experience
in this regard. Our ERPNext installation is currently on the master branch,
the last commit is:
Your branch is behind ‘origin/master’ by 597 commits, and can be
fast-forwarded.
Untracked files:
(use “git add …” to include in what will be committed)
master.sql
Is it really sufficient simply to do git checkout origin 1310 on the live
server–will all the data, custom forms, etc. be preserved? Or do I need to
do some kind of backup, switch to the new branch, and restore.
Thanks.
j
–
Note:
If you are posting an issue,
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.
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.
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.
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.
I should have thought of that. Here is the output from the console. Any further suggestions?
Thanks.
- j
-------------------------------------------
Traceback (innermost last):
File "../lib/webnotes/widgets/form/save.py", line 17, in savedocs
getattr(wrapper, action.lower())()
File "../lib/webnotes/model/bean.py", line 348, in submit
self.run_method('on_submit')
File "../lib/webnotes/model/bean.py", line 229, in run_method
getattr(self.controller, method)()
File "../app/accounts/doctype/sales_invoice/sales_invoice.py", line 97, in on_submit
self.make_gl_entries()
File "../app/accounts/doctype/sales_invoice/sales_invoice.py", line 546, in make_gl_entries
update_outstanding=update_outstanding, merge_entries=False)
File "../app/accounts/general_ledger.py", line 18, in make_gl_entries
save_entries(gl_map, adv_adj, update_outstanding)
File "../app/accounts/general_ledger.py", line 71, in save_entries
make_entry(entry, adv_adj, update_outstanding)
File "../app/accounts/general_ledger.py", line 87, in make_entry
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
TypeError: run_method() takes exactly 2 arguments (4 given)
Traceback (innermost last):
File "../lib/webnotes/handler.py", line 91, in handle
execute_cmd(cmd)
File "../lib/webnotes/handler.py", line 131, in execute_cmd
ret = call(method, webnotes.form_dict)
File "../lib/webnotes/handler.py", line 148, in call
return fn(**newargs)
File "../lib/webnotes/widgets/form/save.py", line 26, in savedocs
raise e
TypeError: run_method() takes exactly 2 arguments (4 given)
–
Note:
If you are posting an issue,
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.
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.