← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0_rec_cron_mdh into lp:banking-addons/bank-statement-reconcile-7.0

 

Matthieu Dietrich @ camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0_rec_cron_mdh into lp:banking-addons/bank-statement-reconcile-7.0.

Commit message:
[IMP] new scheduler task to reconcile automatically entries

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0_rec_cron_mdh/+merge/220278

This patch adds a (by default, inactive) scheduler task to process all automatic reconcilations once per day. This is useful in cases lots of unreconciled entries are on a account, and the normal process would take too much time when called by the interface.
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0_rec_cron_mdh/+merge/220278
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0_rec_cron_mdh into lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_easy_reconcile/easy_reconcile.py'
--- account_easy_reconcile/easy_reconcile.py	2014-03-14 10:48:30 +0000
+++ account_easy_reconcile/easy_reconcile.py	2014-05-20 14:35:11 +0000
@@ -258,7 +258,7 @@
                 _('Error'),
                 _('There is no history of reconciled '
                   'items on the task: %s.') % rec.name)
-     
+
     def _open_move_line_list(sefl, cr, uid, move_line_ids, name, context=None):
         return {
             'name': name,
@@ -336,3 +336,10 @@
         if not rec.last_history:
             self._no_history(cr, uid, rec, context=context)
         return rec.last_history.open_partial()
+
+    def run_scheduler(self, cr, uid, context=None):
+        # Retrieve all easy reconcile ids
+        ids = self.search(cr, uid, [], context=context)
+        # launch run_reconcile action for every item
+        self.run_reconcile(cr, uid, ids, context=context)
+        return True

=== modified file 'account_easy_reconcile/easy_reconcile.xml'
--- account_easy_reconcile/easy_reconcile.xml	2014-04-14 13:09:19 +0000
+++ account_easy_reconcile/easy_reconcile.xml	2014-05-20 14:35:11 +0000
@@ -158,5 +158,18 @@
         id="menu_easy_reconcile"
         parent="account.periodical_processing_reconciliation"/>
 
+    <record forcecreate="True" id="ir_cron_run_reconciliations" model="ir.cron">
+        <field name="name">Do Automatic Reconciliations</field>
+        <field eval="False" name="active"/>
+        <field name="user_id" ref="base.user_root"/>
+        <field name="interval_number">1</field>
+        <field name="interval_type">days</field>
+        <field name="numbercall">-1</field>
+        <field eval="False" name="doall"/>
+        <field eval="'account.easy.reconcile'" name="model"/>
+        <field eval="'run_scheduler'" name="function"/>
+        <field eval="'()'" name="args"/>
+    </record>
+
 </data>
 </openerp>


Follow ups