Allow editing orders in the order card
Cashiers can edit recipient, TTN, notes, goods and total in the order
modal and save via PATCH /orders/{id}. Edited orders get edited_at and
are no longer overwritten by CRM sync. Editing is blocked once a receipt
exists; changing the TTN resets Nova Poshta tracking fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,14 +24,18 @@ MODEL_TABLES = set(Base.metadata.tables)
|
||||
|
||||
|
||||
def _migration_block(table: str) -> str:
|
||||
"""Тело вызова op.create_table для указанной таблицы.
|
||||
"""Тело вызова op.create_table для указанной таблицы плюс её поздние op.add_column.
|
||||
|
||||
Границей служит следующий op.create_table; для последней таблицы — конец файла.
|
||||
Границей create_table служит следующий op.create_table или конец файла миграции.
|
||||
"""
|
||||
start = COMBINED_SOURCE.index(f'op.create_table(\n "{table}",')
|
||||
next_table = COMBINED_SOURCE.find("op.create_table(", start + 1)
|
||||
end = next_table if next_table != -1 else len(COMBINED_SOURCE)
|
||||
return COMBINED_SOURCE[start:end]
|
||||
marker = f'op.create_table(\n "{table}",'
|
||||
source = next(text for text in SOURCES.values() if marker in text)
|
||||
start = source.index(marker)
|
||||
next_table = source.find("op.create_table(", start + 1)
|
||||
end = next_table if next_table != -1 else len(source)
|
||||
# Колонки, добавленные позже через op.add_column, — в любой миграции.
|
||||
added = re.findall(rf'op\.add_column\(\s*"{table}",\s*(sa\.Column\(.*?\n)', COMBINED_SOURCE)
|
||||
return source[start:end] + "\n" + "\n".join(added)
|
||||
|
||||
|
||||
def test_migrations_create_every_model_table() -> None:
|
||||
|
||||
Reference in New Issue
Block a user