Repository URL to install this package:
|
Version:
0.1.0 ▾
|
from __future__ import unicode_literals
from .base import Model
class Account(Model):
attribute_names = [
'id',
# string The id of the accounts in question
'uri',
# string The uri with all data for this account
'date',
# string Date of accounts
'type',
# string Accounts type
]
def get_detailed_account(self, company, load=True):
from . import (AccountDetailsFinancial, AccountDetailsGAAP,
AccountDetailsIFRS, AccountDetailsInsurance,
AccountDetailsStatutory)
account_type = getattr(self, 'type', None)
if account_type not in ('financial', 'gaap', 'ifrs',
'insurance', 'statutory'):
raise TypeError("Duedil does not have information about accounts \
with type {account_type}".format(
account_type=account_type))
if account_type == 'financial':
model_class = AccountDetailsFinancial
elif account_type == 'gaap':
model_class = AccountDetailsGAAP
elif account_type == 'ifrs':
model_class = AccountDetailsIFRS
elif account_type == 'insurance':
model_class = AccountDetailsInsurance
elif account_type == 'statutory':
model_class = AccountDetailsStatutory
return model_class(parent_model=company, load=load)