From cfb6878beaae962ea15562303974e4ab6f128b8d Mon Sep 17 00:00:00 2001
From: king
Date: Wed, 4 Nov 2026 15:29:20 +0900
Subject: [PATCH] =?UTF-8?q?feat(=EC=9E=85=EC=B6=9C=EA=B3=A0):=20=EB=B4=89?=
=?UTF-8?q?=ED=88=AC=C2=B7=EB=B0=B1=20=ED=91=9C=EC=97=90=EC=84=9C=20?=
=?UTF-8?q?=EB=8B=A8=EA=B0=80=C2=B7=EB=AC=B4=EA=B2=8C=C2=B7=EC=9D=80=20?=
=?UTF-8?q?=EC=97=B4=20=EC=A0=9C=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
봉투·백에는 단가·무게·은이 없어 표에서 네 열을 뺀다. 전에 넣은 값은
숨은 칸으로 저장 때 그대로 보내 지우지 않는다.
새 발주서·발주서 화면·발주 메일의 단가 미입력 안내에서도 봉투·백을 뺀다.
은 칸이 없는 줄에서 그룹을 바꿔도 색상 표시가 덮이지 않게 고친다.
Co-Authored-By: Claude Opus 5.5
---
app/modules/inout/CLAUDE.md | 3 ++-
app/modules/inout/store.py | 5 +++--
.../inout/templates/inout/_options_panel.html | 14 ++++++++++----
app/modules/inout/templates/inout/index.html | 4 ++--
.../inout/templates/inout/order_detail.html | 4 ++--
app/modules/inout/templates/inout/order_form.html | 4 ++--
app/modules/inout/templates/inout/pending.html | 4 ++--
app/static/inout.js | 10 +++++-----
docs/INOUT_MODULE.md | 2 +-
tests/test_inout_store.py | 4 ++++
tests/test_inout_web.py | 7 ++++++-
11 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/app/modules/inout/CLAUDE.md b/app/modules/inout/CLAUDE.md
index 11bf26f..7a89af8 100644
--- a/app/modules/inout/CLAUDE.md
+++ b/app/modules/inout/CLAUDE.md
@@ -96,7 +96,8 @@
## 봉투·백 (008, 2026-11-04)
-- 이름에 **"미라클 봉투"·"미라클백"** 이 들어간 상품(`store.is_bag`, 저장 안 함 — 이름으로 판단) = 옵션 → 상품 정보에서 일반 상품과 **표를 나눔**(봉투·백 표가 위). 박스 칸만 다름: **박스당 수량**(`body_per_box` 재사용)·**1파렛트당 박스 수량**(`inout_products.boxes_per_pallet`). 뚜껑 없음(저장하면 `lid_per_box` 는 NULL).
+- 이름에 **"미라클 봉투"·"미라클백"** 이 들어간 상품(`store.is_bag`, 저장 안 함 — 이름으로 판단) = 옵션 → 상품 정보에서 일반 상품과 **표를 나눔**(봉투·백 표가 위). 칸: **박스당 수량**(`body_per_box` 재사용)·**1파렛트당 박스 수량**(`inout_products.boxes_per_pallet`). 뚜껑 없음(저장하면 `lid_per_box` 는 NULL).
+ **단가·무게·은 칸 없음**(2026-11-04 사용자 지정) — 전에 넣은 값은 줄의 숨은 칸으로 저장 때 그대로 보내 지우지 않음. 그룹·색상 칸은 있음. 새 발주서 "단가 없는 N종"·발주서 화면과 발주 메일의 "단가 미입력 N종"(`store.order_totals`) 안내에서 봉투·백은 뺌.
- 새 발주서 합계 줄에 봉투·백 박스·파렛트를 **통·뚜껑과 따로** 표시: 파렛트 = ⌈Σ(박스 ÷ 그 상품 1파렛트 박스)⌉, 그림 없음. 입수·1파렛트 값은 `store.box_info`(`_form_page`·`/api/items`).
- 008 확인 `db.bags_ready`(boxes_ready 와 같은 방식). 미적용이면 모두 일반 상품으로 동작.
diff --git a/app/modules/inout/store.py b/app/modules/inout/store.py
index 5fd1842..07eeb99 100644
--- a/app/modules/inout/store.py
+++ b/app/modules/inout/store.py
@@ -547,7 +547,8 @@ def order_totals(lines: list[dict[str, Any]]) -> dict[str, Any]:
q = int(x["qty"])
a = line_amount(q, x.get("unit_price"))
if a is None:
- missing += 1
+ if not is_bag(x.get("item_name")): # 봉투·백은 단가가 원래 없음 — "단가 미입력" 안내에서 뺀다
+ missing += 1
else:
amount = (amount or Decimal(0)) + a
w = to_dec(x.get("weight_g"))
@@ -557,7 +558,7 @@ def order_totals(lines: list[dict[str, Any]]) -> dict[str, Any]:
if w is not None and p is not None: # 개당 은 g 를 반올림하기 전 값으로 곱한다(합계 오차 방지)
ag = (ag or Decimal(0)) + w * p / Decimal(100) * q
use = (use or Decimal(0)) + w * q * (Decimal(100) - p) / Decimal(100000)
- return {"amount": amount, "missing_price": missing if amount is not None else len(lines), "pp_kg": pp, "silver_g": ag,
+ return {"amount": amount, "missing_price": missing, "pp_kg": pp, "silver_g": ag,
"pp_use_kg": use}
diff --git a/app/modules/inout/templates/inout/_options_panel.html b/app/modules/inout/templates/inout/_options_panel.html
index bac5eba..3dfbc85 100644
--- a/app/modules/inout/templates/inout/_options_panel.html
+++ b/app/modules/inout/templates/inout/_options_panel.html
@@ -141,7 +141,7 @@
값을 넣은 상품은 다시 불러와도 그대로이고, 지운 단품은 다음 불러오기에서 빠집니다. 발주서 제품은 이 목록에서 고르며, 발주할 때의 값이 발주서에 남습니다.
{% if groups_ready %}그룹을 고른 상품은 은 함유량·색상을 그룹 값으로 씁니다(상품 그룹 탭에서 한 번만 설정).{% endif %}
{% if boxes_ready %}통 수량(박스)·뚜껑 수량(박스) = 통·뚜껑이 한 박스에 몇 개씩 들어가는지(뚜껑이 없으면 빈칸) — 새 발주서에서 박스 수·파렛트 수를 계산합니다.{% endif %}
- 이름에 "미라클 봉투"·"미라클백"이 들어간 상품은 봉투·백 표에서 박스당 수량·1파렛트당 박스 수량을 넣습니다.
+ 이름에 "미라클 봉투"·"미라클백"이 들어간 상품은 봉투·백 표에서 박스당 수량·1파렛트당 박스 수량을 넣습니다(단가·무게·은 없음).