Just an update, I've managed to maske some progress
not sure where i got the
.before idea from but it wasn't working.
I've change my script to the following, but it still has issues when trying to compare dates
from java.util import Calendar
from java.util import Date
from psdi.server import MXServer
from psdi.mbo import MboConstants
parentwo=mbo.getMboSet("PARENT").getMbo(0)
childwoexinsptype = mbo.getString("WO11")
locationvisinsp = mbo.getDate('LOCATION.VISINSPDATE')
locationdetinsp = mbo.getDate('LOCATION.DETINSPDATE')
childwoactfinish = mbo.getDate('ACTFINISH')
#SET CHILD WO ACTSTART AND ACTFINISH THE SAME AS PARENT WO
mbo.setValue("ACTFINISH",parentwo.getDate("ACTFINISH"),MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION)
mbo.setValue("ACTSTART",parentwo.getDate("ACTSTART"),MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION)
#CHECK IF THE CHILD EX INSPECTION TYPE IS NOT POPULATED AND CASCADE THE VALUE FROM THE PARENT WO
if(childwoexinsptype ==""):
parentwoexinsptype = parentwo.getString("WO11")
mbo.setValue("WO11",parentwoexinsptype,MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION)
#CASCADE THE ACTFINISH DATE TO THE LOCATION DEPENDANT ON EX INSPECTION TYPE
if (locationvisinsp is None and mbo.getString('WO11') == 'VISUAL INSP OK'):
mbo.setValue("LOCATION.VISINSPDATE", parentwo.getDate("ACTFINISH"))
elif (locationvisinsp < parentwo.getDate("ACTFINISH") and mbo.getString('WO11') == 'VISUAL INSP OK'):
mbo.setValue("LOCATION.VISINSPDATE", parentwo.getDate("ACTFINISH"))
elif (locationdetinsp is None and mbo.getString('WO11') == 'DETAILED INSP OK'):
mbo.setValue("LOCATION.DETINSPDATE", parentwo.getDate("ACTFINISH"))
elif (locationdetinsp < parentwo.getDate("ACTFINISH") and mbo.getString('WO11') == 'DETAILED INSP OK'):
mbo.setValue("LOCATION.DETINSPDATE", parentwo.getDate("ACTFINISH"))
else:
pass
------------------------------
Richard White
------------------------------