@db_transaction.atomic()<EOL><INDENT>def create_transaction(self, to_account):<DEDENT>
from_account = self.statement_import.bank_account<EOL>transaction = Transaction.objects.create()<EOL>Leg.objects.create(<EOL>transaction=transaction, account=from_account, amount=+(self.amount * -<NUM_LIT:1>)<EOL>)<EOL>Leg.objects.create(transaction=transaction, account=to_account, amount=-(self.amount * -<NUM_LIT:1>))<EOL>transaction.date = self.date<EOL>transaction.save()<EOL>self.transaction = transaction<EOL>self.save()<EOL>return transaction<EOL>
Create a transaction for this statement amount and account, into to_account

        This will also set this StatementLine's ``transaction`` attribute to the newly
        created transaction.

        Args:
            to_account (Account): The account the transaction is into / out of.

        Returns:
            Transaction: The newly created (and committed) transaction.