Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created July 30, 2013 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shofetim/6117712 to your computer and use it in GitHub Desktop.
Save shofetim/6117712 to your computer and use it in GitHub Desktop.
def react_to_purchasing_status(self):
if self.purchasing_status >= PURCHASE_STATUS_SUBMITTED and self.submitted_at is None:
self.submitted_at = datetime.now()
else:
self.submitted_at = None
if self.purchasing_status == PURCHASE_STATUS_SUBMITTED:
for line in self.purchaseline_set.filter(unit_cost=None):
line.unit_cost = line.promotional_cost_at_submit_time
line.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment