source: remit/util/add_gl_accounts.py @ 5eb287f

client
Last change on this file since 5eb287f was 8132e8c, checked in by Alex Dehnert <adehnert@…>, 15 years ago

The executable bit is shiny

  • Property mode set to 100755
File size: 1.2 KB
RevLine 
[074fac7]1import sys
2import os
[4bde242]3
[074fac7]4if __name__ == '__main__':
[4bde242]5    cur_file = os.path.abspath(__file__)
6    django_dir = os.path.abspath(os.path.join(os.path.dirname(cur_file), '..'))
7    sys.path.append(django_dir)
8    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
9
10import finance_core.models
11import vouchers.models
[074fac7]12import finance_core.util
[4bde242]13
14expense_gls = (
15    ('Travel', 420050),
16    ('Audio-Visual', 420106),
17    ('Conference Expense', 420140),
18    ('Entertainment', 420166),
19    ('Materials and Services', 420226),
20    ('Office Supplies', 420258),
21    ('Professional Services', 420298),
22    ('Copying', 420392),
23    ('Books and Publications', 420800),
24    ('Food', None),
25    ('Food.Meetings', 421000),
26    ('Food.Events', 421200),
27    ('Computer Supplies', 421900),
28)
29
30def add_gl_accounts():
31    try:
32        base = finance_core.models.BudgetArea.get_by_path(['Accounts', 'Expenses', ])
33    except KeyError:
34        base = finance_core.models.BudgetArea.get_by_path(['Accounts',])
35        base = base.add_child(name='Expenses', always=True, use_owner=True)
[074fac7]36        base = finance_core.models.BudgetArea.get_by_path(['Accounts', 'Expenses', ])
37    finance_core.util.mass_add_accounts(base, expense_gls, writeto=sys.stdout)
[4bde242]38
39
40if __name__ == '__main__':
41    add_gl_accounts()
Note: See TracBrowser for help on using the repository browser.