Aug 4 - Update code to follow up - MT12b
This commit is contained in:
@@ -467,6 +467,19 @@ def create_inspection():
|
||||
_sched = _resolve_schedule(_sched_id, user)
|
||||
inspection_schedule_id = _sched.id if _sched else None
|
||||
|
||||
# phase48 — inherit the follow-up link from the schedule when the client
|
||||
# did not send one. A schedule created by "Schedule Follow-up" knows
|
||||
# which inspection it answers, so the link must not depend on the client
|
||||
# remembering to pass it: an older build, or a draft resumed after the
|
||||
# cached row was refreshed, would otherwise submit a plain inspection
|
||||
# and leave the parent flagged forever. Never overrides an explicit
|
||||
# parent_inspection_id.
|
||||
if not parent_inspection_id and _sched is not None and _sched.parent_inspection_id:
|
||||
parent_inspection_id = _sched.parent_inspection_id
|
||||
logger.info('API INSPECTIONS | parent inherited from schedule | '
|
||||
'schedule=%s | parent=%s | user=%s',
|
||||
_sched.id, parent_inspection_id, user.username)
|
||||
|
||||
inspection = Inspection(
|
||||
template_id = template_id,
|
||||
facility_id = facility_id,
|
||||
|
||||
Reference in New Issue
Block a user