diff options
Diffstat (limited to 'servo/models')
-rw-r--r-- | servo/models/note.py | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/servo/models/note.py b/servo/models/note.py index da71bd6..ab6b622 100644 --- a/servo/models/note.py +++ b/servo/models/note.py @@ -62,9 +62,12 @@ def validate_phone_number(number): class Note(MPTTModel): - T_NOTE = 0 - T_PROBLEM = 1 - T_ESCALATION = 2 + T_NOTE = 0 + T_PROBLEM = 1 + T_ESCALATION = 2 + T_DIAGNOSIS = 3 + T_VERIFIED_PROBLEM = 4 + T_CUSTOMER_NOTE = 5 subject = models.CharField( blank=True, @@ -73,7 +76,7 @@ class Note(MPTTModel): verbose_name=_('Subject'), ) - body = models.TextField(verbose_name=_('Message')) + body = models.TextField(verbose_name=_('Note')) code = models.CharField( unique=True, @@ -92,9 +95,17 @@ class Note(MPTTModel): max_length=255, verbose_name=_('To') ) - customer = models.ForeignKey(Customer, null=True, blank=True, on_delete=models.SET_NULL) - escalation = UnsavedForeignKey(Escalation, null=True, editable=False, on_delete=models.SET_NULL) - labels = models.ManyToManyField(Tag, blank=True, limit_choices_to={'type': 'note'}) + customer = models.ForeignKey(Customer, + null=True, + blank=True, + on_delete=models.SET_NULL) + escalation = UnsavedForeignKey(Escalation, + null=True, + editable=False, + on_delete=models.SET_NULL) + labels = models.ManyToManyField(Tag, + blank=True, + limit_choices_to={'type': 'note'}) events = GenericRelation(Event) attachments = GenericRelation(Attachment, null=True, blank=True) @@ -131,16 +142,19 @@ class Note(MPTTModel): ) TYPES = ( - (T_NOTE, _('Note')), - (T_PROBLEM, _('Problem')), - (T_ESCALATION, _('Escalation')), + (T_NOTE, _("Technician's Note")), + (T_CUSTOMER_NOTE, _("Customer's Note")), + (T_PROBLEM, _("Customer Reported Issue")), + (T_VERIFIED_PROBLEM, _("Verified Verified Issue")), + (T_DIAGNOSIS, _("Diagnosis")), + (T_ESCALATION, _("Escalation")), ) type = models.IntegerField( blank=True, default=T_NOTE, choices=TYPES, - verbose_name=_('Type') + verbose_name=_('Type'), ) objects = TreeManager() @@ -159,6 +173,9 @@ class Note(MPTTModel): def get_body(self): return self.body + def get_heading(self): + return _("%s from %s" % (self.get_type_display(), self.get_sender_name())) + def get_title(self): return self.subject |