Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

[SOLVED] AttributeError: 'module' object has no attribute 'create_single_pdf'

By
Yenthe
on 11/17/14, 9:06 AM 2,404 views

Hey everybody

Today I started to migrate the module 'Terms and Conditions' (https://www.odoo.com/apps/7.0/agaplan_terms_and_conditions/) from V7 to V8 since the module is not released for V8.
I've managed to change the settings from V7 to V8 but I'm puzzled with one error.


The code in aga_plan_terms_and_conditions in the file report_sxw.py:

from openerp.osv import osv
from openerp import pooler
from openerp.report import report_sxw
from openerp.tools.safe_eval import safe_eval
#from tools.safe_eval import safe_eval

import time
import base64
import logging

try:
    from cStringIO import StringIO
except ImportError:
    from StringIO import StringIO

try:
    from pyPdf import PdfFileWriter, PdfFileReader
except ImportError:
    raise osv.except_osv(
        "agaplan_terms_and_conditions needs pyPdf",
        """To install the module "agaplan_terms_and_conditions" please ask your administrator to $
    )


# We store the original function
openerp_create_single_pdf = report_sxw.create_single_pdf

The error happens in the line openerp_create_single_pdf = report_sxw.create_single_pdf.. I've looked under tools/report/report_sxw.py and the method create_single_pdf does exist.
Could anybody tell me what is wrong or what I'm missing? I'd love to get this module working in V8..

I will release the working module 'Terms and Conditions' to the public if I get this working.

With kind regards
Yenthe

0

Yenthe

--Yenthe--
6696
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 11/17/14, 9:43 AM

I've managed to fix this. The problem was that I had my import wrong. I had this:

from openerp.report import report_sxw

And I should have had this:

from openerp.report.report_sxw import report_sxw

But now rises my second problem.. The code isn't giving me ANY errors but there is no second page added to the PDF when I print.
What am I missing or what am I doing wrong?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/17/14, 9:06 AM
Seen: 2404 times
Last updated: 3/16/15, 8:10 AM