diff options
author | Filipp Lepalaan <filipp@mac.com> | 2016-11-02 21:21:53 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2016-11-02 21:21:53 +0200 |
commit | cd9aca0fc6afcd4ff5b6b7f00edcd68cab5b5c86 (patch) | |
tree | a8262328afa46d41993d1b051e202833f77d2e0c /servo | |
parent | 5017f7b2e2e5fb5c5290340a0d103b24fc076210 (diff) | |
download | Servo-cd9aca0fc6afcd4ff5b6b7f00edcd68cab5b5c86.tar.gz Servo-cd9aca0fc6afcd4ff5b6b7f00edcd68cab5b5c86.tar.bz2 Servo-cd9aca0fc6afcd4ff5b6b7f00edcd68cab5b5c86.zip |
Set RFPU GSX status on autocomplete
Diffstat (limited to 'servo')
-rw-r--r-- | servo/models/order.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/servo/models/order.py b/servo/models/order.py index b155f14..8121024 100644 --- a/servo/models/order.py +++ b/servo/models/order.py @@ -25,9 +25,8 @@ from servo.models.queue import Queue, Status, QueueStatus class Order(models.Model): - """ - The Service Order - """ + """The Service Order.""" + code = models.CharField(max_length=8, unique=True, null=True) url_code = models.CharField(max_length=8, unique=True, null=True) # Device description or something else @@ -123,10 +122,10 @@ class Order(models.Model): related_name="orders" ) - STATE_QUEUED = 0 # order hasn't been started - STATE_OPEN = 1 # order is being worked on - STATE_CLOSED = 2 # order is closed - STATE_WAITING = 3 # order is waiting (do not track duration) + STATE_QUEUED = 0 # order hasn't been started + STATE_OPEN = 1 # order is being worked on + STATE_CLOSED = 2 # order is closed + STATE_WAITING = 3 # order is waiting (do not track duration) STATES = ( (STATE_QUEUED, _("Unassigned")), @@ -139,8 +138,8 @@ class Order(models.Model): status_name = models.CharField(max_length=128, default="") status_started_at = models.DateTimeField(null=True) - status_limit_green = models.DateTimeField(null=True) # turn yellow after this - status_limit_yellow = models.DateTimeField(null=True) # turn red after this + status_limit_green = models.DateTimeField(null=True) # turn yellow after this + status_limit_yellow = models.DateTimeField(null=True) # turn red after this api_fields = ('status_name', 'status_description',) @@ -177,9 +176,7 @@ class Order(models.Model): return [self.add_tag(t, user) for t in tags] def check_in(self, user): - """ - Checks this Order in through the check-in process - """ + """Check this Order in through the check-in process.""" queue_id = Configuration.conf('checkin_queue') self.set_queue(queue_id, user) @@ -197,6 +194,10 @@ class Order(models.Model): return new_order def get_print_template(self, kind="confirmation"): + """Return the name of the correct print template for this order. + + Based on the order's queue + """ template = "orders/print_%s.html" % kind if self.queue: @@ -346,12 +347,11 @@ class Order(models.Model): return False def close(self, user): - """ - Closes this service order - """ + """Close this service order.""" if Configuration.autocomplete_repairs(): for r in self.repair_set.active(): try: + r.set_status_code('RFPU') r.close(user) except Exception as e: # notify the creator of the GSX repair instead of just erroring out @@ -374,7 +374,7 @@ class Order(models.Model): self.state = Order.STATE_OPEN self.closed_at = None self.save() - + msg = _("Order %s reopened") % self.code self.notify("reopen", msg, user) return msg |