From 9226e468182102c59237efba3aac8edfddc457b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Faure-Lacroix?= Date: Wed, 18 Mar 2015 00:41:24 +0300 Subject: [PATCH] Remove dangerous default value Default values in python are created before the method is called, as a result. Any mutable object defined as default value will be the same object for each method call. It's only safe to use immutable objects as default value. --- .../account_banking_reconciliation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_banking_reconciliation/account_banking_reconciliation.py b/account_banking_reconciliation/account_banking_reconciliation.py index 7ea8590bf..01854b832 100644 --- a/account_banking_reconciliation/account_banking_reconciliation.py +++ b/account_banking_reconciliation/account_banking_reconciliation.py @@ -70,7 +70,10 @@ class bank_acc_rec_statement(orm.Model): ) return True - def copy(self, cr, uid, id, default={}, context=None): + def copy(self, cr, uid, id, default=None, context=None): + if not default: + default = {} + default.update({ 'credit_move_line_ids': [], 'debit_move_line_ids': [],