This question has been flagged
1 Reply
40772 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

Avatar
Discard
Author Best Answer

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?

Avatar
Discard