콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
5970 화면

For example sale order has 100 lines and it splits in 6 PDF page, here how to show the total for each page lines ?


Thanks.

아바타
취소
베스트 답변

You have just to catch PDF before it is sent to the browser. If you are not using attachments modify create_single_pdf() in report_sxw.py under /usr/lib/python2.7/openerp/report/, before return pdf, report_xml.report_type, do pdf = generateMyPDF(s.getvalue(title(report_xml.name), pdf)).if not in create_source_pdf()change the last if statement return s.getvalue(), results[0][1] should be pdf = generateMyPDF(report_xml.name, s.getvalue()) return pdf, results[0][1]

If you are using rml reports:

import StringIO
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from pyPdf import PdfFileReader, PdfFileWriter


def generateMyPDF(titles, pdf)
    if title in titles:#title is used here to check if this is the right document to modify (by default title is the string argument in your report action)
        input = PdfFileReader(cStringIO.StringIO(pdf))
        #calculate your subtotals
        #parse pages to calculate subtotals, you can use regex to calculate subtotal,because it depend on your modified invoice.

        for index in range(len(subtotals)):
            packet = StringIO.StringIO()
            can = canvas.Canvas(packet, pagesize=letter)

            #draw your subtotal

            can.save()
            packet.seek(index)
            new_pdf = PdfFileReader(packet)
            page = input.getPage(index)
            page.mergePage(new_pdf.getPage(0))
            output.addPage(page)

    output.write(s)
    return s.getvalue() or pdf, , report_xml.report_type
아바타
취소
베스트 답변

You should define your splitting criteria for lines and print the sum in the footer.

eg: fix 10 lines in each pdf page

아바타
취소
관련 게시물 답글 화면 활동
2
3월 18
5595
0
4월 24
1906
1
8월 23
5826
2
4월 18
19487
4
8월 17
21813