mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 16:49:41 +03:00
fix(form-compile): AutoTitle=false по умолчанию при заданном Title формы
Когда у формы задан Title (через defn.title или properties.title), эмитим AutoTitle=false если пользователь явно его не указал. Иначе платформа добавляет суффикс синонима и получается двойной заголовок (Номенклатура: Номенклатура). В выгрузках ERP так делает ~95% форм с form-level Title. Снапшоты form-compile/form-compile-from-object обновлены под новое поведение. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.11 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.12 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$JsonPath,
|
||||
@@ -2805,17 +2805,26 @@ if ($formTitle) {
|
||||
}
|
||||
|
||||
# 12b. Properties (skip 'title' — handled above as multilingual)
|
||||
# When form-level Title is set, default autoTitle=false (≈95% of ERP forms do this;
|
||||
# otherwise platform appends synonym → "Title: Synonym" double-titles).
|
||||
$propsClone = New-Object PSObject
|
||||
$hasAutoTitle = $false
|
||||
if ($def.properties) {
|
||||
foreach ($p in $def.properties.PSObject.Properties) {
|
||||
if ($p.Name -eq "autoTitle") { $hasAutoTitle = $true }
|
||||
}
|
||||
}
|
||||
if ($formTitle -and -not $hasAutoTitle) {
|
||||
$propsClone | Add-Member -NotePropertyName "autoTitle" -NotePropertyValue $false
|
||||
}
|
||||
if ($def.properties) {
|
||||
$propsClone = New-Object PSObject
|
||||
foreach ($p in $def.properties.PSObject.Properties) {
|
||||
if ($p.Name -ne "title") {
|
||||
$propsClone | Add-Member -NotePropertyName $p.Name -NotePropertyValue $p.Value
|
||||
}
|
||||
}
|
||||
Emit-Properties -props $propsClone -indent "`t"
|
||||
} else {
|
||||
Emit-Properties -props $null -indent "`t"
|
||||
}
|
||||
Emit-Properties -props $propsClone -indent "`t"
|
||||
|
||||
# 12c. CommandSet (excluded commands)
|
||||
if ($def.excludedCommands -and $def.excludedCommands.Count -gt 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.11 — Compile 1C managed form from JSON or object metadata
|
||||
# form-compile v1.12 — Compile 1C managed form from JSON or object metadata
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import copy
|
||||
@@ -2681,9 +2681,16 @@ def main():
|
||||
emit_mltext(lines, '\t', 'Title', str(form_title))
|
||||
|
||||
# Properties (skip 'title' — handled above)
|
||||
if defn.get('properties'):
|
||||
props_clone = {k: v for k, v in defn['properties'].items() if k != 'title'}
|
||||
emit_properties(lines, props_clone, '\t')
|
||||
# When form-level Title is set, default autoTitle=false (≈95% of ERP forms do this;
|
||||
# otherwise platform appends synonym → "Title: Synonym" double-titles).
|
||||
props_src = defn.get('properties') or {}
|
||||
props_clone = OrderedDict()
|
||||
if form_title and 'autoTitle' not in props_src:
|
||||
props_clone['autoTitle'] = False
|
||||
for k, v in props_src.items():
|
||||
if k != 'title':
|
||||
props_clone[k] = v
|
||||
emit_properties(lines, props_clone, '\t')
|
||||
|
||||
# CommandSet (excluded commands)
|
||||
if defn.get('excludedCommands') and len(defn['excludedCommands']) > 0:
|
||||
|
||||
Reference in New Issue
Block a user