This question has been flagged
1 Reply
4243 Views

Hello,

I'm overwriting the create method of ir.attachment and got a problem when raise is called. It freezes the web client. Here is a simplified code to test it:

class ir_attachment(osv.osv):
    _inherit = 'ir.attachment'

    def create(self, cr, uid, vals, context=None):
        raise osv.except_osv('Error!',"This is a test")
        return super(ir_attachment, self).create(cr, uid, vals, context)

When I try to add an attachment to any resource (a partner for example) the raise is logged on the server side but the popup never appears and the web client get stuck. I guess it's because the system is considering the model and resource of the ir.attachment itself instead of the resource where I'm attaching the document to (ea: the partner). So of course, if I create a document manually in Knowledge->Document the raise will work, but it's not the point.

Anyone has an idea how to solve that ? It would be much appreciated :-)

This is the last issue I have to finalize an OpenERP/Alfresco interface I've been working on and that will be publicly published when this is solved.

Thx

Fabian

Avatar
Discard
Best Answer

Fabian,

The issue is with the sidebar class, which adds each warning on the right top and the warning appears as a flash and goes off.

As a solution, it has to add crash manager!

Temporary workaround is: === modified file 'addons/web/static/src/js/views.js' --- addons/web/static/src/js/views.js 2014-02-17 10:49:20 +0000 +++ addons/web/static/src/js/views.js 2014-03-11 11:43:46 +0000 @@ -1217,7 +1217,7 @@ this.dataset = dataset; this.model_id = model_id; if (args && args[0].error) { - this.do_warn(_t('Uploading Error'), args[0].error); + alert(_t('Uploading Error')+ args[0].error); } if (!model_id) { this.on_attachments_loaded([]);

Thanks.

Avatar
Discard