Odoo Help

0

how to customize a report in openerp8

By
feriel bendimerad
on 5/8/14, 7:12 AM 2,195 views

hello , i'm working on Openerp8 , i have used inheritance to customize the report account invoice like i'v used in openerp7. here is my code:

# -*- coding: utf-8 -*-
#!/usr/bin/env pythons
from openerp.addons.account.report import account_print_invoice
from integerToWords_fr import final_result
import locale 
from openerp.report import report_sxw
import logging
from logging import Logger
logger = logging.getLogger('trainings module')
# create a custom parser inherited from sale order parser:
class new_account_invoice(account_print_invoice.account_invoice):
    '''Custom parser with an additional method
    '''
    def __init__(self, cr, uid, name, context):
        super(new_account_invoice, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'final_result':final_result,#
            'droit_timbre':self.droit_timbre,# 

        }) 

    def droit_timbre(self,s):
            if s<=20: return 0
            elif s>20  and s<=500 : return 5 
            elif s>500 and s<250000: return round((s/100)+0.49)
            elif s>=250000: return 2500




# remove previous account.report service :
from netsvc import Service
del Service._services['report.account.invoice']

# register the new report service :
report_sxw.report_sxw('report.account.invoice','account.invoice','addons/l10n_dz/report/account_print_invoice_dz.rml',parser=new_account_invoice)

i've got error this error: File "/usr/lib/pymodules/python2.7/openerp/addons/l10n_dz/report/account_print_invoice_dz.py", line 52, in <module> from netsvc import Service ImportError: No module named netsvc

2

Hi, Try this

from openerp import netsvc
del netsvc.Service._services['report.account.invoice']

Instead of this

from netsvc import Service
del Service._services['report.account.invoice']
1
Sylvain Van Hoof
On 10/8/14, 8:39 AM

Hi, 

With the lastest version of Odoo, the class Service doesn't yet existing.

"ParseError: "'module' object has no attribute 'Service'" while parsin"

What is the best solution to fix it ?

Thanks you ! 

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 5/8/14, 7:12 AM
Seen: 2195 times
Last updated: 3/16/15, 8:10 AM