[IMP] account_statement_base_import: Improved system to inherit selection of the different import types, because as it was, you have to redefine the field on each extension module, due to OpenERP doesn't allow direct inheritance on selection methods.

Now, the selection method calls another private method that can be inherited without problems.
This commit is contained in:
Pedro M. Baeza
2014-02-28 14:19:47 +01:00
committed by Guewen Baconnier
2 changed files with 5 additions and 16 deletions

View File

@@ -32,11 +32,12 @@ class AccountStatementProfil(Model):
_inherit = "account.statement.profile" _inherit = "account.statement.profile"
def get_import_type_selection(self, cr, uid, context=None): def get_import_type_selection(self, cr, uid, context=None):
""" """This is the method to be inherited for adding the parser"""
Has to be inherited to add parser
"""
return [('generic_csvxls_so', 'Generic .csv/.xls based on SO Name')] return [('generic_csvxls_so', 'Generic .csv/.xls based on SO Name')]
def _get_import_type_selection(self, cr, uid, context=None):
return self.get_import_type_selection(cr, uid, context=context)
_columns = { _columns = {
'launch_import_completion': fields.boolean( 'launch_import_completion': fields.boolean(
"Launch completion after import", "Launch completion after import",
@@ -46,12 +47,11 @@ class AccountStatementProfil(Model):
# we remove deprecated as it floods logs in standard/warning level sob... # we remove deprecated as it floods logs in standard/warning level sob...
'rec_log': fields.text('log', readonly=True), # Deprecated 'rec_log': fields.text('log', readonly=True), # Deprecated
'import_type': fields.selection( 'import_type': fields.selection(
get_import_type_selection, _get_import_type_selection,
'Type of import', 'Type of import',
required=True, required=True,
help="Choose here the method by which you want to import bank" help="Choose here the method by which you want to import bank"
"statement for this profile."), "statement for this profile."),
} }
_defaults = { _defaults = {

View File

@@ -33,14 +33,3 @@ class AccountStatementProfil(orm.Model):
context=context) context=context)
selection.append(('ofx_so', _('OFX - Open Financial Exchange'))) selection.append(('ofx_so', _('OFX - Open Financial Exchange')))
return selection return selection
_columns = {
'import_type': fields.selection(
get_import_type_selection,
'Type of import',
required=True,
help="Choose here the method by which you want to import bank"
"statement for this profile."),
}