From 995bde7be03ae42ecc5d0b2258416398015628cd Mon Sep 17 00:00:00 2001 From: HenningWendtland <156231187+HenningWendtland@users.noreply.github.com> Date: Fri, 30 Jan 2026 11:26:37 +0100 Subject: [PATCH 1/4] fix: fetch correct price list when creating SI --- .../simple_subscription.py | 25 +++++++++++++++++++ .../simple_subscription_item.py | 18 +------------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/simple_subscription/simple_subscription/doctype/simple_subscription/simple_subscription.py b/simple_subscription/simple_subscription/doctype/simple_subscription/simple_subscription.py index 91ca491..93a2a30 100644 --- a/simple_subscription/simple_subscription/doctype/simple_subscription/simple_subscription.py +++ b/simple_subscription/simple_subscription/doctype/simple_subscription/simple_subscription.py @@ -7,8 +7,10 @@ import frappe from dateutil.relativedelta import relativedelta from erpnext.accounts.doctype.sales_invoice.sales_invoice import SalesInvoice +from erpnext.accounts.party import get_party_details from frappe import _ from frappe.model.document import Document +from frappe.utils import today class Frequency(Enum): @@ -46,6 +48,7 @@ def create_invoice(self, from_date: date, to_date: date) -> SalesInvoice: invoice = frappe.new_doc("Sales Invoice") invoice.company = self.company invoice.customer = self.customer + invoice.selling_price_list = self.get_price_list() for row in self.items: invoice.append( "items", @@ -61,6 +64,28 @@ def create_invoice(self, from_date: date, to_date: date) -> SalesInvoice: invoice.set_missing_values() return invoice.insert() + def get_price_list(self) -> str | None: + currency = self.currency or frappe.get_cached_value("Company", self.company, "default_currency") + + party_details = get_party_details( + party=self.customer, + account=None, + party_type="Customer", + company=self.company, + posting_date=today(), + currency=currency, + doctype="Sales Invoice", + fetch_payment_terms_template=False, + ) + + price_list = ( + party_details.selling_price_list + or frappe.db.get_single_value("Selling Settings", "selling_price_list") + or frappe.db.get_value("Price List", {"selling": 1, "currency": currency, "enabled": 1}) + ) + + return price_list or None + @frappe.whitelist() def create_current_invoice(subscription_name: str, silent=False): diff --git a/simple_subscription/simple_subscription/doctype/simple_subscription_item/simple_subscription_item.py b/simple_subscription/simple_subscription/doctype/simple_subscription_item/simple_subscription_item.py index 8e7d273..ad28918 100644 --- a/simple_subscription/simple_subscription/doctype/simple_subscription_item/simple_subscription_item.py +++ b/simple_subscription/simple_subscription/doctype/simple_subscription_item/simple_subscription_item.py @@ -2,7 +2,6 @@ # For license information, please see license.txt import frappe -from erpnext.accounts.party import get_party_details from erpnext.stock.get_item_details import get_item_details from frappe.model.document import Document from frappe.utils import today @@ -14,22 +13,7 @@ def current_rate(self): parent = frappe.get_doc("Simple Subscription", self.parent) currency = parent.currency or frappe.get_cached_value("Company", parent.company, "default_currency") - party_details = get_party_details( - party=parent.customer, - account=None, - party_type="Customer", - company=parent.company, - posting_date=today(), - currency=currency, - doctype="Sales Invoice", - fetch_payment_terms_template=False, - ) - - price_list = ( - party_details.selling_price_list - or frappe.db.get_single_value("Selling Settings", "selling_price_list") - or frappe.db.get_value("Price List", {"selling": 1, "currency": currency, "enabled": 1}) - ) + price_list = parent.get_price_list() item_details = get_item_details( { From 2ec80a43bfc3354b8ad103e1a4e6b49fda0f0652 Mon Sep 17 00:00:00 2001 From: HenningWendtland <156231187+HenningWendtland@users.noreply.github.com> Date: Fri, 30 Jan 2026 15:53:00 +0100 Subject: [PATCH 2/4] ci: fix server-texts.yml --- .github/workflows/server-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/server-tests.yml b/.github/workflows/server-tests.yml index dd5ac1f..9dec141 100644 --- a/.github/workflows/server-tests.yml +++ b/.github/workflows/server-tests.yml @@ -26,10 +26,10 @@ jobs: mariadb: image: mariadb:11.8 env: - MYSQL_ROOT_PASSWORD: root + MARIADB_ROOT_PASSWORD: root ports: - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 + options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=5s --health-timeout=2s --health-retries=3 steps: - name: Clone From e4099c28a2c215ab95d5db2ae41ab69adab458b6 Mon Sep 17 00:00:00 2001 From: HenningWendtland <156231187+HenningWendtland@users.noreply.github.com> Date: Fri, 30 Jan 2026 16:01:13 +0100 Subject: [PATCH 3/4] ci: remove payments from install.sh --- .github/helper/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/helper/install.sh b/.github/helper/install.sh index 42d9828..7f2b6bb 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -27,7 +27,6 @@ sed -i 's/schedule:/# schedule:/g' Procfile sed -i 's/socketio:/# socketio:/g' Procfile sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile -bench get-app payments --branch version-16 bench get-app erpnext --branch version-16 bench get-app simple_subscription "${GITHUB_WORKSPACE}" From 62a3df874dff5bc85e3112756a9e51554511e2b1 Mon Sep 17 00:00:00 2001 From: HenningWendtland <156231187+HenningWendtland@users.noreply.github.com> Date: Fri, 30 Jan 2026 19:01:02 +0100 Subject: [PATCH 4/4] ci: fix eslint configuration --- .pre-commit-config.yaml | 11 +++++++++++ eslint.config.mjs | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e63cc6..8c1dd1f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,6 +33,17 @@ repos: - id: prettier types_or: [javascript, vue, scss] + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v9.39.1 + hooks: + - id: eslint + types_or: [javascript] + args: ["--quiet", "--config", "eslint.config.mjs"] + additional_dependencies: + - "eslint@9.17.0" + - "@eslint/js@9.17.0" + - "globals@15.14.0" + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook rev: v9.24.0 hooks: diff --git a/eslint.config.mjs b/eslint.config.mjs index d32ee6b..f9acb9e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,9 @@ -import globals from "globals"; -import js from "@eslint/js"; +import { createRequire } from "node:module"; + +const require = createRequire(import.meta.url); +// Use CJS resolver so pre-commit NODE_PATH is honored. +const globals = require("globals"); +const js = require("@eslint/js"); export default [ js.configs.recommended,