async function timer (seconds) {
return new Promise(resolve => setTimeout(resolve, seconds * 1000))
}
// Usage
...
await timer(0.5)
...
Hack to use Tabulator http://tabulator.info datagrid to display data inside frappe script reports. Check the several advanced features in Tabulator http://tabulator.info/docs/4.9.
- Hide frappe datatable by hiding the .report-wrapper div
- Hide the message div, which displays 'No Data to Show' and other messages
- Instantiate Tabulator in onload, monkey patch query_report's refresh method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
import frappe | |
from frappe import _ | |
from frappe.utils import getdate | |
import json | |
def execute(filters=None): | |
priority_map = {"High": 3, "Medium": 2, "Low": 1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frappe.provide("frappe.views"); | |
frappe.ui.form.on("Tab Report", { | |
onload: function (frm) { | |
if (!frm.is_new()) { | |
frm.tab_report = new frappe.views.TabReport({ frm: frm }); | |
frm.tab_report.show(); | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prepare_report_data(data) { | |
this.data = data; | |
// prepare columns | |
this.data.columns.forEach((t) => { | |
t.title = t.label; | |
t.field = t.fieldname; | |
}); | |
// set column cell formatter for known fieldtypes, if not provided already in report_settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2021, Vijay and contributors | |
// For license information, please see license.txt | |
frappe.provide("frappe.views"); | |
frappe.ui.form.on("Tab Report", { | |
onload: function (frm) { | |
frm.tab_report = new frappe.views.TabReport({ frm: frm }); | |
frm.tab_report.show(); | |
}, |
https://github.com/t1m0n/air-datepicker Docs : http://t1m0n.name/air-datepicker/docs/
include in html template
Bench Commands Cheatsheet Bench Commands Cheatsheet General Usage bench --version - Show bench version bench version - Show version of all apps bench src - Show bench repo directory bench --help - Show all commands and help bench [command] --help - Show help for command bench init [bench-name] - Create a new bench (Run from home dir) bench --site [site-name] COMMAND - Specify site for command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Replace "DocType" with the source DocType | |
frappe.ui.form.on("DocType", { | |
//The trigger can be changed, but refresh must be used to use a button | |
refresh: function(frm) { | |
//The following line creates a button. | |
frm.add_custom_button(__("Update"), | |
//The function below is triggered when the button is pressed. | |
function() { | |
frappe.call({ | |
"method": "frappe.client.set_value", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder