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
1 change: 0 additions & 1 deletion .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/server-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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",
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
{
Expand Down
Loading