From 27f7ee28b1e9323ff78695c02db9ca0cab39010c Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Fri, 24 May 2013 11:00:42 +0200 Subject: [PATCH] [FIX] Faulty import [IMP] Method references in confirm/cancel mappings --- .../model/banking_import_transaction.py | 25 +++++++------------ .../model/payment_order_create.py | 2 +- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/account_banking_payment/model/banking_import_transaction.py b/account_banking_payment/model/banking_import_transaction.py index 21cfc2fd4..2171a33be 100644 --- a/account_banking_payment/model/banking_import_transaction.py +++ b/account_banking_payment/model/banking_import_transaction.py @@ -364,25 +364,18 @@ class banking_import_transaction(orm.Model): def __init__(self, pool, cr): """ Updating the function maps to handle the match types that this - module adds. While creating the map in the super object was - straightforward, the fact that these are now functions rather than - method requires the awkward way of updating it with the methods' - function objects. - - As noted above, another implication is that any addon that inherits - one of these methods needs to overwrite the entry in the function - maps in the same way as is done below. + module adds. """ super(banking_import_transaction, self).__init__(pool, cr) - self.confirm_map.update({ - 'storno': self._confirm_storno.__func__, - 'payment_order': self._confirm_payment_order.__func__, - 'payment': self._confirm_payment.__func__, + banking_import_transaction.confirm_map.update({ + 'storno': banking_import_transaction._confirm_storno, + 'payment_order': banking_import_transaction._confirm_payment_order, + 'payment': banking_import_transaction._confirm_payment, }) - self.cancel_map.update({ - 'storno': self._cancel_storno.__func__, - 'payment_order': self._cancel_payment_order.__func__, - 'payment': self._cancel_payment.__func__, + banking_import_transaction.cancel_map.update({ + 'storno': banking_import_transaction._cancel_storno, + 'payment_order': banking_import_transaction._cancel_payment_order, + 'payment': banking_import_transaction._cancel_payment, }) diff --git a/account_banking_payment/model/payment_order_create.py b/account_banking_payment/model/payment_order_create.py index 2ee4eafab..8199fca25 100644 --- a/account_banking_payment/model/payment_order_create.py +++ b/account_banking_payment/model/payment_order_create.py @@ -25,7 +25,7 @@ from datetime import datetime from openerp.osv import orm, fields -from openerp.misc import DEFAULT_SERVER_DATE_FORMAT +from openerp.tools import DEFAULT_SERVER_DATE_FORMAT class payment_order_create(orm.TransientModel):