Changeset 064683a


Ignore:
Timestamp:
Jan 27, 2010, 1:00:36 PM (15 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, client
Children:
17193ee
Parents:
5abe506
git-author:
Alex Dehnert <adehnert@…> (01/27/10 13:00:36)
git-committer:
Alex Dehnert <adehnert@…> (01/27/10 13:00:36)
Message:

Store account numbers

Location:
treasury
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • treasury/finance_core/models.py

    r52c3467 r064683a  
    1 from django.db import models
     1from django.db import models, connection
    22import settings
    33import treebeard.mp_tree
     
    99    name = models.CharField(max_length=50)
    1010    comment = models.TextField(blank=True)
     11
     12    # Applicable to every term?
    1113    always = models.BooleanField(blank=True, default=False)
    1214
     
    1618    interested = models.EmailField(help_text='Email address of parties interested in the area', blank=True) # interested parties (ie, whole committee)
    1719    use_owner = models.BooleanField(default=False, blank=True)
     20    account_number = models.IntegerField(help_text='Account number: for example, cost object or GL', blank=True, null=True)
    1821
    1922    def contact_address(self,):
     
    2427            address = self.interested or self.owner
    2528        return address or self.get_parent().contact_address()
     29
     30    def get_account_number(self):
     31        """Retrieve the account number for this account.
     32
     33        This properly recurses through the hierarchy until reaching the root
     34        or an account with the account number set."""
     35
     36        print self.account_number
     37        if self.account_number:
     38            return self.account_number
     39        else:
     40            parent = self.get_parent()
     41            if parent:
     42                return parent.get_account_number()
     43            else:
     44                return 0
    2645
    2746    def mark_used(self, term, comment=""):
  • treasury/vouchers/import_budget.py

    r5abe506 r064683a  
    4949                        always=True, use_owner=True,
    5050                        owner='ua-treasurer@mit.edu',
    51                         interested='ua-treasurer@mit.edu', )
     51                        interested='ua-treasurer@mit.edu',
     52                        account_number=0,
     53                    )
    5254        # This is sorta evil, in that it abuses the fact that Python
    5355        # won't put name out of scope
     
    7375                interested=coerce_full_email(comm['email_list']),
    7476                use_owner=comm['prefer_chair'],
     77                account_number=(comm['account'] or 0),
    7578                always=True,
    7679            )
Note: See TracChangeset for help on using the changeset viewer.