[f298bd7] | 1 | #!/usr/bin/env python |
---|
[0df317c] | 2 | |
---|
[074fac7] | 3 | import sys |
---|
| 4 | import os |
---|
[4bde242] | 5 | |
---|
[074fac7] | 6 | if __name__ == '__main__': |
---|
[4bde242] | 7 | cur_file = os.path.abspath(__file__) |
---|
| 8 | django_dir = os.path.abspath(os.path.join(os.path.dirname(cur_file), '..')) |
---|
| 9 | sys.path.append(django_dir) |
---|
| 10 | os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' |
---|
| 11 | |
---|
| 12 | import finance_core.models |
---|
| 13 | import vouchers.models |
---|
[074fac7] | 14 | import finance_core.util |
---|
[4bde242] | 15 | |
---|
| 16 | expense_gls = ( |
---|
| 17 | ('Travel', 420050), |
---|
| 18 | ('Audio-Visual', 420106), |
---|
| 19 | ('Conference Expense', 420140), |
---|
| 20 | ('Entertainment', 420166), |
---|
| 21 | ('Materials and Services', 420226), |
---|
| 22 | ('Office Supplies', 420258), |
---|
| 23 | ('Professional Services', 420298), |
---|
| 24 | ('Copying', 420392), |
---|
| 25 | ('Books and Publications', 420800), |
---|
| 26 | ('Food', None), |
---|
| 27 | ('Food.Meetings', 421000), |
---|
| 28 | ('Food.Events', 421200), |
---|
[0df317c] | 29 | ('IT', None), |
---|
| 30 | ('IT.Computer Supplies', 421900), |
---|
| 31 | ('IT.On-line Services', 421920), |
---|
| 32 | ('Promotional & Memorabilia', 420302), |
---|
[4bde242] | 33 | ) |
---|
| 34 | |
---|
| 35 | def add_gl_accounts(): |
---|
| 36 | try: |
---|
| 37 | base = finance_core.models.BudgetArea.get_by_path(['Accounts', 'Expenses', ]) |
---|
| 38 | except KeyError: |
---|
| 39 | base = finance_core.models.BudgetArea.get_by_path(['Accounts',]) |
---|
| 40 | base = base.add_child(name='Expenses', always=True, use_owner=True) |
---|
[074fac7] | 41 | base = finance_core.models.BudgetArea.get_by_path(['Accounts', 'Expenses', ]) |
---|
| 42 | finance_core.util.mass_add_accounts(base, expense_gls, writeto=sys.stdout) |
---|
[4bde242] | 43 | |
---|
| 44 | |
---|
| 45 | if __name__ == '__main__': |
---|
| 46 | add_gl_accounts() |
---|