Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
00a501a
chore: Do not install `setuptools` using Make tasks
jtrobles-cdd Oct 30, 2025
83a495b
Merge pull request #928 from cordada/do-not-install-setuptools-throug…
jtrobles-cdd Oct 30, 2025
2272bd0
fix: Installing Pip version 24 in GitHub Actions fails when default's 25
jtrobles-cdd Oct 30, 2025
bb927bf
Merge pull request #929 from cordada/install-specific-pip-version-git…
jtrobles-cdd Oct 30, 2025
8758118
chore(deps): Bump lxml from 5.4.0 to 6.0.2
dependabot[bot] Oct 30, 2025
4aad11b
Merge pull request #907 from cordada/dependabot/pip/lxml-6.0.2
jtrobles-cdd Oct 30, 2025
5e3798b
chore(deps): Bump typing-extensions from 4.14.0 to 4.15.0
dependabot[bot] Nov 1, 2025
de07028
Merge pull request #934 from cordada/dependabot/pip/typing-extensions…
jtrobles-cdd Nov 3, 2025
fc685e1
chore(deps): Bump django from 4.2.25 to 4.2.26
dependabot[bot] Nov 6, 2025
cd8c80d
Merge pull request #935 from cordada/dependabot/pip/django-4.2.26
jtrobles-cdd Nov 11, 2025
702734a
chore(deps): Bump pip-tools from 7.4.1 to 7.5.1
dependabot[bot] Nov 11, 2025
57c41e8
Merge pull request #933 from cordada/dependabot/pip/pip-tools-7.5.1
svillegas-cdd Nov 13, 2025
953eeb8
chore(deps): Bump pip-tools from 7.5.1 to 7.5.2
svillegas-cdd Nov 13, 2025
8c1b857
Merge pull request #938 from cordada/deps-update-pip-tools-7.5.2
svillegas-cdd Nov 13, 2025
e07d848
chore(deps): Bump pip from 24.2 to 25.3
dependabot[bot] Nov 13, 2025
7e0486f
Merge pull request #917 from cordada/dependabot/pip/pip-25.3
svillegas-cdd Nov 13, 2025
9898051
fix(rcv): Refactor grouping logic for RCV parsing
svillegas-cdd Nov 13, 2025
34f50d9
Merge pull request #937 from cordada/task/sc-17311--lib-cl-sii-python…
svillegas-cdd Nov 13, 2025
f0621e6
chore: Update history for new version
svillegas-cdd Nov 13, 2025
b2cc1ec
chore: Bump version from 0.62.0 to 0.63.0
svillegas-cdd Nov 13, 2025
da737dd
Merge pull request #939 from cordada/release/v0.63.0
svillegas-cdd Nov 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.62.0
current_version = 0.63.0
commit = True
tag = False
message = chore: Bump version from {current_version} to {new_version}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
python-version: "${{ matrix.python_version }}"
check-latest: true

- name: Install Pip
run: make python-pip-install

- name: Create Python Virtual Environment
run: make python-virtualenv PYTHON_VIRTUALENV_DIR="venv"

Expand Down
12 changes: 12 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# History

## 0.63.0 (2025-11-13)

- (PR #928, 2025-10-29) Do not install `setuptools` using Make tasks
- (PR #929, 2025-10-29) Installing Pip version 24 in GitHub Actions fails when default's 25
- (PR #907, 2025-10-29) chore(deps): Bump lxml from 5.4.0 to 6.0.2
- (PR #934, 2025-11-03) chore(deps): Bump typing-extensions from 4.14.0 to 4.15.0
- (PR #935, 2025-11-11) chore(deps): Bump django from 4.2.25 to 4.2.26
- (PR #933, 2025-11-13) chore(deps): Bump pip-tools from 7.4.1 to 7.5.1
- (PR #938, 2025-11-13) deps: Bump pip-tools from 7.5.1 to 7.5.2
- (PR #917, 2025-11-13) chore(deps): Bump pip from 24.2 to 25.3
- (PR #937, 2025-11-13) rcv: Refactor grouping logic for RCV parsing

## 0.62.0 (2025-10-29)

- (PR #924, 2025-10-29) deps: Update `keyring` from 21.4.0 to 25.6.0
Expand Down
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ PYTHON_PIP_VERSION_SPECIFIER = $(shell \
grep -E '^pip==.+' --no-filename --only-matching --no-messages -- requirements{,-dev}.{txt,in} \
| head -n 1 | sed 's/^pip//' \
)
PYTHON_SETUPTOOLS_VERSION_SPECIFIER = $(shell \
grep -E '^setuptools==.+' --no-filename --only-matching --no-messages -- requirements{,-dev}.{txt,in} \
| head -n 1 | sed 's/^setuptools//' \
)
PYTHON_VIRTUALENV_DIR = venv
PYTHON_PIP_TOOLS_VERSION_SPECIFIER = $(shell \
grep -E '^pip-tools==.+' --no-filename --only-matching --no-messages -- requirements{,-dev}.{txt,in} \
Expand All @@ -37,7 +33,7 @@ TOXENV ?= py310
.PHONY: build dist deploy upload-release
.PHONE: python-virtualenv
.PHONY: python-deps-compile python-deps-sync-check python-pip-tools-install
.PHONY: python-pip-install python-setuptools-install
.PHONY: python-pip-install

help:
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | sort | awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
Expand Down Expand Up @@ -69,7 +65,7 @@ install-dev: ## Install for development
python -m pip install --editable .
python -m pip check

install-deps-dev: python-pip-install python-setuptools-install
install-deps-dev: python-pip-install
install-deps-dev: python-pip-tools-install
install-deps-dev: ## Install dependencies for development
python -m pip install -r requirements.txt
Expand Down Expand Up @@ -137,9 +133,6 @@ python-virtualenv: ## Create virtual Python environment
python-pip-install: ## Install Pip
$(PYTHON_PIP) install 'pip$(PYTHON_PIP_VERSION_SPECIFIER)'

python-setuptools-install: ## Install Setuptools
$(PYTHON_PIP) install 'setuptools$(PYTHON_SETUPTOOLS_VERSION_SPECIFIER)'

python-deps-compile: $(patsubst %,python-deps-compile-%,$(PYTHON_PIP_TOOLS_SRC_FILES))
python-deps-compile: ## Compile Python dependency manifests

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = [
"cryptography>=43.0.0",
"defusedxml>=0.6.0,<1",
"jsonschema>=3.1.1",
"lxml>=5.2.1,<6",
"lxml>=5.2.1,<7",
"marshmallow>=3,<5",
"pydantic>=2.10.0,!=1.7.*,!=1.8.*,!=1.9.*",
"pyOpenSSL>=24.0.0",
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ coverage==7.10.7
flake8==7.3.0
isort==6.0.1
mypy==1.18.2
pip-tools==7.4.1
pip-tools==7.5.2
tox==4.27.0
twine==6.2.0
types-jsonschema==4.25.0.20250809
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pathspec==0.9.0
# via
# black
# mypy
pip-tools==7.4.1
pip-tools==7.5.2
# via -r requirements-dev.in
platformdirs==4.3.6
# via
Expand Down Expand Up @@ -190,7 +190,7 @@ types-pytz==2025.2.0.20250809
# via -r requirements-dev.in
types-setuptools==80.9.0.20250809
# via -r requirements-dev.in
typing-extensions==4.14.0
typing-extensions==4.15.0
# via
# -c requirements.txt
# beautifulsoup4
Expand All @@ -214,7 +214,7 @@ zipp==3.20.2
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
pip==24.2
pip==25.3
# via pip-tools
setuptools==80.9.0
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Django>=4.2
djangorestframework>=3.10.3,<3.17
importlib-metadata==8.7.0
jsonschema==4.25.0
lxml==5.4.0
lxml==6.0.2
marshmallow==4.0.1
pydantic==2.11.7
pyOpenSSL==25.1.0
pytz==2025.2
setuptools==80.9.0
signxml==4.2.0
typing-extensions==4.14.0
typing-extensions==4.15.0
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cryptography==45.0.7
# signxml
defusedxml==0.7.1
# via -r requirements.in
django==4.2.25
django==4.2.26
# via
# -r requirements.in
# django-filter
Expand All @@ -40,7 +40,7 @@ jsonschema==4.25.0
# via -r requirements.in
jsonschema-specifications==2023.12.1
# via jsonschema
lxml==5.4.0
lxml==6.0.2
# via
# -r requirements.in
# signxml
Expand Down Expand Up @@ -68,7 +68,7 @@ signxml==4.2.0
# via -r requirements.in
sqlparse==0.5.0
# via django
typing-extensions==4.14.0
typing-extensions==4.15.0
# via
# -r requirements.in
# asgiref
Expand Down
2 changes: 1 addition & 1 deletion src/cl_sii/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

"""

__version__ = '0.62.0'
__version__ = '0.63.0'
38 changes: 24 additions & 14 deletions src/cl_sii/rcv/parse_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1590,20 +1590,22 @@ def _parse_rcv_csv_file(
expected_field_names=expected_input_field_names,
)

# Group rows by folio and handle "Otros Impuestos" logic
folio_groups: MutableMapping[str, Any] = {}
# Group rows by 'folio + tipo docto + rut' to handle "Otros Impuestos" logic
entry_key_groups: MutableMapping[str, Any] = {}

# Otros Impuestos field names
# Field names differ slightly between RCV Venta and RCV Compra
if isinstance(input_csv_row_schema, RcvVentaCsvRowSchema):
codigo_otro_impuesto_key = "Codigo Otro Imp."
valor_otro_impuesto_key = "Valor Otro Imp."
tasa_otro_impuesto_key = "Tasa Otro Imp."
rut_key = "Rut cliente"
else:
codigo_otro_impuesto_key = "Codigo Otro Impuesto"
valor_otro_impuesto_key = "Valor Otro Impuesto"
tasa_otro_impuesto_key = "Tasa Otro Impuesto"
rut_key = "Rut Proveedor"

# First pass: collect all rows and group by folio
# First pass: collect all rows and group by folio + tipo docto + rut
for row_ix, row_data in enumerate(csv_reader, start=1):
if max_n_rows is not None and row_ix > max_n_rows + n_rows_offset:
raise rows_processing.MaxRowsExceeded(f"Exceeded 'max_n_rows' limit: {max_n_rows}.")
Expand All @@ -1615,13 +1617,17 @@ def _parse_rcv_csv_file(
row_data.pop(_field_name, None)

folio = str(row_data.get('Folio')) if row_data.get('Folio') is not None else ''
tipo_docto = row_data.get('Tipo Doc')
rut = row_data.get(rut_key)

# If both fields are None, it's an "otros impuestos" row
# Concatenate folio, tipo_docto, and rut to create unique entry key
entry_key = f"{folio}_{tipo_docto}_{rut}"

# If Nro, Fecha Recepcion, and Monto Total are all None or empty,
# it's an "otros impuestos" row
is_main = not (
(
row_data.get("Nro") in (None, "")
and row_data.get("Fecha Recepcion") in (None, "")
)
row_data.get("Nro") in (None, "")
and row_data.get("Fecha Recepcion") in (None, "")
and (row_data.get("Monto Total") in (None, ""))
)
otros_impuestos_data = {
Expand All @@ -1642,17 +1648,21 @@ def _parse_rcv_csv_file(
),
}

if folio not in folio_groups:
folio_groups[folio] = {
if entry_key not in entry_key_groups:
entry_key_groups[entry_key] = {
'row': (row_ix, row_data),
'otros_impuestos': [otros_impuestos_data],
}
if not is_main and folio in folio_groups:
elif is_main:
# Update main row if this is a main entry
entry_key_groups[entry_key]['row'] = (row_ix, row_data)
entry_key_groups[entry_key]['otros_impuestos'].insert(0, otros_impuestos_data)
elif not is_main:
if any(otros_impuestos_data.values()):
folio_groups[folio]['otros_impuestos'].append(otros_impuestos_data)
entry_key_groups[entry_key]['otros_impuestos'].append(otros_impuestos_data)

# Second pass: yield grouped rows
for folio, group in folio_groups.items():
for folio, group in entry_key_groups.items():
if group['row']:
row_ix, row_data = group['row']
row_data['Otros Impuestos'] = group['otros_impuestos']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ Nro;Tipo Doc;Tipo Venta;Rut cliente;Razon Social;Folio;Fecha Docto;Fecha Recepci
;33;Del Giro;54213736-3;CHILE SPA;6541;01/09/2025;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;271;701395;18;;;;;;
2;33;Del Giro;42509414-9;COMERCIAL SPA;9874;01/09/2025;01/09/2025 09:53:17;;;0;8879040;1687018;13136156;0;0;0;0;0;-;0;0;0;0;0;;;;0;;0;2;0;0;0;;;;12354;;24;2570098;31.5
3;33;Del Giro;68840666-8;TEXAS SPA;3210;01/09/2025;01/09/2025 10:58:51;08/09/2025 14:15:23;;0;20522880;3899347;30471437;0;0;0;0;0;-;0;0;0;0;0;;;;0;;0;2;0;0;0;;;;12354;;24;6049210;31.5;
4;34;Del Giro;68840666-8;TEXAS SPA;3210;01/09/2025;01/09/2025 10:58:51;08/09/2025 14:15:23;;0;9999;3899347;30471437;0;0;0;0;0;-;0;0;0;0;0;;;;0;;0;2;0;0;0;;;;12354;;24;6049210;31.5;
5;33;Del Giro;54213736-3;THE COMPANY SPA;3210;01/09/2025;01/09/2025 10:58:51;08/09/2025 14:15:23;;0;9999;3899347;30471437;0;0;0;0;0;-;0;0;0;0;0;;;;0;;0;2;0;0;0;;;;12354;;24;6049210;31.5;
;33;Del Giro;54213736-3;THE COMPANY SPA;3210;01/09/2025;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;271;701395;18;;;;;;
Loading
Loading