Tabelle anpassen
This commit is contained in:
parent
947b412441
commit
063295110d
6
main.py
6
main.py
|
|
@ -452,7 +452,6 @@ with col2:
|
||||||
|
|
||||||
final_data["items"] = extract_invoice_items_pure_python(pdf_text)
|
final_data["items"] = extract_invoice_items_pure_python(pdf_text)
|
||||||
|
|
||||||
# 🔥 REPARATUR: Erhöhe den Zähler, um Streamlits Widget-Cache für die neue Rechnung komplett zu wipen
|
|
||||||
st.session_state.invoice_counter += 1
|
st.session_state.invoice_counter += 1
|
||||||
st.session_state.extracted_data = final_data
|
st.session_state.extracted_data = final_data
|
||||||
|
|
||||||
|
|
@ -520,11 +519,9 @@ with col2:
|
||||||
|
|
||||||
edited_items = []
|
edited_items = []
|
||||||
|
|
||||||
# Hole den aktuellen Rechnungs-ID-Zustand für die Widget-Keys
|
|
||||||
inv_id = st.session_state.invoice_counter
|
inv_id = st.session_state.invoice_counter
|
||||||
|
|
||||||
for idx, item in enumerate(data.get("items", [])):
|
for idx, item in enumerate(data.get("items", [])):
|
||||||
# 🔥 REPARATUR: Alle Keys sind jetzt an die 'inv_id' gekoppelt. Neue Rechnung = Neue Keys = Frische Daten!
|
|
||||||
with st.expander(f"📋 Position {idx+1}: {item.get('name', 'Dienstleistung')}", expanded=True):
|
with st.expander(f"📋 Position {idx+1}: {item.get('name', 'Dienstleistung')}", expanded=True):
|
||||||
|
|
||||||
c_del, _ = st.columns([1, 4])
|
c_del, _ = st.columns([1, 4])
|
||||||
|
|
@ -545,7 +542,8 @@ with col2:
|
||||||
|
|
||||||
c_qty, c_unit, c_price, c_total = st.columns(4)
|
c_qty, c_unit, c_price, c_total = st.columns(4)
|
||||||
with c_qty:
|
with c_qty:
|
||||||
item_quantity = st.number_input("Menge", value=float(item.get("quantity") or 0.0), format="%.1f", step=0.1, key=f"item_qty_{inv_id}_{idx}")
|
# 🔥 GEÄNDERT: Format auf %.3f gesetzt, step bleibt bei 0.1
|
||||||
|
item_quantity = st.number_input("Menge", value=float(item.get("quantity") or 0.0), format="%.3f", step=0.1, key=f"item_qty_{inv_id}_{idx}")
|
||||||
with c_unit:
|
with c_unit:
|
||||||
item_unit = st.text_input("Einheit", value=item.get("unit", "Stk."), key=f"item_unit_{inv_id}_{idx}")
|
item_unit = st.text_input("Einheit", value=item.get("unit", "Stk."), key=f"item_unit_{inv_id}_{idx}")
|
||||||
with c_price:
|
with c_price:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue