I have created a custom html form in pages directory.How to submit custom generated html form to database.
example:
<form> <input type = "text" name='name'> </form>
1 Like
For custom page you need write python function to make records and call the method using frappe.call function. For reference check below files
print_document: function (html) {
var w = window.open();
w.document.write(html);
w.document.close();
setTimeout(function () {
w.print();
w.close();
}, 1000)
},
submit_invoice: function () {
var me = this;
this.change_status();
this.update_serial_no()
if (this.frm.doc.docstatus == 1) {
this.print_dialog()
}
def get_barcode_data(items_list):
# get itemwise batch no data
# exmaple: {'LED-GRE': [Batch001, Batch002]}
# where LED-GRE is item code, SN0001 is serial no and Pune is warehouse
itemwise_barcode = {}
for item in items_list:
barcodes = frappe.db.sql("""
select barcode from `tabItem Barcode` where parent = %s
""", item.item_code, as_dict=1)
for barcode in barcodes:
if item.item_code not in itemwise_barcode:
itemwise_barcode.setdefault(item.item_code, [])
itemwise_barcode[item.item_code].append(barcode.get("barcode"))
return itemwise_barcode
def get_item_tax_data():
This file has been truncated. show original
You can also create custom doctype,
https://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-doctype
2 Likes
@rohit_w
if i want add 50 data from my form should i add 50 item in args of frappe.call function.Or is there any better way.
thanks
Yes you need to prepare the json for the 50 items and has to pass to the frappe.call