Esempio n. 1
0
def get_error_report(from_date=None, to_date=None, limit=10):
    from frappe.utils import get_url, now_datetime, add_days

    if not from_date:
        from_date = add_days(now_datetime().date(), -1)
    if not to_date:
        to_date = add_days(now_datetime().date(), -1)

    errors = get_errors(from_date, to_date, limit)

    if errors:
        return 1, """<h4>Scheduler Failed Events (max {limit}):</h4>
			<p>URL: <a href="{url}" target="_blank">{url}</a></p><hr>{errors}""".format(
            limit=limit, url=get_url(), errors="<hr>".join(errors))
    else:
        return 0, "<p>Scheduler didn't encounter any problems.</p>"
Esempio n. 2
0
def get_context(context):
    if frappe.session.user == 'Guest':
        frappe.throw(_("You need to be logged in to access this page"),
                     frappe.PermissionError)

    # allgemein
    user = frappe.get_doc("DP User", frappe.session.user)

    # event
    try:
        context["event"] = frappe.db.sql("""SELECT * FROM `tabDP Event`
											WHERE `start` >= '{nowdate}'
											ORDER BY `start` ASC
											LIMIT 1""".format(nowdate=now_datetime()),
                                         as_dict=True)[0]

        context["aufgebot"] = frappe.db.sql("""SELECT * FROM `tabTeilnehmer`
											WHERE `parent` = '{event}'""".format(event=context["event"].name),
                                            as_dict=True)

        context["starting_lines"] = frappe.db.sql(
            """SELECT * FROM `tabStart Linien`
											WHERE `parent` = '{event}' ORDER BY `linie` ASC""".format(
                event=context["event"].name),
            as_dict=True)

        context["match_linien"] = frappe.db.sql(
            """SELECT * FROM `tabMatch Linien`
											WHERE `parent` = '{event}' ORDER BY `linie` ASC""".format(
                event=context["event"].name),
            as_dict=True)
    except:
        context["event"] = None

    return context
Esempio n. 3
0
def before_tests():
    frappe.clear_cache()
    # complete setup if missing
    from frappe.desk.page.setup_wizard.setup_wizard import setup_complete

    if not frappe.db.a_row_exists("Company"):
        current_year = now_datetime().year
        setup_complete({
            "currency": "USD",
            "full_name": "Test User",
            "company_name": "Wind Power LLC",
            "timezone": "America/New_York",
            "company_abbr": "WP",
            "industry": "Manufacturing",
            "country": "United States",
            "fy_start_date": f"{current_year}-01-01",
            "fy_end_date": f"{current_year}-12-31",
            "language": "english",
            "company_tagline": "Testing",
            "email": "*****@*****.**",
            "password": "******",
            "chart_of_accounts": "Standard",
        })

    frappe.db.sql("delete from `tabLeave Allocation`")
    frappe.db.sql("delete from `tabLeave Application`")
    frappe.db.sql("delete from `tabSalary Slip`")
    frappe.db.sql("delete from `tabItem Price`")

    _enable_all_roles_for_admin()

    set_defaults_for_tests()

    frappe.db.commit()
Esempio n. 4
0
def get_error_report(from_date=None, to_date=None, limit=10):
    from frappe.utils import get_url, now_datetime, add_days

    if not from_date:
        from_date = add_days(now_datetime().date(), -1)
    if not to_date:
        to_date = add_days(now_datetime().date(), -1)

    errors = get_errors(from_date, to_date, limit)

    if errors:
        return 1, """<h4>Error Logs (max {limit}):</h4>
			<p>URL: <a href="{url}" target="_blank">{url}</a></p><hr>{errors}""".format(
            limit=limit, url=get_url(), errors="<hr>".join(errors))
    else:
        return 0, "<p>No error logs</p>"
Esempio n. 5
0
def get_error_report(from_date=None, to_date=None, limit=10):
	from frappe.utils import get_url, now_datetime, add_days

	if not from_date:
		from_date = add_days(now_datetime().date(), -1)
	if not to_date:
		to_date = add_days(now_datetime().date(), -1)

	errors = get_errors(from_date, to_date, limit)

	if errors:
		return 1, """<h4>Scheduler Failed Events (max {limit}):</h4>
			<p>URL: <a href="{url}" target="_blank">{url}</a></p><hr>{errors}""".format(
			limit=limit, url=get_url(), errors="<hr>".join(errors))
	else:
		return 0, "<p>Scheduler didn't encounter any problems.</p>"
Esempio n. 6
0
def get_error_report(from_date=None, to_date=None, limit=10):
	from frappe.utils import get_url, now_datetime, add_days

	if not from_date:
		from_date = add_days(now_datetime().date(), -1)
	if not to_date:
		to_date = add_days(now_datetime().date(), -1)

	errors = get_errors(from_date, to_date, limit)

	if errors:
		return 1, """<h4>Error Logs (max {limit}):</h4>
			<p>URL: <a href="{url}" target="_blank">{url}</a></p><hr>{errors}""".format(
			limit=limit, url=get_url(), errors="<hr>".join(errors))
	else:
		return 0, "<p>No error logs</p>"
Esempio n. 7
0
def is_dormant(since=345600):
    last_active = get_datetime(get_last_active())
    # Get now without tz info
    now = now_datetime().replace(tzinfo=None)
    time_since_last_active = now - last_active
    if time_since_last_active.total_seconds() > since:  # 4 days
        return True
    return False
Esempio n. 8
0
def is_dormant(since = 345600):
	last_active = get_datetime(get_last_active())
	# Get now without tz info
	now = now_datetime().replace(tzinfo=None)
	time_since_last_active = now - last_active
	if time_since_last_active.total_seconds() > since:  # 4 days
		return True
	return False
Esempio n. 9
0
def remove_share_of_mandat_and_related_docs(mandat, user_to_remove):
    related_docs = [
        'Vollmacht', 'Anforderung Patientendossier', 'Medizinischer Bericht',
        'Triage', 'Abschlussbericht', 'Freies Schreiben', 'SPO Anhang'
    ]
    for related_doc in related_docs:
        doc_type = related_doc
        doc_names = frappe.db.sql(
            """SELECT `name` FROM `tab{doc_type}` WHERE `mandat` = '{mandat}'"""
            .format(doc_type=doc_type, mandat=mandat),
            as_dict=True)
        for doc_name in doc_names:
            doc_name = doc_name.name
            # check if already exist and update
            existing = frappe.db.sql(
                """SELECT `name` FROM `tabDocShare` WHERE `user` = '{user_to_remove}' AND `share_doctype` = '{doc_type}' AND `share_name` = '{doc_name}'"""
                .format(user_to_remove=user_to_remove,
                        doc_type=doc_type,
                        doc_name=doc_name),
                as_dict=True)
            if len(existing) > 0:
                for shared_doc in existing:
                    frappe.db.sql(
                        """UPDATE `tabDocShare` SET `read` = 0, `share` = 0, `write` = 0, `modified` = '{datetime}' WHERE `name` = '{name}'"""
                        .format(name=shared_doc.name, datetime=now_datetime()),
                        as_list=True)

    doc_type = 'Mandat'
    doc_name = mandat
    # check if already exist and update
    existing = frappe.db.sql(
        """SELECT `name` FROM `tabDocShare` WHERE `user` = '{user_to_remove}' AND `share_doctype` = '{doc_type}' AND `share_name` = '{doc_name}'"""
        .format(user_to_remove=user_to_remove,
                doc_type=doc_type,
                doc_name=doc_name),
        as_dict=True)
    if len(existing) > 0:
        for shared_doc in existing:
            frappe.db.sql(
                """UPDATE `tabDocShare` SET `read` = 0, `share` = 0, `write` = 0, `modified` = '{datetime}' WHERE `name` = '{name}'"""
                .format(name=shared_doc.name, datetime=now_datetime()),
                as_list=True)

    frappe.db.commit()
    return 'ok'
Esempio n. 10
0
def _get_print_details_row(filters):
    from_date = formatdate(filters.get('from_date'), 'dd-mm-yyyy')
    to_date = formatdate(filters.get('to_date'), 'dd-mm-yyyy')
    printed_on = now_datetime().strftime('%d-%m-%Y %H:%M:%S')

    return [
        {},
        {'project': "'From Date: {}'".format(from_date)},
        {'project': "'To Date: {}'".format(to_date)},
        {'project': "'Printed On: {}'".format(printed_on)}
    ]
Esempio n. 11
0
def is_dormant(since=345600):
    last_user_activity = get_last_active()
    if not last_user_activity:
        # no user has ever logged in, so not yet used
        return False
    last_active = get_datetime(last_user_activity)
    # Get now without tz info
    now = now_datetime().replace(tzinfo=None)
    time_since_last_active = now - last_active
    if time_since_last_active.total_seconds() > since:  # 4 days
        return True
    return False
Esempio n. 12
0
    def test_get_timedelta(self):
        datetime_input = now_datetime()
        timedelta_input = get_timedelta()
        time_input = nowtime()

        self.assertIsInstance(get_timedelta(), timedelta)
        self.assertIsInstance(get_timedelta("100:2:12"), timedelta)
        self.assertIsInstance(get_timedelta("17:21:00"), timedelta)
        self.assertIsInstance(get_timedelta("2012-01-19 17:21:00"), timedelta)
        self.assertIsInstance(get_timedelta(str(datetime_input)), timedelta)
        self.assertIsInstance(get_timedelta(str(timedelta_input)), timedelta)
        self.assertIsInstance(get_timedelta(str(time_input)), timedelta)
Esempio n. 13
0
    def test_get_time(self):
        datetime_input = now_datetime()
        timedelta_input = get_timedelta()
        time_input = nowtime()

        self.assertIsInstance(get_time(datetime_input), time)
        self.assertIsInstance(get_time(timedelta_input), time)
        self.assertIsInstance(get_time(time_input), time)
        self.assertIsInstance(get_time("100:2:12"), time)
        self.assertIsInstance(get_time(str(datetime_input)), time)
        self.assertIsInstance(get_time(str(timedelta_input)), time)
        self.assertIsInstance(get_time(str(time_input)), time)
Esempio n. 14
0
def _generate_invoices_now(renting):
    def make_data(item_data):
        return {
            "customer":
            customer,
            "due_date":
            item_data.invoice_date,
            "posting_date":
            get_first_day(item_data.invoice_date),
            "debit_to":
            debit_to,
            "set_posting_time":
            1,
            "posting_time":
            0,
            "pm_rental_contract":
            renting.name,
            "items": [{
                "item_code": rental_item,
                "rate": renting.rental_amount,
                "qty": 1
            }],
        }

    items = list(
        filter(lambda x: getdate(x.invoice_date) < getdate(now_datetime()),
               renting.items))
    customer = frappe.db.get_value("Tenant Master", renting.tenant, "customer")
    rental_item = frappe.db.get_single_value("Facility Management Settings",
                                             "rental_item")
    submit_si = frappe.db.get_single_value("Facility Management Settings",
                                           "submit_si")
    debit_to = get_debit_to()

    for item in items:
        invoice_data = make_data(item)
        items = invoice_data.pop("items")

        invoice = frappe.new_doc("Sales Invoice")
        invoice.update(invoice_data)
        invoice.append("items", items[0])
        invoice.set_missing_values()
        invoice.save()

        if submit_si:
            invoice.submit()

        set_invoice_created(item.name, invoice.name)
Esempio n. 15
0
def plant_new(data):
    _validate_data([
        "room",
        "quantity",
        "source",
        "strain",
        "mother",
        "location",
    ], data)

    return frappe._dict({
        "barcode_id": [random_digits(16) for i in range(int(data["quantity"]))],
        "sessiontime": now_datetime(),
        "success": 1,
        "transactionid": random_digits(4),
    })
Esempio n. 16
0
def set_cancellation(rental_contract, cancellation_date,
                     reason_for_cancellation):
    frappe.db.sql(
        """
            UPDATE `tabRental Contract`
            SET
                cancellation_date=%(cancellation_date)s,
                reason_for_cancellation=%(reason_for_cancellation)s
            WHERE name=%(rental_contract)s
        """,
        {
            "cancellation_date": cancellation_date or now_datetime(),
            "reason_for_cancellation": reason_for_cancellation,
            "rental_contract": rental_contract,
        },
    )
    frappe.db.commit()
Esempio n. 17
0
	def cancel_irn(self, irn, reason, remark):
		data, res = {}, {}
		try:
			# validate cancellation
			if time_diff_in_hours(now_datetime(), self.invoice.ack_date) > 24:
				frappe.throw(_('E-Invoice cannot be cancelled after 24 hours of IRN generation.'), title=_('Not Allowed'), exc=CancellationNotAllowed)
			if not irn:
				frappe.throw(_('IRN not found. You must generate IRN before cancelling.'), title=_('Not Allowed'), exc=CancellationNotAllowed)

			headers = self.get_headers()
			data = json.dumps({
				'Irn': irn,
				'Cnlrsn': reason,
				'Cnlrem': remark
			}, indent=4)

			res = self.make_request('post', self.cancel_irn_url, headers, data)
			if res.get('success') or '9999' in res.get('message'):
				self.invoice.irn_cancelled = 1
				self.invoice.irn_cancel_date = res.get('result')['CancelDate'] if res.get('result') else ""
				self.invoice.einvoice_status = 'Cancelled'
				self.invoice.flags.updater_reference = {
					'doctype': self.invoice.doctype,
					'docname': self.invoice.name,
					'label': _('IRN Cancelled - {}').format(remark)
				}
				self.update_invoice()

			else:
				raise RequestFailed

		except RequestFailed:
			errors = self.sanitize_error_message(res.get('message'))
			self.set_failed_status(errors=errors)
			self.raise_error(errors=errors)

		except CancellationNotAllowed as e:
			self.set_failed_status(errors=str(e))
			self.raise_error(errors=str(e))

		except Exception as e:
			self.set_failed_status(errors=str(e))
			log_error(data)
			self.raise_error(True)
Esempio n. 18
0
def plant_new(data):
    _validate_data([
        "room",
        "quantity",
        "source",
        "strain",
        "mother",
        "location",
    ], data)

    return frappe._dict({
        "barcode_id":
        [random_digits(16) for i in range(int(data["quantity"]))],
        "sessiontime":
        now_datetime(),
        "success":
        1,
        "transactionid":
        random_digits(4),
    })
def _generate_invoices_now(renting):
	def make_data(item_data):
		return {
			'customer': customer,
			'due_date': item_data.invoice_date,
			'posting_date': get_first_day(item_data.invoice_date),
			'debit_to': debit_to,
			'set_posting_time': 1,
			'posting_time': 0,
			'pm_rental_contract': renting.name,
			'items': [
				{
					'item_code': rental_item,
					'rate': renting.rental_amount,
					'qty': 1
				}
			]
		}

	items = list(filter(lambda x: getdate(x.invoice_date) < getdate(now_datetime()), renting.items))
	customer = frappe.db.get_value('Tenant Master', renting.tenant, 'customer')
	rental_item = frappe.db.get_single_value('Facility Management Settings', 'rental_item')
	submit_si = frappe.db.get_single_value('Facility Management Settings', 'submit_si')
	debit_to = get_debit_to()

	for item in items:
		invoice_data = make_data(item)
		items = invoice_data.pop('items')

		invoice = frappe.new_doc('Sales Invoice')
		invoice.update(invoice_data)
		invoice.append('items', items[0])
		invoice.set_missing_values()
		invoice.save()

		if submit_si:
			invoice.submit()

		set_invoice_created(item.name, invoice.name)
Esempio n. 20
0
def share_mandat_and_related_docs(mandat, user_to_add):
    related_docs = [
        'Vollmacht', 'Anforderung Patientendossier', 'Medizinischer Bericht',
        'Triage', 'Abschlussbericht', 'Freies Schreiben', 'SPO Anhang'
    ]
    for related_doc in related_docs:
        doc_type = related_doc
        doc_names = frappe.db.sql(
            """SELECT `name` FROM `tab{doc_type}` WHERE `mandat` = '{mandat}'"""
            .format(doc_type=doc_type, mandat=mandat),
            as_dict=True)
        for doc_name in doc_names:
            doc_name = doc_name.name
            # check if already exist and update if neccesary
            existing = frappe.db.sql(
                """SELECT `name` FROM `tabDocShare` WHERE `user` = '{user_to_add}' AND `share_doctype` = '{doc_type}' AND `share_name` = '{doc_name}'"""
                .format(user_to_add=user_to_add,
                        doc_type=doc_type,
                        doc_name=doc_name),
                as_dict=True)
            if len(existing) > 0:
                for shared_doc in existing:
                    frappe.db.sql(
                        """UPDATE `tabDocShare` SET `read` = 1, `share` = 1, `write` = 1, `modified` = '{datetime}' WHERE `name` = '{name}'"""
                        .format(name=shared_doc.name, datetime=now_datetime()),
                        as_list=True)
            else:
                # if not exist, create new
                hash = frappe.generate_hash('DocShare', 10)
                frappe.db.sql("""INSERT INTO `tabDocShare`
                                    (`name`, `creation`, `modified`, `modified_by`, `owner`, `docstatus`, `idx`, `everyone`, `share_name`, `read`, `share`, `write`, `notify_by_email`, `user`, `share_doctype`)
                                    VALUES ('{hash}', '{datetime}', '{datetime}', '{user}', '{user}', 0, 0, 0, '{doc_name}', 1, 1, 1, 1, '{user_to_add}', '{doc_type}')"""
                              .format(hash=hash,
                                      datetime=now_datetime(),
                                      user=frappe.session.user,
                                      doc_name=doc_name,
                                      user_to_add=user_to_add,
                                      doc_type=doc_type),
                              as_list=True)

    doc_type = 'Mandat'
    doc_name = mandat
    # check if already exist and update if neccesary
    existing = frappe.db.sql(
        """SELECT `name` FROM `tabDocShare` WHERE `user` = '{user_to_add}' AND `share_doctype` = '{doc_type}' AND `share_name` = '{doc_name}'"""
        .format(user_to_add=user_to_add, doc_type=doc_type, doc_name=doc_name),
        as_dict=True)
    if len(existing) > 0:
        for shared_doc in existing:
            frappe.db.sql(
                """UPDATE `tabDocShare` SET `read` = 1, `share` = 1, `write` = 1, `modified` = '{datetime}' WHERE `name` = '{name}'"""
                .format(name=shared_doc.name, datetime=now_datetime()),
                as_list=True)
    else:
        # if not exist, create new
        hash = frappe.generate_hash('DocShare', 10)
        frappe.db.sql("""INSERT INTO `tabDocShare`
                            (`name`, `creation`, `modified`, `modified_by`, `owner`, `docstatus`, `idx`, `everyone`, `share_name`, `read`, `share`, `write`, `notify_by_email`, `user`, `share_doctype`)
                            VALUES ('{hash}', '{datetime}', '{datetime}', '{user}', '{user}', 0, 0, 0, '{doc_name}', 1, 1, 1, 1, '{user_to_add}', '{doc_type}')"""
                      .format(hash=hash,
                              datetime=now_datetime(),
                              user=frappe.session.user,
                              doc_name=doc_name,
                              user_to_add=user_to_add,
                              doc_type=doc_type),
                      as_list=True)

    frappe.db.commit()
    return 'ok'
Esempio n. 21
0
    def get_auth_token(self):
        if time_diff_in_seconds(self.e_invoice_settings.token_expiry,
                                now_datetime()) < 150.0:
            self.fetch_auth_token()

        return self.e_invoice_settings.auth_token
Esempio n. 22
0
def get_context(context):
    if frappe.session.user == 'Guest':
        frappe.throw(_("You need to be logged in to access this page"),
                     frappe.PermissionError)

    # allgemein
    user = frappe.get_doc("DP User", frappe.session.user)
    context["primar_bg"] = user.primar_bg
    context["sekundaer_bg"] = user.sekundaer_bg
    context["schriftfarbe"] = user.schriftfarbe

    # hauptmenue
    try:
        context["event"] = frappe.db.sql("""SELECT
												`tabDP Event`.`typ`,
												`tabDP Event`.`start`,
												`tabDP Event`.`ort`,
												`tabDP Event`.`name`,
												`tabDP Event`.`online`
											FROM `tabDP Event`
											WHERE `start` >= '{nowdate}'
											ORDER BY `start` ASC
											LIMIT 1""".format(nowdate=now_datetime()),
                                         as_dict=True)[0]
        event = frappe.get_doc("DP Event", context["event"]["name"])
        context["anwesend"] = False
        context["anzahl"] = len(event.anmeldungen)
        for teilnehmer in event.anmeldungen:
            if frappe.session.user == teilnehmer.user:
                context["anwesend"] = teilnehmer.name
    except:
        context["event"] = None
        context["anwesend"] = False

    # swissunihockey
    context["tabelle"] = get_tabelle(
        '2020', '5', '11', 'Gruppe+5'
    )  #get_tabelle(team.season, team.league, team.game_class, team.group)
    context["resultate"] = get_resultate(
        '428691', '2020')  #get_resultate(team.team_id, team.season)
    context["season"] = '2020'  #team.season
    context["league"] = '5'  #team.league
    context["game_class"] = '11'  #team.game_class
    context["group"] = 'Gruppe+5'  #team.group

    # topscorer und präsenz
    users = frappe.db.sql("""SELECT `name`, `fullname` FROM `tabDP User`""",
                          as_dict=True)
    context["prasenz"] = []
    for user in users:
        user_dict = {}
        user_dict["user"] = user.fullname

        # präsenz
        try:
            user_dict["anzahl"] = int(
                frappe.db.sql(
                    """SELECT COUNT(`name`) FROM `tabDP Event` WHERE `start` < '{nowdate}'"""
                    .format(nowdate=nowdate()),
                    as_list=True)[0][0])
        except:
            user_dict["anzahl"] = 0

        try:
            user_dict["anwesend"] = int(
                frappe.db.sql("""SELECT COUNT(`name`)
													FROM `tabTeilnehmer`
													WHERE `user` = '{user}'
													AND `parent` IN (
													SELECT `name` FROM `tabDP Event` WHERE `start` < '{nowdate}'
													)""".format(nowdate=nowdate(), user=user.name),
                              as_list=True)[0][0])
        except:
            user_dict["anwesend"] = 0

        try:
            user_dict["prozent"] = round(
                (100 / user_dict["anzahl"]) * user_dict["anwesend"], 2)
        except:
            user_dict["prozent"] = 0

        # skorerpunkte
        user_data = frappe.get_doc("DP User", user.name)
        user_dict["user_id"] = user_data.name
        user_dict["tore"] = user_data.tore
        user_dict["assists"] = user_data.assists
        user_dict["total_punkte"] = user_data.tore + user_data.assists
        user_roles = frappe.get_roles()
        if 'TP Admin' not in user_roles:
            user_dict["change_rechte"] = 'nein'
        else:
            user_dict["change_rechte"] = 'ja'

        context["prasenz"].append(user_dict)

    # Kasse
    context["saldo"] = frappe.db.get_single_value('DP Kasse', 'saldo')
    context["bezahlt"] = frappe.db.get_single_value('DP Kasse', 'bezahlt')
    context["offen"] = frappe.db.get_single_value('DP Kasse', 'offen')
    context["bussen"] = frappe.db.sql("""SELECT
											`tabDP Bussen`.`betrag`,
											`tabDP User`.`fullname`,
											`tabDP Bussen`.`begruendung`
										FROM `tabDP Bussen`
										INNER JOIN `tabDP User`
										ON `tabDP Bussen`.`user` = `tabDP User`.`name`""",
                                      as_dict=True)

    # profil
    context["user"] = frappe.get_doc("DP User", frappe.session.user)
    context["strasse"] = context["user"].strasse
    context["ort"] = context["user"].ort
    context["geburtsdatum"] = context["user"].geburtsdatum
    context["telefon"] = context["user"].telefon
    context["plz"] = context["user"].plz
    context["fullname"] = context["user"].fullname

    # Kalender
    context["events_in_zukunft"] = frappe.db.sql("""SELECT
													`tabDP Event`.`typ`,
													`tabDP Event`.`start`,
													`tabDP Event`.`ort`,
													`tabDP Event`.`name`,
													`tabDP Event`.`gegner`,
													`tabDP Event`.`details`
												FROM `tabDP Event`
												WHERE DATE(`start`) > '{nowdate}'
												ORDER BY `start` ASC""".format(nowdate=nowdate()),
                                                 as_dict=True)
    context["details_zu_events"] = {}
    for _event in context["events_in_zukunft"]:
        _event = frappe.get_doc("DP Event", _event.name)
        context["details_zu_events"][_event.name] = {}
        context["details_zu_events"][_event.name]["anwesend"] = False
        context["details_zu_events"][_event.name]["anzahl"] = len(
            _event.anmeldungen)
        for teilnehmer in _event.anmeldungen:
            if frappe.session.user == teilnehmer.user:
                context["details_zu_events"][
                    _event.name]["anwesend"] = teilnehmer.name

    # Team
    context["users"] = frappe.db.sql(
        """SELECT * FROM `tabDP User` ORDER BY `fullname` ASC""", as_dict=True)

    return context