Hello,
I have a module that prints the list of products and partners in a table.
It runs on Openerp 6.1 Windows 10 but there is a error on Openerp 6.1 Ubuntu 14.
It s the same code.
error :
Client Traceback (most recent call last): File "/usr/share/pyshared/openerp/addons/web/common/http.py", line 260, in dispatch r = method(controller, self, **self.params) File "/usr/share/pyshared/openerp/addons/web/controllers/main.py", line 1784, in index req.session._db, req.session._uid, req.session._password, report_id) File "/usr/share/pyshared/openerp/addons/web/common/openerplib/main.py", line 117, in proxy result = self.connector.send(self.service_name, method, *args) File "/usr/share/pyshared/openerp/addons/web/common/http.py", line 596, in send fault = xmlrpclib.Fault('warning -- ' + e.name + '\n\n' + e.value, '') TypeError: cannot concatenate 'str' and 'tuple' objects
Code :
Liste_produits.py
from report import report_sxw
class classe_liste_produits(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(classe_liste_produits, self).__init__(cr, uid, name, context)
self.localcontext.update({
'_getProducts':self._getProducts,
})
def _getProducts(self,object):
res = []
prods = self.pool.get('product.template')
cats = self.pool.get('product.category')
pp = self.pool.get('product.product')
ids = prods.search(self.cr, self.uid, [('id', 'in', object.id)])
for id in ids:
ref = pp.browse(self.cr, self.uid, id).default_code
nom = prods.browse(self.cr, self.uid, id).name
prix = prods.browse(self.cr, self.uid, id).standard_price
cat_id = prods.browse(self.cr, self.uid, id).categ_id.id
nom_categ = cats.browse(self.cr, self.uid, cat_id).name
res.append({'ref':ref,'nom':nom,'prix': prix,'nom_categ':nom_categ})
return res
report_sxw.report_sxw('report.liste.produits', 'product.product', 'listes/report/report_liste_produits.rml', parser=classe_liste_produits)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Report :
<story>
<para style="terp_header_Centre">LISTE DES PRODUITS</para>
<para style="P4">
<font color="white"> </font>
</para>
<blockTable colWidths="50.0,205.0,56.0,57.0,58.0,57.0,56.0" style="Tableau8">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Ref.</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Nom</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Prix</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Categorie</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[repeatIn(_getProducts(objects),'p')]]</para>
<blockTable colWidths="50.0,205.0,56.0,57.0,58.0,57.0,56.0" style="Tableau8">
<tr>
<td>
<para style="terp_default_Centre_8">[[ p['ref'] ]]</para>
</td>
<td>
<para style="terp_default_8">[[ p['nom'] ]]</para>
</td>
<td>
<para style="terp_default_Right_8">[[formatLang( p['prix'] , digits=2)]]</para>
</td>
<td>
<para style="terp_default_Right_8">[[ p['nom_categ'] ]]</para>
</td>
</tr>
</blockTable>
</section>
</story>
</document>
Thanks.
Best regards