From a4ce7596992a87faa45a0b7a2ef6b02b61871d77 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 16 Jan 2024 09:27:11 +0530 Subject: [PATCH] fix: create portal user for customer from shopping cart --- .github/helper/install.sh | 10 ++++------ ...{site_config.json => site_config_mariadb.json} | 2 +- .github/workflows/ci.yml | 15 ++++++++------- webshop/setup/install.py | 2 +- webshop/webshop/shopping_cart/cart.py | 2 ++ 5 files changed, 16 insertions(+), 15 deletions(-) rename .github/helper/{site_config.json => site_config_mariadb.json} (99%) diff --git a/.github/helper/install.sh b/.github/helper/install.sh index 557cbac2ab..e648669b02 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -14,7 +14,7 @@ git clone https://github.com/frappe/frappe --branch "$BRANCH_TO_CLONE" --depth 1 bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench mkdir ~/frappe-bench/sites/test_site -cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config.json" ~/frappe-bench/sites/test_site/ +cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config_mariadb.json" ~/frappe-bench/sites/test_site/ 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'" @@ -42,13 +42,11 @@ sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile bench get-app payments --branch ${BRANCH_TO_CLONE%"-hotfix"} bench get-app https://github.com/frappe/erpnext --branch "$BRANCH_TO_CLONE" --resolve-deps +bench get-app webshop "${GITHUB_WORKSPACE}" bench setup requirements --dev -bench start &> bench_run_logs.txt & +bench start &>> ~/frappe-bench/bench_start.log & CI=Yes bench build --app frappe & bench --site test_site reinstall --yes -bench get-app webshop "${GITHUB_WORKSPACE}" -bench --site test_site install-app webshop -bench --site test_site set-config allow_tests true -bench setup requirements --dev \ No newline at end of file +bench --verbose --site test_site install-app webshop \ No newline at end of file diff --git a/.github/helper/site_config.json b/.github/helper/site_config_mariadb.json similarity index 99% rename from .github/helper/site_config.json rename to .github/helper/site_config_mariadb.json index 21fdbf31c8..ff763b82e1 100644 --- a/.github/helper/site_config.json +++ b/.github/helper/site_config_mariadb.json @@ -13,4 +13,4 @@ "host_name": "http://test_site:8000", "install_apps": ["payments", "erpnext"], "throttle_user_limit": 100 -} \ No newline at end of file + } \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88e3623897..18bbe9ed4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: # Run everday at midnight UTC / 5:30 IST - cron: "0 0 * * *" env: - _BRANCH: ${{ github.base_ref || github.ref_name }} + WEBSHOP_BRANCH: ${{ github.base_ref || github.ref_name }} concurrency: group: develop-${{ github.event.number }} @@ -49,7 +49,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v2 with: - node-version: 18 + node-version: 20 check-latest: true - name: Add to Hosts @@ -91,17 +91,18 @@ jobs: run: | bash ${GITHUB_WORKSPACE}/.github/helper/install.sh env: - BRANCH_TO_CLONE: ${{ env._BRANCH }} + BRANCH_TO_CLONE: ${{ env.WEBSHOP_BRANCH }} - name: Run Tests run: cd ~/frappe-bench/ && bench --site test_site run-tests --app webshop --coverage env: TYPE: server + CI_BUILD_ID: ${{ github.run_id }} + ORCHESTRATOR_URL: http://test-orchestrator.frappe.io - name: Upload coverage data - uses: codecov/codecov-action@v2 + uses: actions/upload-artifact@v3 with: - fail_ci_if_error: true - files: /home/runner/frappe-bench/sites/coverage.xml - verbose: true \ No newline at end of file + name: coverage-${{ matrix.container }} + path: /home/runner/frappe-bench/sites/coverage.xml \ No newline at end of file diff --git a/webshop/setup/install.py b/webshop/setup/install.py index 825ca40497..06b251291a 100644 --- a/webshop/setup/install.py +++ b/webshop/setup/install.py @@ -233,7 +233,7 @@ def run_patches(): try: for patch in patches: - frappe.get_attr(f"webshop.patches.after_install.{patch}.execute")() + frappe.get_attr(f"webshop.patches.{patch}.execute")() finally: frappe.flags.in_patch = False diff --git a/webshop/webshop/shopping_cart/cart.py b/webshop/webshop/shopping_cart/cart.py index 3196c9698a..109d1a40f3 100644 --- a/webshop/webshop/shopping_cart/cart.py +++ b/webshop/webshop/shopping_cart/cart.py @@ -573,6 +573,8 @@ def get_party(user=None): } ) + customer.append("portal_users", {"user": user}) + if debtors_account: customer.update( {