Odoo Help


Dont understand this line of code

on 4/10/14, 12:28 PM 1,186 views

Look the line with WHAT IS THAT, someone can explain me why openerp do that, for me modules_to_remove_ids = ids, so why do a browse with a list a ID and build a array with the RESULT ?

def module_uninstall(self, cr, uid, ids, context=None):
        """Perform the various steps required to uninstall a module completely
        including the deletion of all database structures created by the module:
        tables, columns, constraints, etc."""
        ir_model_data = self.pool.get('ir.model.data')
        ir_model_constraint = self.pool.get('ir.model.constraint')
        modules_to_remove = [m.name for m in self.browse(cr, uid, ids, context)]
        modules_to_remove_ids = [m.id for m in self.browse(cr, uid, ids, context)] #<------ WHAT IS THAT
        constraint_ids = ir_model_constraint.search(cr, uid, [('module', 'in', modules_to_remove_ids)])
        ir_model_constraint._module_data_uninstall(cr, uid, constraint_ids, context)
        ir_model_data._module_data_uninstall(cr, uid, modules_to_remove, context)
        self.write(cr, uid, ids, {'state': 'uninstalled'})
        return True

I agree with you, maybe they didn't notice this. Making a browse to get the same result is lossing performance. This must be fixed.

GH Mediacloud, Grover Menacho
on 4/10/14, 1:44 PM

Yeah, that does seem silly.

Brett Lehrer
on 4/10/14, 1:47 PM

And look the previous line .. same browse for a other fields ... yeah..

on 4/10/14, 2:55 PM
On 6/10/14, 4:57 PM

Because of revision 4362

Moreover, they recently removed it.

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: 4/10/14, 12:28 PM
Seen: 1186 times
Last updated: 3/16/15, 8:10 AM