Server Side Prints

229 views
Skip to first unread message

Rushabh Mehta

unread,
Mar 22, 2013, 5:57:59 AM3/22/13
to erpnext-dev...@googlegroups.com, Amin Zayani, Jonathan Cohen
Dear all,

Just released a beta feature in the "edge" branch to generate Server Side print formats. Will be added to master next week. 

In this, we generate print formats on the server-side using Jinja templates, so that they can be integrated with other apps and we will also use them in the webshop module.

Right now we have just made one format:


Also separated styles, so that you can define multiple styles for the same print format:


To generate the print format, use the print page with query parameters doctype, name, format and style. Example:

print?doctype=Sales Invoice&name=[invoice number]&format=SalesInvoice&style=standard

You must be logged in with appropriate permissions to the Invoice.

best,
Rushabh


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

Aditya Duggal

unread,
Sep 18, 2014, 6:01:18 AM9/18/14
to erpnext-dev...@googlegroups.com
Hi Rushabh,

I am trying to make print formats for the server side, I was able to change the formats for sales invoice but when I try to copy the same format for say like sales order then I am unable to fetch the item detail table for sales order in the format, I am using this below code

{%- for row in doc.entries -%}
<tr>
<td style="width: 3%;">{{ row.idx }}</td>
<td style="width: 57%;">{{ row.description }}</td>
<td style="width: 10%; text-align: right;">{{ row.qty }} {{ row.uom or row.stock_uom }}</td>
<td style="width: 15%; text-align: right;">{{
row.get_formatted("rate", doc) }}</td>
<td style="width: 15%; text-align: right;">{{
row.get_formatted("amount", doc) }}</td>
</tr>
{%- endfor -%}

The full code can be found here.

Rushabh Mehta

unread,
Sep 19, 2014, 12:48:06 AM9/19/14
to erpnext-dev...@googlegroups.com
The table fieldname is "sales_order_details" (check the doctype)

so it must be

for row in doc.sales_order_details


--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. 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.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. 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/de95828b-524b-4808-bdee-77540285cfef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aditya Duggal

unread,
Sep 19, 2014, 11:27:24 AM9/19/14
to erpnext-dev...@googlegroups.com
Hi Rushabh,

Thanks for informing me about this.

So this is going to be old name in mysql sales_order_details, I thought it was renamed to sales_order_item. Also this means that old name for sales_invoice_item is entries

Now is there a way I could check the mysql table name in the system, I have tries this below code but I was unable to find any table named entries

show tables where tables_in_rigpl like '%entr%';


or am I missing something.

Actually the entries thing got me confused.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Aditya Duggal

unread,
Sep 19, 2014, 11:29:55 AM9/19/14
to erpnext-dev...@googlegroups.com
Just realized what you were trying to say, the fieldname in the parent doctype and not the table name ohh....sorry to bother you as it was there in customize form view,

Aditya Duggal

unread,
Sep 20, 2014, 8:36:27 AM9/20/14
to erpnext-dev...@googlegroups.com
Hi Rushabh,

Is it possible to have something like a page header which repeats on the server prints after every page. Since the client side print formats never used to support this kind of a thing.

I would like to know if I could somehow repeat the invoice number and page x of y on page header so that for multiple pages we know which invoice's page is the multiple page as currently there is no way of finding out whether the actual print of the page is for which invoice and seems like an orphan page if not stapled to the first page.

On Friday, March 22, 2013 3:27:59 PM UTC+5:30, rushabh wrote:

Rushabh Mehta

unread,
Sep 22, 2014, 2:08:56 AM9/22/14
to erpnext-dev...@googlegroups.com
On 20-Sep-2014, at 6:06 pm, Aditya Duggal <aditya...@gmail.com> wrote:

Hi Rushabh,

Is it possible to have something like a page header which repeats on the server prints after every page. Since the client side print formats never used to support this kind of a thing.

I would like to know if I could somehow repeat the invoice number and page x of y on page header so that for multiple pages we know which invoice's page is the multiple page as currently there is no way of finding out whether the actual print of the page is for which invoice and seems like an orphan page if not stapled to the first page.

Makes sense - pls add a GitHub issue for this, we will add this.


On Friday, March 22, 2013 3:27:59 PM UTC+5:30, rushabh wrote:
Dear all,

Just released a beta feature in the "edge" branch to generate Server Side print formats. Will be added to master next week. 

In this, we generate print formats on the server-side using Jinja templates, so that they can be integrated with other apps and we will also use them in the webshop module.

Right now we have just made one format:


Also separated styles, so that you can define multiple styles for the same print format:


To generate the print format, use the print page with query parameters doctype, name, format and style. Example:

print?doctype=Sales Invoice&name=[invoice number]&format=SalesInvoice&style=standard

You must be logged in with appropriate permissions to the Invoice.

best,
Rushabh


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


--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. 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.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. 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/56077243-da44-4204-afad-d6006ac8f9a3%40googlegroups.com.

Aditya Duggal

unread,
Sep 22, 2014, 3:07:56 AM9/22/14
to erpnext-dev...@googlegroups.com
I have added this issue #861
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