diff --git a/app/modules/asset/db.py b/app/modules/asset/db.py
index 697277f..70ce963 100644
--- a/app/modules/asset/db.py
+++ b/app/modules/asset/db.py
@@ -229,9 +229,14 @@ class AssetStore:
compatible = [a for a in matches if compatible_monitor(a, device)]
asset = linked or (compatible[0] if len(compatible) == 1 else None)
candidates = matches if not asset else []
+ # candidate_by — 후보가 같은 시리얼(같은 실물일 가능성)인지, 참고용 같은 모델·이름인지.
+ # 같은 모델은 여러 대일 수 있으므로(듀얼 모니터 등) 새 등록을 막지 않는다(2026-10-07).
+ candidate_by = "serial" if candidates else ""
if not asset and not candidates:
candidates = conn.execute("SELECT * FROM assets WHERE category='monitor' AND deleted_at IS NULL AND (lower(btrim(model))=%s OR lower(btrim(name))=%s) ORDER BY id LIMIT 20", (device["model"].casefold(), device["name"].casefold())).fetchall()
+ candidate_by = "model" if candidates else ""
result.append({**device, "asset": serialize(asset), "candidates": [serialize(r) for r in candidates],
+ "candidate_by": candidate_by,
"match": "linked" if linked else "serial" if asset else "unconfirmed"})
return result
@@ -263,8 +268,10 @@ class AssetStore:
monitor_id = target["id"]
else:
match = self._monitor_matches(conn, computer_id, row["parsed"])[index]
- if match["asset"] or (device["serial"] and match["candidates"]):
- raise AssetConflict("이미 등록된 모니터가 있습니다. 기존 자산을 확인하고 연결하세요.")
+ # 같은 시리얼(같은 실물)만 막는다 — 같은 모델이지만 시리얼이 다른 모니터는 새 자산으로 등록된다.
+ if match["asset"] or match["candidate_by"] == "serial":
+ raise AssetConflict(f"같은 시리얼({device['serial']})의 모니터가 이미 등록되어 있습니다. 기존 자산에 연결하세요."
+ if device["serial"] else "이 모니터는 이미 자산에 연결되어 있습니다.")
# 보고서의 실제 시리얼을 유지해야 이후 보고서에서도 같은 장비를 찾습니다.
data = payload.asset.model_copy(update={"serial": device["serial"] or payload.asset.serial})
monitor_id = self._create(conn, data, actor)
diff --git a/app/modules/asset/templates/asset/index.html b/app/modules/asset/templates/asset/index.html
index f0d6be8..5439617 100644
--- a/app/modules/asset/templates/asset/index.html
+++ b/app/modules/asset/templates/asset/index.html
@@ -67,4 +67,4 @@
{% endblock %}
-{% block scripts %}{% endblock %}
+{% block scripts %}{% endblock %}
diff --git a/app/static/asset.js b/app/static/asset.js
index ca05f64..6bb61d5 100644
--- a/app/static/asset.js
+++ b/app/static/asset.js
@@ -387,7 +387,7 @@
return `
${m.candidate_by === "serial" ? "같은 시리얼의 모니터 자산이 이미 있습니다. 같은 장비이므로 아래 자산에 연결하세요." : m.candidates?.length ? "같은 모델의 다른 자산이 있습니다. 같은 장비면 연결하고, 다른 장비(예: 듀얼 모니터)면 새로 등록하세요." : "연결된 자산이 없습니다."}
`;
}
diff --git a/docs/ASSET_MODULE.md b/docs/ASSET_MODULE.md
index 3688c75..acca1fa 100644
--- a/docs/ASSET_MODULE.md
+++ b/docs/ASSET_MODULE.md
@@ -18,6 +18,9 @@
시리얼이 없거나 중복·제조사/모델 불일치인 경우 자동 확정하지 않고 후보를 직접 연결한다.
- 미등록 모니터는 보고서의 이름/제조사/모델/시리얼과 컴퓨터의 위치/부서를 채운 등록 창을 연다.
생성과 컴퓨터 연결은 한 트랜잭션으로 저장한다. 동시 등록은 컴퓨터 행 잠금과 시리얼 잠금으로 보호한다.
+- 새 등록을 막는 것은 **같은 시리얼의 모니터 자산이 이미 있을 때뿐**이다(같은 실물 — 기존 자산에 연결).
+ 같은 모델·이름의 자산은 참고 후보로만 보여 주고(`candidate_by = "model"`), 시리얼이 다르거나 없으면 새 자산으로 등록된다
+ (듀얼 모니터처럼 같은 모델 여러 대 — 2026-10-07 수정, 예전엔 같은 모델 후보만 있어도 막혔다).
- 등록·연결은 최신 보고서에서만 가능하다. 이전 보고서도 모니터와 자산 개요를 조회할 수 있다.
기존에 업로드한 보고서도 재업로드 없이 지원한다.
diff --git a/tests/test_asset_features.py b/tests/test_asset_features.py
index 60f4cfe..7b863b4 100644
--- a/tests/test_asset_features.py
+++ b/tests/test_asset_features.py
@@ -104,6 +104,21 @@ class FeatureStoreTests(unittest.TestCase):
match=self.store._monitor_matches(self.conn,"other-computer",unknown)[0]
self.assertIsNone(match["asset"]);self.assertEqual(len(match["candidates"]),2)
+ def test_same_model_different_serial_can_be_registered(self):
+ # 같은 모델(듀얼 모니터 등)이 이미 있어도 시리얼이 다르면 새 자산으로 등록된다(2026-10-07)
+ other = self.store.create(AssetInput(name="Display", category="monitor", model="Display 24", serial="SN-OTHER"), "actor")
+ match = self.store._monitor_matches(self.conn, self.computer, self.parsed)[0]
+ self.assertIsNone(match["asset"]); self.assertEqual(match["candidate_by"], "model")
+ self.assertEqual([c["id"] for c in match["candidates"]], [other])
+ target = self.store.register_monitor(self.computer, 0, self.monitor_payload(asset=AssetInput(name="Second", category="monitor", model="Display 24")), "actor")
+ self.assertNotEqual(target, other); self.assertEqual(self.conn.assets[target]["serial"], "SN-1")
+
+ def test_same_serial_still_blocks_new_registration(self):
+ self.store.create(AssetInput(name="Other", category="monitor", serial="SN-1", model="Different Model", manufacturer="Another"), "actor")
+ self.assertEqual(self.store._monitor_matches(self.conn, self.computer, self.parsed)[0]["candidate_by"], "serial")
+ with self.assertRaises(AssetConflict):
+ self.store.register_monitor(self.computer, 0, self.monitor_payload(asset=AssetInput(name="Dup", category="monitor")), "actor")
+
def test_existing_unique_serial_matches_automatically(self):
target=self.store.create(AssetInput(name="Existing",category="monitor",serial="sn-1"),"actor")
match=self.store._monitor_matches(self.conn,self.computer,self.parsed)[0]