aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--servo/models/order.py13
-rw-r--r--servo/models/repair.py41
-rwxr-xr-xstatic/images/events/order-gsx_repair_complete.pngbin0 -> 1175 bytes
3 files changed, 30 insertions, 24 deletions
diff --git a/servo/models/order.py b/servo/models/order.py
index 2fa3097..8d8eddd 100644
--- a/servo/models/order.py
+++ b/servo/models/order.py
@@ -348,12 +348,6 @@ class Order(models.Model):
"""
Closes this service order
"""
- self.notify("close_order", _(u"Order %s closed") % self.code, user)
- self.closed_by = user
- self.closed_at = timezone.now()
- self.state = self.STATE_CLOSED
- self.save()
-
if Configuration.autocomplete_repairs():
for r in self.repair_set.active():
try:
@@ -366,6 +360,12 @@ class Order(models.Model):
if self.queue and self.queue.status_closed:
self.set_status(self.queue.status_closed, user)
+ self.notify("close_order", _(u"Order %s closed") % self.code, user)
+ self.closed_by = user
+ self.closed_at = timezone.now()
+ self.state = self.STATE_CLOSED
+ self.save()
+
def reopen(self, user):
"""
Re-opens this service order
@@ -373,6 +373,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
diff --git a/servo/models/repair.py b/servo/models/repair.py
index d947055..2836759 100644
--- a/servo/models/repair.py
+++ b/servo/models/repair.py
@@ -86,7 +86,7 @@ class ChecklistItemValue(models.Model):
class ActiveManager(models.Manager):
use_for_related_fields = True
-
+
def active(self):
"""
GSX repairs that have been submitted, and not marked complete
@@ -585,19 +585,6 @@ class Repair(models.Model):
except IndexError:
pass
- def complete(self, user):
- """
- Marks this repair as being complete
- """
- self.completed_at = timezone.now()
- self.completed_by = user
- self.save()
-
- queue = self.order.queue
- if queue.status_repair_completed:
- status = queue.status_repair_completed
- self.order.set_status(status, user)
-
def get_sn_update_parts(self):
"""
Returns parts eligible for SN update
@@ -606,7 +593,7 @@ class Repair(models.Model):
def close(self, user):
"""
- Marks this GSX repair as complete
+ Mark the GSX repair as complete
"""
self.connect_gsx(user)
repair = self.get_gsx_repair()
@@ -646,9 +633,24 @@ class Repair(models.Model):
status = repair.status()
self.set_status(status.repairStatus, user)
-
self.complete(user)
+ def complete(self, user):
+ """
+ Mark our local copy of this GSX repair as complete
+ """
+ self.completed_at = timezone.now()
+ self.completed_by = user
+ self.save()
+
+ msg = _('GSX repair %s marked complete') % self.confirmation
+ self.order.notify('gsx_repair_complete', msg, user)
+
+ queue = self.order.queue
+ if queue.status_repair_completed:
+ status = queue.status_repair_completed
+ self.order.set_status(status, user)
+
def duplicate(self, user):
"""
Makes a copy of this GSX Repair
@@ -673,8 +675,11 @@ class Repair(models.Model):
def get_absolute_url(self):
if self.submitted_at is None:
- return reverse('repairs-edit_repair', args=[self.order.pk, self.pk])
- return reverse('repairs-view_repair', args=[self.order.pk, self.pk])
+ url = 'repairs-edit_repair'
+ else:
+ url = 'repairs-view_repair'
+
+ return reverse(url, args=[self.order.pk, self.pk])
def __unicode__(self):
if self.pk is not None:
diff --git a/static/images/events/order-gsx_repair_complete.png b/static/images/events/order-gsx_repair_complete.png
new file mode 100755
index 0000000..0a0e291
--- /dev/null
+++ b/static/images/events/order-gsx_repair_complete.png
Binary files differ