Commit d938adfd authored by Jérome Perrin's avatar Jérome Perrin

forge: update bug modification date when posting a new comment on a bug

This is done by making the data model closer to erp5_crm, by making "bug
events" use follow up relation to the "bug ticket" and enabling standard
interactions for events.
parent a2b6b1ca
......@@ -5,7 +5,7 @@
</chain>
<chain>
<type>Bug Line</type>
<workflow>bug_event_workflow, edit_workflow</workflow>
<workflow>bug_event_workflow, edit_workflow, event_interaction_workflow</workflow>
</chain>
<chain>
<type>Glossary Term</type>
......
......@@ -2,7 +2,8 @@
portal = context.getPortalObject()
edit_kw = {'content_type': portal.portal_preferences.getPreferredTextFormat(),
'start_date': DateTime(),
'destination_value_list': context.BugLine_getRecipientValueList()}
'destination_value_list': context.BugLine_getRecipientValueList(),
'follow_up_value': context.getParentValue()}
# Define a Reporter as Source Trade
person = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
......
"""Add a note to increase modification date of bug.
This script has proxy roles, so that even users who cannot modify
the bug can still increase the modification date this way.
"""
from Products.ERP5Type.Message import translateString
context.getPortalObject().portal_workflow.doActionFor(
context,
'edit_action',
comment=translateString("New comment"))
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>event</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Bug_afterNewEvent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_view_style
erp5_base
\ No newline at end of file
erp5_base
erp5_crm
\ No newline at end of file
Bug Line | bug_event_workflow
Bug Line | edit_workflow
Bug Line | event_interaction_workflow
Bug | bug_workflow
Bug | edit_workflow
Glossary Term | edit_workflow
......
......@@ -62,8 +62,8 @@ class TestBug(ERP5TypeTestCase):
Return the list of required business templates.
"""
return ( 'erp5_base'
, 'erp5_crm'
, 'erp5_forge'
, 'erp5_base'
, 'erp5_pdm'
, 'erp5_trade'
, 'erp5_project'
......@@ -604,6 +604,17 @@ class TestBug(ERP5TypeTestCase):
self.workflow_tool.doActionFor(bug, 'stop_action', send_event=1)
self.assertEqual(bug.getSimulationState(), 'stopped')
def test_posting_bug_line_updates_bug_modification_date(self):
bug = self.portal.bug_module.newContent(portal_type='Bug')
bug_modification_date = bug.getModificationDate()
bug_line = bug.newContent(portal_type='Bug Line')
self.assertEqual(bug.getModificationDate(), bug_modification_date)
bug_line.start()
self.commit()
self.assertGreater(bug.getModificationDate(), bug_modification_date)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestBug))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment