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