Created
November 24, 2014 19:20
-
-
Save gammy/de35377d33a8af19d7ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sportamor.logistics.models import * | |
| from datetime import date, timedelta | |
| max_age = date.today() - timedelta(days=30) | |
| returns = Return.objects.filter(status=ReturnStatuses.PENDING).filter(date_created__gt=max_age) | |
| for r in returns: | |
| o = r.order | |
| invoices = o.invoices.all() | |
| for i in invoices: | |
| #print("Invoice {:d}, pending return {:d} order {:d}: {:s}".format(i.id, r.id, o.id, str(r.date_created))) | |
| m = i.get_total_value() | |
| if type(m) is Money: | |
| if m.is_zero(): | |
| print("Invoice {:d}, pending return {:d} order {:d}: {:s}".format(i.id, r.id, o.id, str(r.date_created))) | |
| print("{:d} This order invoice is zero and SHOULD BE SEALED, sealing".format(i.id)) | |
| # else: | |
| # print("{:d} ok".format(i.id)) | |
| #r.order.seal() | |
| else: | |
| print("Odd, order invoice has no Money: {:}".format(m)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment