fix(cfe-borrow,form-edit,cfe-patch-method): fix borrowed form structure to match Configurator

- cfe-borrow: keep AutoCommandBar ChildItems (buttons) with CommandName=0
  instead of stripping them — Configurator expects buttons to be present
- form-edit: insert Events section after AutoCommandBar, not before —
  matches Configurator's element ordering
- cfe-patch-method(py): fix \r\r\n double line endings by using
  newline="" in open() calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-10 21:40:16 +03:00
parent 8584021446
commit 84d078bd05
5 changed files with 28 additions and 13 deletions
@@ -1162,7 +1162,15 @@ form_events_list = defn.get("formEvents") or []
if form_events_list:
events_section = root.find("f:Events", NS)
if events_section is None:
events_section = etree.SubElement(root, f"{{{FORM_NS}}}Events")
events_section = etree.Element(f"{{{FORM_NS}}}Events")
# Insert after AutoCommandBar (Events come after AutoCommandBar in 1C)
acb_node = root.find("f:AutoCommandBar", NS)
if acb_node is not None:
acb_idx = list(root).index(acb_node)
acb_node.tail = (acb_node.tail or "") + "\r\n\t"
root.insert(acb_idx + 1, events_section)
else:
root.append(events_section)
evt_child_indent = get_child_indent(events_section)
if not evt_child_indent: