From aac83e25afc7fc9d7410b99e5467d42e7dd62aa0 Mon Sep 17 00:00:00 2001 From: Wenjie Zheng <wenjie.zheng@tiolive.com> Date: Fri, 31 Jul 2015 16:06:22 +0000 Subject: [PATCH] patches/DCWorkflow.py: when generate xml file, verfie the existence of the object, if an object id is bad defined, don't put it in XML. --- product/ERP5Type/patches/DCWorkflow.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/product/ERP5Type/patches/DCWorkflow.py b/product/ERP5Type/patches/DCWorkflow.py index c67982aae4..b7ac653b93 100644 --- a/product/ERP5Type/patches/DCWorkflow.py +++ b/product/ERP5Type/patches/DCWorkflow.py @@ -871,7 +871,13 @@ def DCWorkflowDefinition_showAsXML(self, root=None): sdef = self.states[sid] state = SubElement(states, 'state', attrib=dict(reference=sid,portal_type='State')) for property_id in sorted(state_prop_id_to_show): - property_value = getattr(sdef, property_id, '') + # do not put non-exist transition id in xml: + if property_id == 'transitions': + property_value = () + for transition_id in getattr(sdef, property_id, ''): + if transition_id in self.transitions.keys(): + property_value = property_value + (transition_id, ) + else: property_value = getattr(sdef, property_id, '') if property_value is None or property_value == [] or property_value ==(): property_value = '' property_type = state_prop_id_to_show[property_id] -- 2.30.9