Odoo Help


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.


Dont understand this line of code

on 4/10/14, 12:28 PM 764 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.

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)


Asked: 4/10/14, 12:28 PM
Seen: 764 times
Last updated: 3/16/15, 8:10 AM