← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-related-balance-check into lp:banking-addons/bank-statement-reconcile-7.0

 

Leonardo Pistone - camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-related-balance-check into lp:banking-addons/bank-statement-reconcile-7.0.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)
Related bugs:
  Bug #1288842 in Banking Addons: "bank_statement_ext: balance_check flag not propagated to the statement"
  https://bugs.launchpad.net/banking-addons/+bug/1288842

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-related-balance-check/+merge/209723
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-related-balance-check/+merge/209723
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-fix-related-balance-check into lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_statement_ext/__openerp__.py'
--- account_statement_ext/__openerp__.py	2014-03-06 10:48:37 +0000
+++ account_statement_ext/__openerp__.py	2014-03-06 16:37:37 +0000
@@ -79,7 +79,7 @@
           'security/ir.model.access.csv',
           'security/ir_rule.xml'],
  'demo_xml': [],
- 'test': [],
+ 'test': ['test/test_balance_check.yml'],
  'installable': True,
  'images': [],
  'auto_install': False,

=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py	2014-03-06 10:48:37 +0000
+++ account_statement_ext/statement.py	2014-03-06 16:37:37 +0000
@@ -159,6 +159,13 @@
 
         return profile_ids[0] if profile_ids else False
 
+    def _get_statement_from_profile(self, cr, uid, profile_ids, context=None):
+        """Weirdness warning! self is another class."""
+        triggered = []
+        for profile in self.browse(cr, uid, profile_ids, context=context):
+            triggered += [st.id for st in profile.bank_statement_ids]
+        return triggered
+
     _columns = {
         'profile_id': fields.many2one(
             'account.statement.profile',
@@ -174,12 +181,16 @@
                         store=True,
                         readonly=True),
         'balance_check': fields.related(
-                        'profile_id',
-                        'balance_check',
-                        type='boolean',
-                        string='Balance check',
-                        store=True,
-                        readonly=True),
+            'profile_id',
+            'balance_check',
+            type='boolean',
+            string='Balance check',
+            store={
+                'account.statement.profile': (
+                    _get_statement_from_profile, ['balance_check'], 10),
+            },
+            readonly=True
+        ),
         'journal_id': fields.related(
                         'profile_id',
                         'journal_id',


Follow ups