Opened 9 years ago
Closed 9 years ago
#12400 closed defect (fixed)
Custom field "milestone" is not appeared with the field is defined and defined milestones are removed
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.11 |
Component: | ticket system | Version: | 1.0.10 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fix missing milestone field in ticket form when the field is custom field and no defined milestones. |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Custom field is allow to use the same name of ticket field when no defined enums/components/milestones/versions. Actually, priority, version, component, resolution, severity and type fields is appeared in ticket box and form.
However, milestone field is not appeared in ticket form. The milestone is appeared in ticket view.
[ticket-custom] priority = text priority.format = plain priority.label = (priority) priority.options = priority.order = 1 priority.value = milestone = text milestone.format = plain milestone.label = (milestone) milestone.options = milestone.order = 2 milestone.value = version = text version.format = plain version.label = (version) version.options = version.order = 3 version.value = component = text component.format = plain component.label = (component) component.options = component.order = 4 component.value = resolution = text resolution.format = plain resolution.label = (resolution) resolution.options = resolution.order = 5 resolution.value = severity = text severity.format = plain severity.label = (severity) severity.options = severity.order = 6 severity.value = type = text type.format = plain type.label = (type) type.options = type.order = 7 type.value =
Attachments (2)
Change History (8)
by , 9 years ago
Attachment: | ticket-box.png added |
---|
by , 9 years ago
Attachment: | ticket-form.png added |
---|
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
Description: | modified (diff) |
---|
comment:3 by , 9 years ago
comment:4 by , 9 years ago
Milestone: | next-stable-1.0.x → 1.0.11 |
---|---|
Owner: | set to |
Status: | new → assigned |
The following would fix missing milestone as custom field in ticket form. That issue in comment:3 would be fixed in #12399.
-
trac/ticket/tests/web_ui.py
diff --git a/trac/ticket/tests/web_ui.py b/trac/ticket/tests/web_ui.py index ace7a545f..5c98ff435 100644
a b import unittest 16 16 from trac.core import TracError 17 17 from trac.resource import ResourceNotFound 18 18 from trac.test import EnvironmentStub, Mock, MockPerm, locale_en 19 from trac.ticket.api import TicketSystem 19 20 from trac.ticket.model import Ticket 20 21 from trac.ticket.web_ui import TicketModule 21 22 from trac.util.datefmt import utc … … class TicketModuleTestCase(unittest.TestCase): 110 111 self.assertRaises(ResourceNotFound, 111 112 self.ticket_module.process_request, req) 112 113 114 def test_newticket_with_milestone_as_custom_field(self): 115 self.env.config.set('ticket-custom', 'milestone', 'text') 116 self.env.db_transaction("DELETE FROM milestone") 117 tktsys = TicketSystem(self.env) 118 tktsys.reset_ticket_fields() 119 del tktsys.custom_fields 120 121 req = self._create_request(path_info='/newticket') 122 self.assertEqual(True, self.ticket_module.match_request(req)) 123 resp = self.ticket_module.process_request(req) 124 for field in resp[1]['fields']: 125 if field['name'] == 'milestone': 126 self.assertTrue(field['custom']) 127 self.assertFalse(field['options']) 128 self.assertFalse(field.get('optgroups')) 129 break 130 else: 131 self.fail('Missing milestone in fields') 132 113 133 114 134 def suite(): 115 135 suite = unittest.TestSuite() -
trac/ticket/web_ui.py
diff --git a/trac/ticket/web_ui.py b/trac/ticket/web_ui.py index 5c267d9e3..f047a228b 100644
a b class TicketModule(Component): 1496 1496 if 'TICKET_MODIFY' in req.perm(ticket.resource): 1497 1497 field['skip'] = False 1498 1498 owner_field = field 1499 elif name == 'milestone' :1499 elif name == 'milestone' and not field.get('custom'): 1500 1500 milestones = [Milestone(self.env, opt) 1501 1501 for opt in field['options']] 1502 1502 milestones = [m for m in milestones
comment:5 by , 9 years ago
Proposed changes in log:jomae.git@t12400, added unit tests for other fields.
comment:6 by , 9 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Query system crashes in this case.