Плоская форма ОСВ 1С: счёт из шапки, «Итого развернутое», плоский список, контрагенты расчётных счетов (#59) #63

Merged
aep merged 16 commits from feat/59-osv-flat-form into main 2026-10-19 13:21:55 +03:00
2 changed files with 11 additions and 2 deletions
Showing only changes of commit 8dd8a50868 - Show all commits

View File

@ -584,10 +584,11 @@ def _kind_row_groups(sheet: Sheet, header: TableHeader, rules: Rules) -> list[Os
"""Виды субконто из строки шапки между названием и периодом: только узнанные явной записью словаря групп, не
ACCOUNT; метки шапки (в том числе валюта) видом субконто не считаются."""
cells = _head_cells(sheet, header)
currency = _currency_cells(cells, rules)
currency = rules.headers.header_markers["currency"]
groups: list[OsvGroup] = []
for cell in _kind_row_cells(cells, rules):
if cell in currency or _is_structural_marker(cell, rules):
# Метка валюты — с двоеточием или без него: «Валюта БУ, НУ» вид субконто не называет
if _find(currency, cell.text) is not None or _is_structural_marker(cell, rules):
continue
for item in (part.strip() for part in cell.text.split(_LIST_SEPARATOR)):
known = rules.groups.known(item) if item else None

View File

@ -649,5 +649,13 @@ def test_currency_row_between_title_and_period_is_not_added_to_schema(rules: Rul
assert _flat_schema(rules, "Валюта БУ, НУ: RUB") == [("ACCOUNT", "Субконто")]
def test_currency_row_without_colon_is_not_added_to_schema(rules: Rules) -> None:
assert _flat_schema(rules, "Валюта БУ, НУ") == [("ACCOUNT", "Субконто")]
def test_account_cell_between_title_and_period_does_not_add_second_account(rules: Rules) -> None:
assert _flat_schema(rules, "Счет") == [("ACCOUNT", "Субконто")]
def test_subkonto_cell_between_title_and_period_does_not_add_second_account(rules: Rules) -> None:
assert _flat_schema(rules, "Субконто") == [("ACCOUNT", "Субконто")]