diff options
author | Filipp Lepalaan <filipp@mac.com> | 2021-05-19 20:27:02 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2021-05-19 20:27:02 +0300 |
commit | ce8012b7e4651eb3fa09849c3cef6fd027da87b6 (patch) | |
tree | 249ecb4099ca6784a3dfb677f45790c9dec44953 /servo | |
parent | 10e38bda7101f142a89ca0a8c935a74602411a6f (diff) | |
download | Servo-ce8012b7e4651eb3fa09849c3cef6fd027da87b6.tar.gz Servo-ce8012b7e4651eb3fa09849c3cef6fd027da87b6.tar.bz2 Servo-ce8012b7e4651eb3fa09849c3cef6fd027da87b6.zip |
Make note type field editable
Diffstat (limited to 'servo')
-rw-r--r-- | servo/migrations/0006_auto_20210519_1925.py | 23 | ||||
-rw-r--r-- | servo/models/note.py | 39 |
2 files changed, 51 insertions, 11 deletions
diff --git a/servo/migrations/0006_auto_20210519_1925.py b/servo/migrations/0006_auto_20210519_1925.py new file mode 100644 index 0000000..8d20c84 --- /dev/null +++ b/servo/migrations/0006_auto_20210519_1925.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.2 on 2021-05-19 17:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('servo', '0005_auto_20210518_1745'), + ] + + operations = [ + migrations.AlterField( + model_name='note', + name='body', + field=models.TextField(verbose_name='Note'), + ), + migrations.AlterField( + model_name='note', + name='type', + field=models.IntegerField(blank=True, choices=[(0, "Technician's Note"), (5, "Customer's Note"), (1, 'Customer Reported Issue'), (4, 'Verified Verified Issue'), (3, 'Diagnosis'), (2, 'Escalation')], default=0, verbose_name='Type'), + ), + ] 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 |