Odoo Help


raise from ir.attachment

Fabian Semal
on 3/11/14, 7:30 AM 1,852 views


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.




Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 3/11/14, 10:32 AM


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([]);


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

0 follower(s)


Asked: 3/11/14, 7:30 AM
Seen: 1852 times
Last updated: 3/16/15, 8:10 AM