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