NameError: global name 'ir' is not defined - cannot unlink/delete jasper_document

Bug #983015 reported by Enapps Ltd OpenERP Partner London UK
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
JasperReport Server Connector
Fix Released
High
Christophe CHAUVET

Bug Description

Still a bug here with ir_del:

    def unlink_values(self, cr, uid, id, context=None):
        """
        Only remove link in ir.values, not the report
        """
        doc = self.browse(cr, uid, id, context=context)
        for v in self.action_values(cr, uid, doc.report_id.id, context=context):
            ir.ir_del(cr, uid, v)
        return True

NameError: global name 'ir' is not defined

Revision history for this message
Enapps Ltd OpenERP Partner London UK (enapps-london-uk) wrote :

Perhaps it can be changed to:
    def unlink_values(self, cr, uid, id, context=None):
        """
        Only remove link in ir.values, not the report
        """
        doc = self.browse(cr, uid, id, context=context)
        irm = self.pool.get('ir.values')
        for v in self.action_values(cr, uid, doc.report_id.id, context=context):
            irm.unlink(cr, uid, v)
        return True

?

Revision history for this message
Enapps Ltd OpenERP Partner London UK (enapps-london-uk) wrote :

Also, I'm not sure if this is just my database but it seems that in v6.1 the field 'object' has been removed from ir.values ...
could be wrong, your input would be appreciated.

So I needed to comment out the 'object' field in the search args for reports like this -

    def action_values(self, cr, uid, report_id, context=None):
        """
        Search ids for reports
        """
        args = [
            ('key2', '=', 'client_print_multi'),
            ('value', '=', 'ir.actions.report.xml,%d' % report_id),
            #('object', '=', True),
        ]
        return self.pool.get('ir.values').search(cr, uid, args, context=context)

Revision history for this message
Goran Cvijanović (goranc) wrote :

There is some changes in 6.1 which have to be resolved in code change from previous version to be compatible with new 6.1 version. To provide installable module on 6.1 version for jasper_server addon, here are changes in code:

jasper_document.py :
1. comment # include ir
2. replace:
   ir.ir_set(cr, uid, 'action', 'client_print_multi', doc.name, [doc.model_id.model], value, replace=False, isobject=True)
with:
self.pool.get('ir.model.data').ir_set(cr, uid, 'action', 'client_print_multi', doc.name, [doc.model_id.model], value, replace=False, isobject=True)
(or just remove ir. prefix)

3. As mentioned from Enapps : there is no 'object' field in ir.values, so comment 'object' = True args.

After that module will install in 6.1, and is working from desktop client.
From web client it is not working, you can't call the report, because of bug/934068

It is something with report_soap.py and line in method _jasper_execute:
cur_obj = self.model_obj.browse(self.cr, self.uid, ex, context=context)
error line: openerp.netsvc: 'NoneType' object has no attribute 'browse'
it is defined in __init__ as: self.model_obj = self.pool.get(self.model)

g.c.

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Thanks for using jasper_server connector, and welcome to contribute

If you fix some issue, you can create a branch and fix it, and link to a bug report

it's so easy to made a review and merge it (see exemple from syleam employee https://code.launchpad.net/~alndcrie/openerp-jasperserver/openerp-jasperserver)

Regards

Changed in openerp-jasperserver:
status: New → Confirmed
assignee: nobody → Christophe Chauvet - http://www.syleam.fr/ (christophe-chauvet)
milestone: none → 6.6.1
importance: Undecided → High
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

I have fix the issue when we want to delete a report

Regards,

Changed in openerp-jasperserver:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.