From 16a482ac8ecdff86f64b0828563637c42127f9ac Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 29 Feb 2012 12:09:43 +0100 Subject: [PATCH] [FIX] Reconciliation does not work due to browse record caching --- account_banking/__init__.py | 1 + account_banking/browse_record.py | 20 ++++++++++++++++++++ account_banking/wizard/bank_import.py | 1 + 3 files changed, 22 insertions(+) create mode 100644 account_banking/browse_record.py diff --git a/account_banking/__init__.py b/account_banking/__init__.py index fd44236e4..b1f410237 100644 --- a/account_banking/__init__.py +++ b/account_banking/__init__.py @@ -24,6 +24,7 @@ # along with this program. If not, see . # ############################################################################## +import browse_record import sepa import record import account_banking diff --git a/account_banking/browse_record.py b/account_banking/browse_record.py new file mode 100644 index 000000000..246e4bac6 --- /dev/null +++ b/account_banking/browse_record.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from osv.orm import browse_record + +def refresh(self): + """ + This method taken from OpenERP 6.1. We use it to monkeypatch the + browse_record class with. Note that this affects the behaviour of the + OpenERP instance on all databases that it runs. + + Force refreshing this browse_record's data and all the data of the + records that belong to the same cache, by emptying the cache completely, + preserving only the record identifiers (for prefetching optimizations). + """ + for model, model_cache in self._cache.iteritems(): + # only preserve the ids of the records that were in the cache + cached_ids = dict([(i, {'id': i}) for i in model_cache.keys()]) + self._cache[model].clear() + self._cache[model].update(cached_ids) + +browse_record.refresh = refresh diff --git a/account_banking/wizard/bank_import.py b/account_banking/wizard/bank_import.py index 230d976b3..3e095d616 100644 --- a/account_banking/wizard/bank_import.py +++ b/account_banking/wizard/bank_import.py @@ -102,6 +102,7 @@ class banking_import(osv.osv_memory): 'line_id': [(6, 0, [move_line.id])], } ) + move_line.refresh() return retval def _link_payment(self, cursor, uid, trans, payment_lines,