fix: convert default_item_manufacturer to link field (#30835)

This commit is contained in:
Ankush Menat
2022-05-02 13:58:22 +05:30
committed by GitHub
parent bdd55f07f4
commit dcda55641b
3 changed files with 21 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
import frappe
def execute():
# Erase all default item manufacturers that dont exist.
item = frappe.qb.DocType("Item")
manufacturer = frappe.qb.DocType("Manufacturer")
(
frappe.qb.update(item)
.set(item.default_item_manufacturer, None)
.left_join(manufacturer)
.on(item.default_item_manufacturer == manufacturer.name)
.where(manufacturer.name.isnull() & item.default_item_manufacturer.isnotnull())
).run()