Nomenclature: an element is where its folio is

element_nomenclature_view gave an element's own plant and location only,
which are empty unless typed into every element. A project structured by
its folios (=plant +location on the title block, %M / %LM) therefore
showed no place in the BOM, nomenclature tables and queries, although the
folio says where each device is -- the way EPLAN builds the device tag
from the page structure.

The view now falls back to the folio's plant and location when the
element has none of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DaTweety
2026-10-18 11:05:16 +02:00
parent 4fee464919
commit 4f0c493a7f
2 changed files with 30 additions and 2 deletions
+19
View File
@@ -4602,6 +4602,25 @@ class Integration(unittest.TestCase):
self.assertEqual(len(styles), 1, styles)
self.assertIn("dash", styles.pop())
def test_nomenclature_takes_the_place_of_the_folio(self):
"""An element without its own plant / location is where its folio
is: element_nomenclature_view (BOM, nomenclature tables) shows the
folio's =plant +location; an element's own value still wins."""
base = self.sb.new()
ops = [{"op": "add_folio", "id": "f"},
{"op": "set_folio", "folio": "$f", "property": "plant", "value": "HAUS"},
{"op": "set_folio", "folio": "$f", "property": "locmach", "value": "UV1"},
{"op": "add_element", "id": "a", "folio": "$f", "path": COIL, "x": 100, "y": 100},
{"op": "set_label", "folio": "$f", "element": "$a", "label": "KA1"},
{"op": "add_element", "id": "b", "folio": "$f", "path": COIL, "x": 300, "y": 100},
{"op": "set_label", "folio": "$f", "element": "$b", "label": "KA2"},
{"op": "set_info", "folio": "$f", "element": "$b", "key": "location", "value": "UV2"}]
r = self.ok(self.sb.edit(base, ops))
q = m.tool_query(BINARY, r["output"], "SELECT label, plant, location FROM "
"element_nomenclature_view ORDER BY label")
self.assertEqual(q["rows"], [{"label": "KA1", "plant": "HAUS", "location": "UV1"},
{"label": "KA2", "plant": "HAUS", "location": "UV2"}])
# ---- conductor manual routing ----
def test_move_conductor_segment_reroutes_the_path(self):