155 def setUp(self):
156 self.ses = Session()
157 self.book = self.ses.get_book()
158 table = self.book.get_table()
159 currency = table.lookup("CURRENCY", "USD")
160
161 stock = GncCommodity(self.book, "Lot Test", "COMMODITY", "LTX", "LTX", 100000)
162 table.insert(stock)
163
164 self.stock_acct =
Account(self.book)
165 self.stock_acct.SetCommodity(stock)
166 root = self.book.get_root_account()
167 root.append_child(self.stock_acct)
168
170 cash_acct.SetCommodity(currency)
171 root.append_child(cash_acct)
172
173 tx = Transaction(self.book)
174 tx.BeginEdit()
175 tx.SetCurrency(currency)
176 tx.SetDateEnteredSecs(datetime.now())
177 tx.SetDatePostedSecs(datetime.now())
178
179
180 s1 = Split(self.book)
181 s1.SetParent(tx)
182 s1.SetAccount(self.stock_acct)
185
186 s2 = Split(self.book)
187 s2.SetParent(tx)
188 s2.SetAccount(cash_acct)
191
192
193 s3 = Split(self.book)
194 s3.SetParent(tx)
195 s3.SetAccount(self.stock_acct)
198
199 s4 = Split(self.book)
200 s4.SetParent(tx)
201 s4.SetAccount(cash_acct)
204
205 tx.CommitEdit()
206 self.stock_acct.ScrubLots()
207
The primary numeric class for representing amounts and values.