Patch optimization (#13060)
* Patch fixes * fix codacy * Update item_barcode_childtable_migrate.py
This commit is contained in:
parent
1a9388acbb
commit
97b212e348
@ -7,16 +7,20 @@ import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
items_barcode = frappe.db.sql("""SELECT name, barcode FROM tabItem
|
||||
WHERE barcode IS NOT NULL and barcode != ''""", as_dict=1)
|
||||
items_barcode = frappe.get_list('Item', ['name', 'barcode'], { 'barcode': ('!=', '') })
|
||||
|
||||
frappe.reload_doc("stock", "doctype", "item")
|
||||
frappe.reload_doc("stock", "doctype", "item_barcode")
|
||||
|
||||
for item in items_barcode:
|
||||
doc = frappe.get_doc("Item", item.get("name"))
|
||||
if item.get("barcode"):
|
||||
doc.append("barcodes", {"barcode": item.get("barcode")})
|
||||
doc.flags.ignore_validate = True
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save()
|
||||
barcode = item.barcode.strip()
|
||||
|
||||
if barcode and '<' not in barcode:
|
||||
frappe.get_doc({
|
||||
'idx': 0,
|
||||
'doctype': 'Item Barcode',
|
||||
'barcode': barcode,
|
||||
'parenttype': 'Item',
|
||||
'parent': item.name,
|
||||
'parentfield': 'barcodes'
|
||||
}).insert()
|
||||
|
@ -12,6 +12,7 @@ def execute():
|
||||
if not po_item:
|
||||
return
|
||||
|
||||
frappe.reload_doc("stock", "doctype", "bin")
|
||||
frappe.reload_doc("buying", "doctype", "purchase_order_item_supplied")
|
||||
company_warehouse = frappe._dict(frappe.db.sql("""select company, min(name) from `tabWarehouse`
|
||||
where is_group = 0 group by company"""))
|
||||
|
Loading…
x
Reference in New Issue
Block a user