ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Datatable Inline Editing & Other Options


#1

Hi everyone,

I’m writing a custom script report on v11 which I believe is using Frappe’s very own datatable. I understand that it supports lots of options, including inline editing. May I know where should i indicate those options? I tried doing it at the columns code block but can’t make it work.

Below are my codes.

Python file

from __future__ import unicode_literals
import frappe

def execute(filters=None):
	columns = get_columns(filters)
	data = get_data(filters, columns)
	
	return columns, data

def get_columns(filters):
	columns = [{
		"fieldname": "supplier_name",
		"label": "Supplier Name",
		"fieldtype": "Link",
		"options": "Rebate Supplier",
		"width":150
	},
	{
		"fieldname": "franchisee_name",
		"label": "Franchisee Name",
		"fieldtype": "Link",
		"options": "Rebate Franchisee",
		"width":150
	},
	{
		"fieldname": "year",
		"label": "Year",
		"fieldtype": "Data",
		"width":45
	},
	{
		"fieldname": "cy_jan_transaction",
		"label": "Jan",
		"fieldtype": "Float",
		"editable": "true",
		"resizable": "false",
		"width":50
	}
	]

	return columns

def get_data(filters, columns):
	data = []

	data = frappe.get_all(
		'Rebate Supplier Transaction', 
		filters={}, 
		fields=[
			'supplier_name',
			'franchisee_name',
			'year',
			'cy_jan_transaction'
			]
		)

	return data

Javascript file

frappe.query_reports["Rebate Report"] = {
	"filters": [
		{
			"fieldname":"supplier_name",
			"label":"Supplier Name",
			"fieldtype":"Link",
			"options":"Rebate Supplier"
		},
	]
}

I would like the field “cy_jan_transaction” be editable.

Appreciate your guidance. Thank you.