PG patches: ajout #4 repost_item_valuation + #5 general_ledger validate_against_pcv (Period Closing GROUP BY)
5 patchs MySQLisme désormais cuits dans l'image erpnext-custom via Dockerfile (COPY+RUN apply_pg_patches.py). Débloque submit stock/compta sur PostgreSQL (vérifié: Stock Reconciliation submit OK sur conteneur frais). frappe_pg aussi proprement bake + ajouté à apps.txt (shim chargé eager pour toutes requêtes, token inclus). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
536bd2dfa8
commit
aad579d8bb
|
|
@ -21,10 +21,9 @@ Patchs inclus :
|
|||
1. utilities/product.py — `ORDER BY NULL` retiré (validation de variante)
|
||||
2. stock/.../item.py — get_timeline_data : CurDate() → add_to_date (heatmap fiche Item)
|
||||
3. frappe_pg query_transformers — CURRENT_DATE()/CURDATE() → CURRENT_DATE (filet général)
|
||||
|
||||
À FAIRE (non encore résolu) :
|
||||
- Period Closing Voucher : requête GROUP BY/ORDER BY creation invalide en PG
|
||||
(GroupingError) qui bloque le submit des transactions de stock/compta. À localiser.
|
||||
4. repost_item_valuation.py — get_max_period_closing_date : qb Max + ORDER BY creation → get_value(order_by=None)
|
||||
5. accounts/general_ledger.py — validate_against_pcv : get_value agrégat MAX + ORDER BY creation
|
||||
→ order_by=None. DÉBLOQUE le submit des transactions stock/compta (GroupingError PG).
|
||||
"""
|
||||
import re
|
||||
|
||||
|
|
@ -82,4 +81,25 @@ patch_file(
|
|||
lambda s: MARK in s,
|
||||
)
|
||||
|
||||
# 4) repost_item_valuation — get_max_period_closing_date : qb Max(...) + ORDER BY creation
|
||||
# (GroupingError PG) → get_value(..., order_by=None)
|
||||
patch_file(
|
||||
f"{BENCH}/erpnext/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py",
|
||||
lambda s: re.sub(
|
||||
r'table = frappe\.qb\.DocType\("Period Closing Voucher"\).*?return query\[0\]\[0\] if query and query\[0\]\[0\] else None',
|
||||
'return frappe.db.get_value("Period Closing Voucher", {"company": company, "docstatus": 1}, "max(period_end_date)", order_by=None)',
|
||||
s, count=1, flags=re.DOTALL),
|
||||
lambda s: 'max(period_end_date)", order_by=None' in s,
|
||||
)
|
||||
|
||||
# 5) general_ledger — validate_against_pcv : get_value avec agrégat MAX + ORDER BY creation par
|
||||
# défaut (GroupingError PG) → ajout order_by=None. C'est CE patch qui débloque le submit stock/compta.
|
||||
patch_file(
|
||||
f"{BENCH}/erpnext/erpnext/accounts/general_ledger.py",
|
||||
lambda s: s.replace(
|
||||
'{"docstatus": 1, "company": company}, [{"MAX": "period_end_date"}]',
|
||||
'{"docstatus": 1, "company": company}, [{"MAX": "period_end_date"}], order_by=None', 1),
|
||||
lambda s: '[{"MAX": "period_end_date"}], order_by=None' in s,
|
||||
)
|
||||
|
||||
print("DONE — redémarrer le conteneur pour recharger les workers.")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user