Ejemplo n.º 1
0
    def setUp(self):
        self.user = User(username='******')
        self.user.save()

        self.group = Group(name='Group 1', slug='group1')
        self.group.save()

        self.accounts = [
            Account(name='Account 1', slug='account1', group=self.group),
            Account(name='Account 2', slug='account2', group=self.group),
            Account(name='Account 3', slug='account3', group=self.group),
        ]
        for account in self.accounts:
            account.save()

        self.before = datetime.datetime.now()

        self.transaction = Transaction(group=self.group)
        self.transaction.save()
        self.transaction.entry_set.add(
            TransactionEntry(account=self.accounts[0], debit=100))
        self.transaction.entry_set.add(
            TransactionEntry(account=self.accounts[1], credit=100))

        self.transaction.set_pending(user=self.user)

        self.after = datetime.datetime.now()
Ejemplo n.º 2
0
    def setUp(self):
        self.user = User(username="******")
        self.user.save()

        self.group = Group(name="Group 1", slug="group1")
        self.group.save()

        self.accounts = [
            Account(name="Account 1", slug="account1", group=self.group),
            Account(name="Account 2", slug="account2", group=self.group),
            Account(name="Account 3", slug="account3", group=self.group),
        ]
        for account in self.accounts:
            account.save()

        self.before = datetime.datetime.now()

        self.transaction = Transaction(group=self.group)
        self.transaction.save()
        self.transaction.entry_set.create(account=self.accounts[0], debit=100)
        self.transaction.entry_set.create(account=self.accounts[1], credit=100)

        self.transaction.set_pending(user=self.user)

        self.after = datetime.datetime.now()
Ejemplo n.º 3
0
    def setUp(self):
        self.user = User(username="******")
        self.user.save()

        self.group = Group(name="group1", slug="group1")
        self.group.save()

        self.account = Account(name="account1",
                               slug="account1",
                               group=self.group)
        self.account.save()

        self.transaction = Transaction(group=self.group)
        self.transaction.save()

        self.entry = self.transaction.entry_set.create(account=self.account,
                                                       debit=100,
                                                       credit=100)
Ejemplo n.º 4
0
    def setUp(self):
        self.user = User(username='******')
        self.user.save()

        self.group = Group(name='group1', slug='group1')
        self.group.save()

        self.account = Account(name='account1',
                               slug='account1',
                               group=self.group)
        self.account.save()

        self.transaction = Transaction(group=self.group)
        self.transaction.save()

        self.entry = TransactionEntry(account=self.account,
                                      debit=100,
                                      credit=100,
                                      transaction=self.transaction)
Ejemplo n.º 5
0
    def setUp(self):
        self.users = [
            User(username='******'),
            User(username='******'),
            User(username='******'),
        ]
        for user in self.users:
            user.save()

        self.group = Group(name='Group 1', slug='group1')
        self.group.save()

        self.accounts = [
            # Normal user account
            Account(name='Account 1',
                    slug='account1',
                    group=self.group,
                    owner=self.users[0]),
            # Normal user account
            Account(name='Account 2',
                    slug='account2',
                    group=self.group,
                    owner=self.users[1]),
            # Inactive user account
            Account(name='Account 3',
                    slug='account3',
                    group=self.group,
                    owner=self.users[2],
                    active=False),
            # Group account
            Account(name='Account 4',
                    slug='account4',
                    group=self.group,
                    type=Account.ASSET_ACCOUNT),
            # Inactive group account
            Account(name='Account 5',
                    slug='account5',
                    group=self.group,
                    type=Account.ASSET_ACCOUNT,
                    active=False),
            # Bank account
            self.group.roleaccount_set.get(role=RoleAccount.BANK_ACCOUNT
                                           ).account,
            # Cash account
            self.group.roleaccount_set.get(role=RoleAccount.CASH_ACCOUNT
                                           ).account,
        ]
        for account in self.accounts:
            account.save()
        self.account = self.accounts[0]

        self.transactions = {
            'Pen': Transaction(group=self.group),
            'Com': Transaction(group=self.group),
            'Rej': Transaction(group=self.group),
        }
        values = {
            'Pen': 150,
            'Com': 200,
            'Rej': 100,
        }
        for state, transaction in self.transactions.items():
            transaction.save()
            transaction.entry_set.add(
                TransactionEntry(account=self.accounts[0],
                                 credit=values[state]))
            transaction.entry_set.add(
                TransactionEntry(account=self.accounts[1],
                                 debit=values[state]))
            transaction.set_pending(user=self.users[0])

        self.transactions['Undef'] = Transaction(group=self.group)
        self.transactions['Undef'].save()

        self.transactions['Com'].set_committed(user=self.users[2])
        self.transactions['Rej'].set_rejected(user=self.users[2])
Ejemplo n.º 6
0
    def setUp(self):
        self.users = [
            User(username="******"),
            User(username="******"),
            User(username="******"),
        ]
        for user in self.users:
            user.save()

        self.group = Group(name="Group 1", slug="group1")
        self.group.save()

        self.accounts = [
            # Normal user account
            Account(
                name="Account 1",
                slug="account1",
                group=self.group,
                owner=self.users[0],
            ),
            # Normal user account
            Account(
                name="Account 2",
                slug="account2",
                group=self.group,
                owner=self.users[1],
            ),
            # Inactive user account
            Account(
                name="Account 3",
                slug="account3",
                group=self.group,
                owner=self.users[2],
                active=False,
            ),
            # Group account
            Account(
                name="Account 4",
                slug="account4",
                group=self.group,
                type=Account.ASSET_ACCOUNT,
            ),
            # Inactive group account
            Account(
                name="Account 5",
                slug="account5",
                group=self.group,
                type=Account.ASSET_ACCOUNT,
                active=False,
            ),
            # Bank account
            self.group.roleaccount_set.get(role=RoleAccount.BANK_ACCOUNT
                                           ).account,
            # Cash account
            self.group.roleaccount_set.get(role=RoleAccount.CASH_ACCOUNT
                                           ).account,
        ]
        for account in self.accounts:
            account.save()
        self.account = self.accounts[0]

        self.transactions = {
            "Pen": Transaction(group=self.group),
            "Com": Transaction(group=self.group),
            "Rej": Transaction(group=self.group),
        }
        values = {"Pen": 150, "Com": 200, "Rej": 100}
        for state, transaction in self.transactions.items():
            transaction.save()
            transaction.entry_set.create(account=self.accounts[0],
                                         credit=values[state])
            transaction.entry_set.create(account=self.accounts[1],
                                         debit=values[state])
            transaction.set_pending(user=self.users[0])

        self.transactions["Undef"] = Transaction(group=self.group)
        self.transactions["Undef"].save()

        self.transactions["Com"].set_committed(user=self.users[2])
        self.transactions["Rej"].set_rejected(user=self.users[2])