Odoo Help

Welcome!

This community 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.

0

raise from ir.attachment

By
Fabian Semal
on 3/11/14, 7:30 AM 1,331 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

1

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 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

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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