Help

3

Dont understand this line of code

Avatar
Serge

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
3 Comments
Avatar
Discard
Avatar
Grover Menacho
-

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.

Avatar
Brett Lehrer
-

Yeah, that does seem silly.

Avatar
Serge
-

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

1 Answer
0
Avatar
eLBati
Best Answer

Because of revision 4362

Moreover, they recently removed it.

Avatar
Discard