def assign_task_to_owner(doc, doctype, msg, users):
    for d in users:
        from frappe.widgets.form import assign_to
        args = {
            'assign_to': d,
            'doctype': doctype,
            'name': doc,
            'description': msg,
            'priority': 'High'
        }
        assign_to.add(args)
Beispiel #2
0
def assign_task_to_owner(doc, doctype, msg, users):
	for d in users:
		from frappe.widgets.form import assign_to
		args = {
			'assign_to' 	:	d,
			'doctype'		:	doctype,
			'name'			:	doc,
			'description'	:	msg,
			'priority'		:	'High'
		}
		assign_to.add(args)
Beispiel #3
0
def assign_task_to_owner(inv, msg, users):
    for d in users:
        from frappe.widgets.form import assign_to
        args = {
            'assign_to': d,
            'doctype': 'Sales Invoice',
            'name': inv,
            'description': msg,
            'priority': 'Urgent'
        }
        assign_to.add(args)
Beispiel #4
0
def assign_task_to_owner(inv, msg, users):
	for d in users:
		from frappe.widgets.form import assign_to
		args = {
			'assign_to' 	:	d,
			'doctype'		:	'Sales Invoice',
			'name'			:	inv,
			'description'	:	msg,
			'priority'		:	'Urgent'
		}
		assign_to.add(args)
Beispiel #5
0
    def test_assign(self):
        from frappe.widgets.form.assign_to import add

        ev = frappe.get_doc(test_records[0]).insert()

        add({
            "assign_to": "*****@*****.**",
            "doctype": "Event",
            "name": ev.name,
            "description": "Test Assignment"
        })

        ev = frappe.get_doc("Event", ev.name)

        self.assertEquals(ev._assign, json.dumps(["*****@*****.**"]))

        # add another one
        add({
            "assign_to": "*****@*****.**",
            "doctype": "Event",
            "name": ev.name,
            "description": "Test Assignment"
        })

        ev = frappe.get_doc("Event", ev.name)

        self.assertEquals(set(json.loads(ev._assign)),
                          set(["*****@*****.**", "*****@*****.**"]))

        # close an assignment
        todo = frappe.get_doc(
            "ToDo", {
                "reference_type": ev.doctype,
                "reference_name": ev.name,
                "owner": "*****@*****.**"
            })
        todo.status = "Closed"
        todo.save()

        ev = frappe.get_doc("Event", ev.name)
        self.assertEquals(ev._assign, json.dumps(["*****@*****.**"]))

        # cleanup
        ev.delete()
Beispiel #6
0
	def test_assign(self):
		from frappe.widgets.form.assign_to import add

		ev = frappe.get_doc(test_records[0]).insert()

		add({
			"assign_to": "*****@*****.**",
			"doctype": "Event",
			"name": ev.name,
			"description": "Test Assignment"
		})

		ev = frappe.get_doc("Event", ev.name)

		self.assertEquals(ev._assign, json.dumps(["*****@*****.**"]))

		# add another one
		add({
			"assign_to": "*****@*****.**",
			"doctype": "Event",
			"name": ev.name,
			"description": "Test Assignment"
		})

		ev = frappe.get_doc("Event", ev.name)

		self.assertEquals(set(json.loads(ev._assign)), set(["*****@*****.**", "*****@*****.**"]))

		# close an assignment
		todo = frappe.get_doc("ToDo", {"reference_type": ev.doctype, "reference_name": ev.name,
			"owner": "*****@*****.**"})
		todo.status = "Closed"
		todo.save()

		ev = frappe.get_doc("Event", ev.name)
		self.assertEquals(ev._assign, json.dumps(["*****@*****.**"]))

		# cleanup
		ev.delete()