fix: default supplier was not set from the patch in item defaults for multi company instance (#18178)
This commit is contained in:
parent
334335a2ef
commit
d86f027ce0
@ -615,5 +615,6 @@ erpnext.patches.v11_1.set_missing_opportunity_from
|
|||||||
erpnext.patches.v12_0.set_quotation_status
|
erpnext.patches.v12_0.set_quotation_status
|
||||||
erpnext.patches.v12_0.set_priority_for_support
|
erpnext.patches.v12_0.set_priority_for_support
|
||||||
erpnext.patches.v12_0.delete_priority_property_setter
|
erpnext.patches.v12_0.delete_priority_property_setter
|
||||||
|
erpnext.patches.v11_1.update_default_supplier_in_item_defaults
|
||||||
erpnext.patches.v12_0.update_due_date_in_gle
|
erpnext.patches.v12_0.update_due_date_in_gle
|
||||||
erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
|
erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright (c) 2018, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
'''
|
||||||
|
default supplier was not set in the item defaults for multi company instance,
|
||||||
|
this patch will set the default supplier
|
||||||
|
|
||||||
|
'''
|
||||||
|
if not frappe.db.has_column('Item', 'default_supplier'):
|
||||||
|
return
|
||||||
|
|
||||||
|
frappe.reload_doc('stock', 'doctype', 'item_default')
|
||||||
|
frappe.reload_doc('stock', 'doctype', 'item')
|
||||||
|
|
||||||
|
companies = frappe.get_all("Company")
|
||||||
|
if len(companies) > 1:
|
||||||
|
frappe.db.sql(""" UPDATE `tabItem Default`, `tabItem`
|
||||||
|
SET `tabItem Default`.default_supplier = `tabItem`.default_supplier
|
||||||
|
WHERE
|
||||||
|
`tabItem Default`.parent = `tabItem`.name and `tabItem Default`.default_supplier is null
|
||||||
|
and `tabItem`.default_supplier is not null and `tabItem`.default_supplier != '' """)
|
Loading…
x
Reference in New Issue
Block a user