Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 18 additions & 21 deletions .github/workflows/ci.yml → .github/workflows/ci-v15.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
name: CI
name: CI (v15)

on:
push:
branches:
- develop
- version-15
pull_request:

concurrency:
group: develop-edocument_integration-${{ github.event.number }}
group: v15-edocument_integration-${{ github.event.number }}
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Server
name: Server (Frappe v15, Python 3.10)

services:
redis-cache:
Expand All @@ -33,17 +32,12 @@ jobs:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
options: --health-cmd="mariadb-admin ping -u root -proot" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Clone
uses: actions/checkout@v3

- name: Find tests
run: |
echo "Finding tests"
grep -rn "def test" > /dev/null

- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -76,34 +70,37 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-

- name: Install MariaDB Client
- name: Install System Dependencies
run: |
sudo apt update
sudo apt-get install mariadb-client
sudo apt-get install mariadb-client libxml2-dev libxslt-dev

- name: Setup
run: |
pip install frappe-bench
bench init --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
bench init --skip-redis-config-generation --skip-assets --frappe-branch version-15 --python "$(which python)" ~/frappe-bench
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"

- name: Install
working-directory: /home/runner/frappe-bench
run: |
bench get-app erpnext --branch version-15
bench get-app edocument --branch version-15 https://github.com/prilk-consulting/edocument.git
bench get-app edocument_integration $GITHUB_WORKSPACE
bench setup requirements --dev
bench new-site --db-root-password root --admin-password admin test_site
bench --site test_site install-app erpnext
bench --site test_site install-app edocument
bench --site test_site install-app edocument_integration
bench build
env:
CI: 'Yes'

- name: Run Tests
working-directory: /home/runner/frappe-bench
run: |
bench --site test_site set-config allow_tests true
bench --site test_site run-tests --app edocument_integration
env:
TYPE: server

# - name: Run Tests
# working-directory: /home/runner/frappe-bench
# run: |
# bench --site test_site set-config allow_tests true
# bench --site test_site run-tests --app edocument_integration
# env:
# TYPE: server
107 changes: 107 additions & 0 deletions .github/workflows/ci-v16.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI (v16)

on:
push:
branches:
- develop
pull_request:

concurrency:
group: develop-edocument_integration-${{ github.event.number }}
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Server (Frappe v16, Python 3.14)

services:
redis-cache:
image: redis:alpine
ports:
- 13000:6379
redis-queue:
image: redis:alpine
ports:
- 11000:6379
mariadb:
image: mariadb:10.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mariadb-admin ping -u root -proot" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Clone
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.14'
allow-prereleases: true

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
check-latest: true

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'

- uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install System Dependencies
run: |
sudo apt update
sudo apt-get install mariadb-client libxml2-dev libxslt-dev

- name: Setup
run: |
pip install frappe-bench
bench init --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"

- name: Install
working-directory: /home/runner/frappe-bench
run: |
bench get-app erpnext
bench get-app edocument https://github.com/prilk-consulting/edocument.git
bench get-app edocument_integration $GITHUB_WORKSPACE
bench setup requirements --dev
bench new-site --db-root-password root --admin-password admin test_site
bench --site test_site install-app erpnext
bench --site test_site install-app edocument
bench --site test_site install-app edocument_integration
bench build
env:
CI: 'Yes'

# - name: Run Tests
# working-directory: /home/runner/frappe-bench
# run: |
# bench --site test_site set-config allow_tests true
# bench --site test_site run-tests --app edocument_integration
# env:
# TYPE: server
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
cache: pip
- uses: pre-commit/action@v3.0.0

Expand All @@ -39,7 +39,7 @@ jobs:
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'

- uses: actions/checkout@v4

Expand Down
35 changes: 17 additions & 18 deletions edocument_integration/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ def get_edocument_integration_settings(profile, company=None):
if company:
filters["company"] = company

settings = frappe.get_all(
"EDocument Integration Settings",
filters=filters,
fields=[
"api_key",
"api_secret",
"base_url",
"edocument_integrator",
"company",
"account_id",
"company_id",
],
)

if settings:
return settings[0]
docs = frappe.get_list("EDocument Integration Settings", filters=filters, limit_page_length=1)

if docs:
# Get full document to decrypt password field
settings_doc = frappe.get_doc("EDocument Integration Settings", docs[0].name)
return {
"api_key": settings_doc.api_key,
"api_secret": settings_doc.get_password("api_secret"), # Decrypt password field
"base_url": settings_doc.base_url,
"edocument_integrator": settings_doc.edocument_integrator,
"company": settings_doc.company,
"account_id": settings_doc.account_id,
"company_id": settings_doc.company_id,
}

return None


Expand Down Expand Up @@ -96,11 +95,11 @@ def transmit_edocument(edocument_name):
parts.append(f"• Recipient: {transmission_result.get('recipient')}")
edocument_doc.add_comment(comment_type="Info", text="\n".join(parts))

# Set status to Transmission Successful
# Set status to Transmission Successful and store reference ID
frappe.db.set_value(
"EDocument",
edocument_name,
{"status": "Transmission Successful", "error": None},
{"status": "Transmission Successful", "error": None, "reference": transmission_id},
update_modified=False,
)
frappe.db.commit()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2025-11-12 00:00:00.000000",
"creation": "2025-11-12 00:00:00",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
Expand Down Expand Up @@ -45,7 +45,7 @@
},
{
"fieldname": "api_secret",
"fieldtype": "Data",
"fieldtype": "Password",
"label": "API Secret"
},
{
Expand All @@ -62,7 +62,7 @@
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-11-12 00:00:00.000000",
"modified": "2025-12-15 20:30:05.754776",
"modified_by": "Administrator",
"module": "EDocument Integration",
"name": "EDocument Integration Settings",
Expand All @@ -86,4 +86,3 @@
"sort_order": "DESC",
"states": []
}

Loading