2017-12-11 09:54:18 +01:00
|
|
|
# Copyright (c) 2017, Frappe and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import frappe
|
|
|
|
|
|
|
|
|
|
|
|
def execute():
|
2018-03-08 12:50:40 +07:00
|
|
|
items_barcode = frappe.get_all('Item', ['name', 'barcode'], { 'barcode': ('!=', '') })
|
2018-02-12 15:59:55 +05:30
|
|
|
|
|
|
|
frappe.reload_doc("stock", "doctype", "item")
|
|
|
|
frappe.reload_doc("stock", "doctype", "item_barcode")
|
|
|
|
|
|
|
|
for item in items_barcode:
|
2018-02-23 16:19:41 +05:30
|
|
|
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()
|