How to assign the a button for creating a document?

I am trying to make a tool to make communications but I am unable to find a way to assign to make a communication as on clicking the button I am getting this error:

  Traceback (innermost last):
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 49, in application
    response = frappe.handler.handle()
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 66, in handle
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 89, in execute_cmd
    ret =, **frappe.form_dict)
  File "/home/aditya/frappe-bench/apps/frappe/frappe/", line 531, in call
    return fn(*args, **newargs)
 TypeError: runserverobj() takes at least 1 argument (1 given)

My python file has the following code:

from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.document import Document
import json

class SalesCall(Document):
	def make_communication(self):
		com = frappe.new_doc('Communication')
		com.subject = 'Test'
		return com.as_dict()

The problem seems to be in your JS call.

Don’t play with communication - it will re-written in v5 and you will get lot of merge conflicts!

I know that communications are intended for a change in v5 but can’t really wait for the release of v5 which is not near AFAIK.

Hence would like to know how I could make this button work. I don’t have a js file for this doctype in my code.

How are you triggering this? There seems to be an error in the trigger.