Skip to content

Instantly share code, notes, and snippets.

@qpfiffer qpfiffer/models.py

forked from shofetim/models.py
Last active Dec 20, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.