This commit is contained in:
Christian Anetzberger
2022-01-19 16:24:13 +01:00
parent 182cf5aeef
commit 884cca1159
6 changed files with 23 additions and 4 deletions

View File

@@ -1,7 +1,26 @@
import frappe import frappe
from frappe.utils.print_format import print_by_server
import json
@frappe.whitelist() @frappe.whitelist()
def create_labels(values): def create_labels(values):
values = json.loads(values)
print(values) print(values)
print(values["item_code"])
doc = frappe.new_doc('Label')
doc.item_code = values["item_code"]
doc.item_name = values["item_name"]
res = doc.insert(ignore_permissions=True, # ignore write permissions during insert
ignore_links=True, # ignore Link validation in the document
ignore_if_duplicate=True, # dont insert if DuplicateEntryError is thrown
ignore_mandatory=True # insert even if mandatory fields are not set
)
print(res)
# print_by_server("Label", "Label-00001", "labelprinter", "Labels")
return 200 return 200

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2022, CAnetzberger Design and contributors // Copyright (c) 2022, CAnetzberger Design and contributors
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Labels', { frappe.ui.form.on('Label', {
// refresh: function(frm) { // refresh: function(frm) {
// } // }

View File

@@ -61,7 +61,7 @@
"modified": "2022-01-19 12:08:40.613669", "modified": "2022-01-19 12:08:40.613669",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Label Printing", "module": "Label Printing",
"name": "Labels", "name": "Label",
"name_case": "UPPER CASE", "name_case": "UPPER CASE",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [

View File

@@ -4,5 +4,5 @@
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class Labels(Document): class Label(Document):
pass pass

View File

@@ -4,5 +4,5 @@
# import frappe # import frappe
import unittest import unittest
class TestLabels(unittest.TestCase): class TestLabel(unittest.TestCase):
pass pass