ci: allow shallow fetch when fast-forwarding the cached bench (#58666)

This commit is contained in:
Mihir Kandoi
2026-09-02 11:20:21 +05:30
committed by GitHub
parent 56a391c522
commit 0230879501
2 changed files with 6 additions and 15 deletions

View File

@@ -188,7 +188,7 @@ restore_warm_bench() {
# Phase 1 already fetched ~/frappe to the exact live develop SHA. Fetch that commit
# straight from it (bench init names the remote 'upstream', not 'origin', and points
# it at this local clone — so a plain `git fetch origin` does not work).
git fetch --no-tags "$HOME/frappe" HEAD || exit 1
git fetch --no-tags --update-shallow "$HOME/frappe" HEAD || exit 1
git checkout --force FETCH_HEAD || exit 1
); then
echo "Fast-forward to ${frappe_sha} failed; falling back to full init"

View File

@@ -4,7 +4,6 @@ import frappe
from frappe import _, bold
from frappe.query_builder import Case
from frappe.utils import flt, get_link_to_form
from pypika.terms import ValueWrapper
from erpnext.stock.serial_batch_bundle import get_serial_batch_list_from_item
@@ -509,21 +508,13 @@ class SubcontractingInwardController:
)
table = frappe.qb.DocType("Subcontracting Inward Order Item")
allowed_qty = table.produced_qty
if not allow_delivery_of_overproduced_qty:
allowed_qty = Case().when(table.produced_qty < table.qty, table.produced_qty).else_(table.qty)
query = (
frappe.qb.from_(table)
.select(
(
Case()
.when(
# bool() so the literal renders as true/false; postgres rejects `OR <integer>`
(table.produced_qty < table.qty)
| ValueWrapper(bool(allow_delivery_of_overproduced_qty)),
table.produced_qty,
)
.else_(table.qty)
- table.delivered_qty
).as_("max_allowed_qty")
)
.select((allowed_qty - table.delivered_qty).as_("max_allowed_qty"))
.where((table.name == item.scio_detail) & (table.docstatus == 1))
)
max_allowed_qty = query.run(pluck="max_allowed_qty")