Comment 18 for bug 525808

Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote :

Your patch is not usable.
Here is a sample of your patch:

@@ -443,7 +465,9 @@
             self._check_moves(cr, uid, ids, "write", context)
         return super(account_account, self).write(cr, uid, ids, vals, context=context)

- def unlink(self, cr, uid, ids, context={}):
+ def unlink(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
         self._check_moves(cr, uid, ids, "unlink", context)
         return super(account_account, self).unlink(cr, uid, ids, context)

@@ -461,7 +485,7 @@

 class account_journal_column(osv.osv):
- def _col_get(self, cr, user, context={}):
+ def _col_get(self, cr, user, context=None):
         result = []
         cols = self.pool.get('account.move.line')._columns
         for col in cols:

In the first case, no need to initialize context as the function don't access it directly (it just pass the context to other functions).
In the second case, the context is not initialized. I assume that's a bug in your script.
Also, there is are some place in the code where "if not context:" is done instead of "if context is None:". Your patch can't detect it.
For this reasons, I refuse your patch. In fact this changes have to be done by the developer when he found it when working on a piece of code. An automatic massive change will lead to errors and more bugs.