mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-20 03:47:11 +00:00
fix: refactor Asset Repair and Stock Entry linkage to resolve amendme… (#41919)
* fix: refactor Asset Repair and Stock Entry linkage to resolve amendment issues * chore: added missing patch to patches.txt * chore: fixing previous changes * chore: fixing minor issues * fix: code changes to enhance efficiency * chore: replaced frappe.qb with db.sql because of conflict * fix: minor changes
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import frappe
|
||||
from frappe.query_builder import DocType
|
||||
|
||||
|
||||
def execute():
|
||||
if frappe.db.has_column("Asset Repair", "stock_entry"):
|
||||
AssetRepair = DocType("Asset Repair")
|
||||
StockEntry = DocType("Stock Entry")
|
||||
|
||||
(
|
||||
frappe.qb.update(StockEntry)
|
||||
.join(AssetRepair)
|
||||
.on(StockEntry.name == AssetRepair.stock_entry)
|
||||
.set(StockEntry.asset_repair, AssetRepair.name)
|
||||
).run()
|
||||
@@ -0,0 +1,14 @@
|
||||
import frappe
|
||||
|
||||
|
||||
# not able to use frappe.qb because of this bug https://github.com/frappe/frappe/issues/20292
|
||||
def execute():
|
||||
if frappe.db.has_column("Asset Repair", "warehouse"):
|
||||
# nosemgrep
|
||||
frappe.db.sql(
|
||||
"""UPDATE `tabAsset Repair Consumed Item` ar_item
|
||||
JOIN `tabAsset Repair` ar
|
||||
ON ar.name = ar_item.parent
|
||||
SET ar_item.warehouse = ar.warehouse
|
||||
WHERE ifnull(ar.warehouse, '') != ''"""
|
||||
)
|
||||
Reference in New Issue
Block a user