forked from frappe/erpnext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: convert default_item_manufacturer to link field (frappe#30835) (f…
…rappe#30866) (cherry picked from commit dcda556) Co-authored-by: Ankush Menat <ankush@frappe.io>
- Loading branch information
1 parent
7c0069c
commit 37fad7e
Showing
3 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
erpnext/patches/v13_0/change_default_item_manufacturer_fieldtype.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters