40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
"""Check qjsc field details in OA template"""
|
|
import sys, os
|
|
sys.path.insert(0, os.path.dirname(__file__))
|
|
|
|
from app import create_app
|
|
app = create_app('development')
|
|
with app.app_context():
|
|
from app.services.oa_leave_workflow import OALeaveWorkflowService, NS
|
|
import xml.etree.ElementTree as ET
|
|
|
|
filler = OALeaveWorkflowService._resolve_runtime_oa_user('26030025', '梁春艳', role_label='filler')
|
|
template = OALeaveWorkflowService._get_template_request_info(
|
|
OALeaveWorkflowService.WORKFLOW_ID, filler['user_id']
|
|
)
|
|
|
|
for field in template.findall('.//wf:WorkflowRequestTableField', NS):
|
|
fname = field.findtext('wf:fieldName', default='', namespaces=NS)
|
|
if fname == 'qjsc':
|
|
print('=== qjsc (duration) field ===')
|
|
for child in field:
|
|
tag = child.tag.split('}')[1] if '}' in child.tag else child.tag
|
|
print(f' {tag}: {child.text!r}')
|
|
break
|
|
else:
|
|
print('qjsc field NOT FOUND in template')
|
|
|
|
# Also check after setting
|
|
from copy import deepcopy
|
|
modified = deepcopy(template)
|
|
OALeaveWorkflowService._set_field(modified, 'qjsc', value='9', show_value='9')
|
|
|
|
for field in modified.findall('.//wf:WorkflowRequestTableField', NS):
|
|
fname = field.findtext('wf:fieldName', default='', namespaces=NS)
|
|
if fname == 'qjsc':
|
|
print('\n=== qjsc AFTER _set_field ===')
|
|
for child in field:
|
|
tag = child.tag.split('}')[1] if '}' in child.tag else child.tag
|
|
print(f' {tag}: {child.text!r}')
|
|
break
|