Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert default_item_manufacturer to link field #30835

Merged
merged 1 commit into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,6 @@ erpnext.patches.v13_0.remove_unknown_links_to_prod_plan_items # 24-03-2022
erpnext.patches.v13_0.update_expense_claim_status_for_paid_advances
erpnext.patches.v13_0.create_gst_custom_fields_in_quotation
erpnext.patches.v13_0.copy_custom_field_filters_to_website_item
erpnext.patches.v13_0.change_default_item_manufacturer_fieldtype
erpnext.patches.v14_0.discount_accounting_separation
erpnext.patches.v14_0.delete_employee_transfer_property_doctype
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()
7 changes: 4 additions & 3 deletions erpnext/stock/doctype/item/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,9 @@
},
{
"fieldname": "default_item_manufacturer",
"fieldtype": "Data",
"fieldtype": "Link",
"label": "Default Item Manufacturer",
"options": "Manufacturer",
"read_only": 1
},
{
Expand Down Expand Up @@ -918,7 +919,7 @@
"image_field": "image",
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-03-25 06:38:55.942304",
"modified": "2022-04-28 04:52:10.272256",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
Expand Down Expand Up @@ -991,4 +992,4 @@
"states": [],
"title_field": "item_name",
"track_changes": 1
}
}