← Back to team overview

banking-addons-team team mailing list archive

lp:~acsone-openerp/banking-addons/possible_use_completion_rule_instance into lp:banking-addons/bank-statement-reconcile-7.0

 

Laetitia Gangloff (Acsone) has proposed merging lp:~acsone-openerp/banking-addons/possible_use_completion_rule_instance into lp:banking-addons/bank-statement-reconcile-7.0.

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

For more details, see:
https://code.launchpad.net/~acsone-openerp/banking-addons/possible_use_completion_rule_instance/+merge/201604

Hello,

in order to use instance of rules I updated the function call parts.

This proposal stay compatible with existing rules. And add id of the rule if the function require more parameter. This id can be usefull to get more parameters to do the completion.


-- 
https://code.launchpad.net/~acsone-openerp/banking-addons/possible_use_completion_rule_instance/+merge/201604
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~acsone-openerp/banking-addons/possible_use_completion_rule_instance into lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_statement_base_completion/statement.py'
--- account_statement_base_completion/statement.py	2013-10-16 08:58:12 +0000
+++ account_statement_base_completion/statement.py	2014-01-14 15:09:04 +0000
@@ -23,6 +23,7 @@
 import sys
 import logging
 import simplejson
+import inspect
 
 import psycopg2
 
@@ -79,8 +80,7 @@
         else:
             prof = profile
         # We need to respect the sequence order
-        sorted_array = sorted(prof.rule_ids, key=attrgetter('sequence'))
-        return tuple((x.function_to_call for x in sorted_array))
+        return sorted(prof.rule_ids, key=attrgetter('sequence'))
 
     def _find_values_from_rules(self, cr, uid, calls, line, context=None):
         """
@@ -103,8 +103,11 @@
         rule_obj = self.pool.get('account.statement.completion.rule')
 
         for call in calls:
-            method_to_call = getattr(rule_obj, call)
-            result = method_to_call(cr, uid, line, context)
+            method_to_call = getattr(rule_obj, call.function_to_call)
+            if len(inspect.getargspec(method_to_call)) == 5:
+                result = method_to_call(cr, uid, call.id, line, context)
+            else:
+                result = method_to_call(cr, uid, line, context)
             if result:
                 result['already_completed'] = True
                 return result


Follow ups