Skip to content

Instantly share code, notes, and snippets.

@qpfiffer
Forked from shofetim/models.py
Last active December 20, 2015 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qpfiffer/6117729 to your computer and use it in GitHub Desktop.
Save qpfiffer/6117729 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()
for line in self.purchaseline_set.filter(unit_cost=None):
line.unit_cost = line.promotional_cost_at_submit_time
line.save()
else:
self.submitted_at = None
# Then the rest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment