Odoo Help


[SOLVED] Webkit Parser seems doesn't parse and i don't understand why?

Jean-Baptiste Bernard
on 9/19/14, 3:24 AM 2,095 views


I have some problme to parwe my report in webkit, when i try to use some function i have this error :

(SyntaxError) invalid syntax (<unknown>, line 1) (u'get_barcode(product.ean13))') at line: 59 char: 19

(<class 'mako.exceptions.SyntaxException'>, SyntaxException("(SyntaxError) invalid syntax (<unknown>, line 1) (u'get_barcode(product.ean13))') at line: 59 char: 19",), <traceback object at 0xb5788ec>)

For me is the parser which doesn'tdo this work.

Below the arch of my module :


And now the different file to be sure:

In Root


    'name' : 'New webkit label for product',
    'description' : '''
       New product label in webkit with ean13 codebar and product image
    'version' : '1',
    'depends' : [
    'category': 'Tools',
    'author' : 'Aldebarande',
    'url': 'http://www.aldebarande.fr/',
    'website': 'http://www.aldebarande.fr/',
    'data': [],
    'update_xml': [
    'init_xml': [],
    "active": False,
    "installable": True,
    "application": True,



import report

in Report


    <style type="text/css">
            margin: 5;
            padding: 0;
            height: 100%;
        .dest_table {
            width: 100%;
        .sizes_table {
            width: 100%;
            border: solid 1px black;
                font-weight: bold;
                border: 1px solid black;
                background-color: rgb(237, 237, 237);
                text-align: center;
                padding: 3px 5px;
                vertical-align: middle;
            text-align: center;
            padding: 3px 5px;
            vertical-align: middle;
            border: 1px solid black;

        .container .total{
            width: 45%;

        .container .total table{
            width: 85%;
            float: right;
    %for product in objects:
                <td styme="vertical-align: middle;" width="33%">
                    ${product.name or ''}
                <td width="33%">
                    %if product.product_image:
                        ${helper.embed_image("jpg",product.product_image, width=250, height=100)}
                <td width="33%">
                    %if product.ean13:
                                <td align="center"  style="padding: 7mm;">
                                <td valign="center" align="center" style="font-size: 20px;" >


from openerp.report import report_sxw
import base64
from osv import osv
from alde_ean13 import EanBarCode

class alde_product_label_report_parser(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(alde_product_label_report_parser, self).__init__(cr, uid, name, context=context)
            'get_barcode': self.get_barcode,

    #  ean13 picture generate
    def get_barcode(self, barcode_string):
        bar = EanBarCode()
        barcode_string = str(barcode_string)
        code = bar.getImage(barcode_string, 50, "png")
        output = StringIO.StringIO()
        code.save(output, format="PNG")
        data = base64.b64encode(output.getvalue())
        toreturn = '<img src="data:image/png;base64,%s" height="75" />' % (
        return toreturn

# Product_label Parse
report_sxw.report_sxw('report.alde.product.label', 'product.product', 'addons/alde_product_label/report/alde_product_label.html.mako', parser=alde_product_label_report_parser)


<?xml version="1.0"?>

        <!--Label Product -->
        <!-- Remove old label Product report -->
        <delete model="ir.actions.report.xml" search="[('report_name','=','product.product.label')]" />

        <!-- New Label -->
        <report id="report_alde_product_label"  model="product.product"
                string="Étiquettes de produits"
                auto="False" />

        <record id="report_alde_product_label" model="ir.actions.report.xml">
            <field name="webkit_header" ref="label_header"/>
            <field name="no_multi_threading" eval="True"/>



import alde_product_label_report
import alde_ean13

I hope you can help me?


Thank you





Ben Bernard

--Ben Bernard--

| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 9/22/14, 10:30 AM

This is the error as the log says


which is too many closing parentheses.

Jean-Baptiste Bernard
On 9/22/14, 10:18 AM

Yes it is.... Anyway thank you very much, it's maybe à little mistake but when you don't see it it's very annoying Thank you

Jean did you get it working? can share your work?

on 10/3/14, 2:06 AM

This is work, We didn't have git hub yet but maybe one day

Aldébarande, Jean-Baptiste Bernard
on 2/10/15, 8:56 AM

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.


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)


Asked: 9/19/14, 3:24 AM
Seen: 2095 times
Last updated: 3/16/15, 8:10 AM