feat(inout): 옵션을 톱니 팝업으로, 겹치던 옵션 화면 정리, 공장 담당자·연락처 분리
- 옵션 탭 → 상단 오른쪽 톱니(관리자) → 팝업(탭: 담당자·공장). 내용은 /inout/settings?panel=1, 저장은 팝업 안에서(X-Inout-Options: 1 → JSON, 같은 탭 그대로 다시 그림), 바뀌면 닫을 때 새로고침. 예전 /inout/settings 주소는 목록으로 가서 팝업 열기(?options=1). - 겹침 원인: 공용 .erp-input(min-width 240px + content-box)이 좁은 칸에서 옆 칸을 덮고, .erp-table-wrap(카드 그림자·둥근 모서리)이 카드 안에서 상자를 겹쳐 보이게 함 → .io/.io-dlg 안에서만 바로잡음. 공장 표는 진짜 <table> + 입력칸 form 속성으로 열 맞춤(줄 선·배경 어긋남 없음). - 공장 담당자·연락처 분리: inout_db 002(manager 열, 이름만 있던 연락처는 담당자로). 발주서 화면에 공장 담당자·연락처. 002 미적용이어도 발주서 화면은 열리고 공장 저장만 안내. - 테스트: 팝업·JSON 저장·예전 주소·권한, 담당자/연락처, 002 전후. 실제 브라우저로 겹침 0·줄 맞춤 확인. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@ class InoutDbTests(unittest.TestCase):
|
||||
|
||||
cls.st = InoutDBStore(DSN)
|
||||
cls.tag = uuid.uuid4().hex[:6]
|
||||
cls.fid = cls.st.save_factory(factory_id=None, name=f"테스트공장-{cls.tag}", contact="김공장 010")
|
||||
cls.fid = cls.st.save_factory(factory_id=None, name=f"테스트공장-{cls.tag}", manager="김공장", contact="010-1234")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
@@ -44,6 +44,8 @@ class InoutDbTests(unittest.TestCase):
|
||||
def test_partial_receipts_until_done(self):
|
||||
o = self.order([("MT-A", 100), ("MT-B", 50)])
|
||||
self.assertRegex(o["order_no"], r"^PO-261016-\d{2}$")
|
||||
head = self.st.get_order(o["id"])
|
||||
self.assertEqual((head["factory_manager"], head["factory_contact"]), ("김공장", "010-1234")) # 담당자·연락처 따로(002)
|
||||
ids = self.line_ids(o["id"])
|
||||
self.assertEqual(self.st.get_order(o["id"])["status"], "open")
|
||||
self.st.add_receipt(o["id"], {ids["MT-A"]: "60"}, receipt_date="2026-10-20", memo="1차", confirm_over=False, by="w@x")
|
||||
|
||||
+25
-10
@@ -97,18 +97,32 @@ admin, buyer, wh, viewer = (U("admin-%s@t.local" % tag, role="admin"), U("buyer-
|
||||
users.extend([admin, buyer, wh, viewer])
|
||||
|
||||
def body(c):
|
||||
# ── 옵션: 공장·담당자(관리자만) ──
|
||||
# ── 옵션(톱니 팝업): 공장·담당자(관리자만) ──
|
||||
who["u"] = buyer
|
||||
assert c.get("/inout/settings").status_code == 403
|
||||
assert c.get("/inout/settings?panel=1").status_code == 403
|
||||
assert 'id="io-options-btn"' not in c.get("/inout/").text # 관리자 아니면 톱니 없음
|
||||
who["u"] = admin
|
||||
page = c.get("/inout/settings")
|
||||
assert page.status_code == 200 and buyer["email"] in page.text and "발주 담당" in page.text
|
||||
r = c.post("/inout/settings/factories", data={"name": "공장-" + tag, "contact": "김 010", "is_active": "1"},
|
||||
follow_redirects=False)
|
||||
assert r.status_code == 303 and "msg=" in r.headers["location"]
|
||||
fid = re.search(r'name="id" value="(\\d+)" />\\s*<input class="erp-input" type="text" name="name" value="공장-%s"' % tag,
|
||||
c.get("/inout/settings").text).group(1)
|
||||
c.post("/inout/settings/roles", data={"order_email": [buyer["email"]], "receive_email": [wh["email"]]})
|
||||
lst = c.get("/inout/").text
|
||||
assert 'id="io-options-btn"' in lst and 'id="io-options"' in lst and ">옵션</a>" not in lst # 탭 대신 톱니 + 팝업
|
||||
r = c.get("/inout/settings", follow_redirects=False) # 예전 주소 = 목록으로 가서 팝업 열기
|
||||
assert r.status_code == 303 and r.headers["location"] == "/inout/?options=1"
|
||||
assert 'data-open="1"' in c.get("/inout/?options=1").text
|
||||
panel = c.get("/inout/settings?panel=1").text
|
||||
assert buyer["email"] in panel and "발주 담당" in panel and "<html" not in panel.lower() # 팝업 안 내용만
|
||||
assert 'name="manager"' in panel and 'name="contact"' in panel # 담당자·연락처 따로
|
||||
H = {"X-Inout-Options": "1"}
|
||||
r = c.post("/inout/settings/factories", data={"name": "공장-" + tag, "manager": "김공장", "contact": "010-1",
|
||||
"is_active": "1"}, headers=H)
|
||||
assert r.status_code == 200 and r.json() == {"ok": True, "message": "공장을 저장했습니다."}
|
||||
dup = c.post("/inout/settings/factories", data={"name": "공장-" + tag, "is_active": "1"}, headers=H)
|
||||
assert dup.status_code == 400 and dup.json()["ok"] is False and "같은 이름" in dup.json()["message"]
|
||||
r = c.post("/inout/settings/factories", data={"name": "폼-" + tag, "is_active": "1"}, follow_redirects=False)
|
||||
assert r.status_code == 303 and r.headers["location"].startswith("/inout/?options=1&msg=") # 팝업이 아닌 제출 = 이동
|
||||
fid = next(f["id"] for f in main.app.state.inout_store.list_factories() if f["name"] == "공장-" + tag)
|
||||
f = next(x for x in main.app.state.inout_store.list_factories() if x["id"] == fid)
|
||||
assert (f["manager"], f["contact"]) == ("김공장", "010-1")
|
||||
assert c.post("/inout/settings/roles", data={"order_email": [buyer["email"]], "receive_email": [wh["email"]]},
|
||||
headers=H).json()["ok"]
|
||||
st = main.app.state.inout_store
|
||||
assert st.roles_of(buyer["email"]) == {"order"} and st.roles_of(wh["email"]) == {"receive"}
|
||||
|
||||
@@ -131,6 +145,7 @@ def body(c):
|
||||
assert r.status_code == 303, r.text[:300]
|
||||
oid = int(re.search(r"/inout/orders/(\\d+)", r.headers["location"]).group(1))
|
||||
detail = c.get(r.headers["location"]).text
|
||||
assert "김공장 · 010-1" in detail # 공장 담당자·연락처
|
||||
assert "가 단품" in detail and "포장 주의" in detail and "PO-261016-" in detail and "발주서 PO-261016-" in detail
|
||||
assert "이번 입고" not in detail # 발주 담당은 입고 칸이 없다
|
||||
assert c.post("/inout/orders/%d/receipts" % oid, data={"receipt_date": "2026-10-17"}).status_code == 403
|
||||
|
||||
Reference in New Issue
Block a user