Ejemplo n.º 1
0
def execute():
    frappe.reload_doc("email", "doctype", "email_template")

    if not frappe.db.exists("Email Template",
                            _('Leave Approval Notification')):
        base_path = frappe.get_app_path("erpnext", "hr", "doctype")
        response = frappe.read_file(
            os.path.join(
                base_path,
                "leave_application/leave_application_email_template.html"))
        frappe.get_doc({
            'doctype': 'Email Template',
            'name': _("Leave Approval Notification"),
            'response': response,
            'subject': _("Leave Approval Notification"),
            'owner': frappe.session.user,
        }).insert(ignore_permissions=True)

    if not frappe.db.exists("Email Template", _('Leave Status Notification')):
        base_path = frappe.get_app_path("erpnext", "hr", "doctype")
        response = frappe.read_file(
            os.path.join(
                base_path,
                "leave_application/leave_application_email_template.html"))
        frappe.get_doc({
            'doctype': 'Email Template',
            'name': _("Leave Status Notification"),
            'response': response,
            'subject': _("Leave Status Notification"),
            'owner': frappe.session.user,
        }).insert(ignore_permissions=True)
def execute():
	frappe.reload_doc("email", "doctype", "email_template")

	if not frappe.db.exists("Email Template", _('Leave Approval Notification')):
		base_path = frappe.get_app_path("erpnext", "hr", "doctype")
		response = frappe.read_file(os.path.join(base_path, "leave_application/leave_application_email_template.html"))
		frappe.get_doc({
			'doctype': 'Email Template',
			'name': _("Leave Approval Notification"),
			'response': response,
			'subject': _("Leave Approval Notification"),
			'owner': frappe.session.user,
		}).insert(ignore_permissions=True)


	if not frappe.db.exists("Email Template", _('Leave Status Notification')):
		base_path = frappe.get_app_path("erpnext", "hr", "doctype")
		response = frappe.read_file(os.path.join(base_path, "leave_application/leave_application_email_template.html"))
		frappe.get_doc({
			'doctype': 'Email Template',
			'name': _("Leave Status Notification"),
			'response': response,
			'subject': _("Leave Status Notification"),
			'owner': frappe.session.user,
		}).insert(ignore_permissions=True)
Ejemplo n.º 3
0
def prepare_header_footer(soup):
    options = {}

    head = soup.find("head").contents
    styles = soup.find_all("style")

    bootstrap = frappe.read_file(
        os.path.join(frappe.local.sites_path,
                     "assets/frappe/css/bootstrap.css"))
    fontawesome = frappe.read_file(
        os.path.join(frappe.local.sites_path,
                     "assets/frappe/css/font-awesome.css"))

    # extract header and footer
    for html_id in ("header-html", "footer-html"):
        content = soup.find(id=html_id)
        if content:
            # there could be multiple instances of header-html/footer-html
            for tag in soup.find_all(id=html_id):
                tag.extract()

            toggle_visible_pdf(content)
            html = frappe.render_template(
                "templates/print_formats/pdf_header_footer.html", {
                    "head": head,
                    "styles": styles,
                    "content": content,
                    "html_id": html_id,
                    "bootstrap": bootstrap,
                    "fontawesome": fontawesome
                })

            # create temp file
            fname = os.path.join(
                "/tmp", "frappe-pdf-{0}.html".format(frappe.generate_hash()))
            with open(fname, "w") as f:
                f.write(html.encode("utf-8"))

            # {"header-html": "/tmp/frappe-pdf-random.html"}
            options[html_id] = fname

        else:
            if html_id == "header-html":
                options["margin-top"] = "15mm"

            elif html_id == "footer-html":
                options["margin-bottom"] = "15mm"

    return options
Ejemplo n.º 4
0
def get_file(path, modes="r", raise_not_found=False):
	if modes != "r":
		content = read_file(path, modes=modes, raise_not_found=raise_not_found)
	else:
		content = frappe.read_file(path, raise_not_found=raise_not_found)

	return content
Ejemplo n.º 5
0
def build_missing_files():
    '''Check which files dont exist yet from the assets.json and run build for those files'''

    missing_assets = []
    current_asset_files = []

    for type in ["css", "js"]:
        folder = os.path.join(sites_path, "assets", "frappe", "dist", type)
        current_asset_files.extend(os.listdir(folder))

    development = frappe.local.conf.developer_mode or frappe.local.dev_server
    build_mode = "development" if development else "production"

    assets_json = frappe.read_file("assets/assets.json")
    if assets_json:
        assets_json = frappe.parse_json(assets_json)

        for bundle_file, output_file in assets_json.items():
            if not output_file.startswith('/assets/frappe'):
                continue

            if os.path.basename(output_file) not in current_asset_files:
                missing_assets.append(bundle_file)

        if missing_assets:
            click.secho("\nBuilding missing assets...\n", fg="yellow")
            files_to_build = ["frappe/" + name for name in missing_assets]
            bundle(build_mode, files=files_to_build)
    else:
        # no assets.json, run full build
        bundle(build_mode, apps="frappe")
Ejemplo n.º 6
0
def get_change_log_for_app(app, from_version, to_version):
    change_log_folder = os.path.join(frappe.get_app_path(app), "change_log")
    if not os.path.exists(change_log_folder):
        return

    from_version = Version(from_version)
    to_version = Version(to_version)
    # remove pre-release part
    to_version.prerelease = None

    major_version_folders = [
        "v{0}".format(i)
        for i in range(from_version.major, to_version.major + 1)
    ]
    app_change_log = []

    for folder in os.listdir(change_log_folder):
        if folder in major_version_folders:
            for file in os.listdir(os.path.join(change_log_folder, folder)):
                version = Version(
                    os.path.splitext(file)[0][1:].replace("_", "."))

                if from_version < version <= to_version:
                    file_path = os.path.join(change_log_folder, folder, file)
                    content = frappe.read_file(file_path)
                    app_change_log.append([version, content])

    app_change_log = sorted(app_change_log, key=lambda d: d[0], reverse=True)

    # convert version to string and send
    return [[cstr(d[0]), d[1]] for d in app_change_log]
def execute():
    template = frappe.db.exists("Email Template",
                                _("Exit Questionnaire Notification"))
    if not template:
        base_path = frappe.get_app_path("erpnext", "hr", "doctype")
        response = frappe.read_file(
            os.path.join(
                base_path,
                "exit_interview/exit_questionnaire_notification_template.html")
        )

        template = frappe.get_doc({
            "doctype":
            "Email Template",
            "name":
            _("Exit Questionnaire Notification"),
            "response":
            response,
            "subject":
            _("Exit Questionnaire Notification"),
            "owner":
            frappe.session.user,
        }).insert(ignore_permissions=True)
        template = template.name

    hr_settings = frappe.get_doc("HR Settings")
    hr_settings.exit_questionnaire_notification_template = template
    hr_settings.flags.ignore_links = True
    hr_settings.save()
Ejemplo n.º 8
0
def get_ebelge_users():
    parser = XMLParser(target=EbelgeUsers())
    parser.feed(
        frappe.read_file(
            frappe.get_site_path("private", "files", "KullaniciListesiXml",
                                 "newUserPkList.xml")))
    return parser.close()
Ejemplo n.º 9
0
def get_change_log_for_app(app, from_version, to_version):
	change_log_folder = os.path.join(frappe.get_app_path(app), "change_log")
	if not os.path.exists(change_log_folder):
		return

	from_version = Version(from_version)
	to_version = Version(to_version)
	# remove pre-release part
	to_version.prerelease = None

	major_version_folders = ["v{0}".format(i) for i in range(from_version.major, to_version.major + 1)]
	app_change_log = []

	for folder in os.listdir(change_log_folder):
		if folder in major_version_folders:
			for file in os.listdir(os.path.join(change_log_folder, folder)):
				version = Version(os.path.splitext(file)[0][1:].replace("_", "."))

				if from_version < version <= to_version:
					file_path = os.path.join(change_log_folder, folder, file)
					content = frappe.read_file(file_path)
					app_change_log.append([version, content])

	app_change_log = sorted(app_change_log, key=lambda d: d[0], reverse=True)

	# convert version to string and send
	return [[cstr(d[0]), d[1]] for d in app_change_log]
Ejemplo n.º 10
0
def get_context(context):
    robots_txt = (frappe.db.get_single_value('Website Settings', 'robots_txt')
                  or (frappe.local.conf.robots_txt
                      and frappe.read_file(frappe.local.conf.robots_txt))
                  or '')

    return {'robots_txt': robots_txt}
Ejemplo n.º 11
0
def get_context(context):
    robots_txt = (frappe.db.get_single_value("Website Settings", "robots_txt")
                  or (frappe.local.conf.robots_txt
                      and frappe.read_file(frappe.local.conf.robots_txt))
                  or "")

    return {"robots_txt": robots_txt}
Ejemplo n.º 12
0
def get_file(path, modes="r", raise_not_found=False):
    if modes != "r":
        content = read_file(path, modes=modes, raise_not_found=raise_not_found)
    else:
        content = frappe.read_file(path, raise_not_found=raise_not_found)

    return content
Ejemplo n.º 13
0
Archivo: pdf.py Proyecto: frappe/frappe
def prepare_header_footer(soup):
    options = {}

    head = soup.find("head").contents
    styles = soup.find_all("style")

    bootstrap = frappe.read_file(os.path.join(frappe.local.sites_path, "assets/frappe/css/bootstrap.css"))
    fontawesome = frappe.read_file(os.path.join(frappe.local.sites_path, "assets/frappe/css/font-awesome.css"))

    # extract header and footer
    for html_id in ("header-html", "footer-html"):
        content = soup.find(id=html_id)
        if content:
            # there could be multiple instances of header-html/footer-html
            for tag in soup.find_all(id=html_id):
                tag.extract()

            toggle_visible_pdf(content)
            html = frappe.render_template(
                "templates/print_formats/pdf_header_footer.html",
                {
                    "head": head,
                    "styles": styles,
                    "content": content,
                    "html_id": html_id,
                    "bootstrap": bootstrap,
                    "fontawesome": fontawesome,
                },
            )

            # create temp file
            fname = os.path.join("/tmp", "frappe-pdf-{0}.html".format(frappe.generate_hash()))
            with open(fname, "w") as f:
                f.write(html.encode("utf-8"))

                # {"header-html": "/tmp/frappe-pdf-random.html"}
            options[html_id] = fname

        else:
            if html_id == "header-html":
                options["margin-top"] = "15mm"

            elif html_id == "footer-html":
                options["margin-bottom"] = "15mm"

    return options
def execute():
    if not frappe.db.exists("Email Template", _("Interview Reminder")):
        base_path = frappe.get_app_path("erpnext", "hr", "doctype")
        response = frappe.read_file(
            os.path.join(
                base_path,
                "interview/interview_reminder_notification_template.html"))

        frappe.get_doc({
            "doctype": "Email Template",
            "name": _("Interview Reminder"),
            "response": response,
            "subject": _("Interview Reminder"),
            "owner": frappe.session.user,
        }).insert(ignore_permissions=True)

    if not frappe.db.exists("Email Template",
                            _("Interview Feedback Reminder")):
        base_path = frappe.get_app_path("erpnext", "hr", "doctype")
        response = frappe.read_file(
            os.path.join(
                base_path,
                "interview/interview_feedback_reminder_template.html"))

        frappe.get_doc({
            "doctype": "Email Template",
            "name": _("Interview Feedback Reminder"),
            "response": response,
            "subject": _("Interview Feedback Reminder"),
            "owner": frappe.session.user,
        }).insert(ignore_permissions=True)

    hr_settings = frappe.get_doc("HR Settings")
    hr_settings.interview_reminder_template = _("Interview Reminder")
    hr_settings.feedback_reminder_notification_template = _(
        "Interview Feedback Reminder")
    hr_settings.flags.ignore_links = True
    hr_settings.save()
Ejemplo n.º 15
0
def setup_reminder_settings():
    if not frappe.db.exists('Email Template', _('Interview Reminder')):
        base_path = frappe.get_app_path('erpnext', 'hr', 'doctype')
        response = frappe.read_file(
            os.path.join(
                base_path,
                'interview/interview_reminder_notification_template.html'))

        frappe.get_doc({
            'doctype': 'Email Template',
            'name': _('Interview Reminder'),
            'response': response,
            'subject': _('Interview Reminder'),
            'owner': frappe.session.user,
        }).insert(ignore_permissions=True)

    if not frappe.db.exists('Email Template',
                            _('Interview Feedback Reminder')):
        base_path = frappe.get_app_path('erpnext', 'hr', 'doctype')
        response = frappe.read_file(
            os.path.join(
                base_path,
                'interview/interview_feedback_reminder_template.html'))

        frappe.get_doc({
            'doctype': 'Email Template',
            'name': _('Interview Feedback Reminder'),
            'response': response,
            'subject': _('Interview Feedback Reminder'),
            'owner': frappe.session.user,
        }).insert(ignore_permissions=True)

    hr_settings = frappe.get_doc('HR Settings')
    hr_settings.interview_reminder_template = _('Interview Reminder')
    hr_settings.feedback_reminder_notification_template = _(
        'Interview Feedback Reminder')
    hr_settings.save()
Ejemplo n.º 16
0
def execute():
    base_path = frappe.get_app_path("erpnext", "hr", "doctype")
    response = frappe.read_file(
        os.path.join(
            base_path,
            "leave_application/leave_application_email_template.html"))

    template = frappe.db.exists("Email Template",
                                _("Leave Approval Notification"))
    if template:
        frappe.db.set_value("Email Template", template, "response", response)

    template = frappe.db.exists("Email Template",
                                _("Leave Status Notification"))
    if template:
        frappe.db.set_value("Email Template", template, "response", response)
Ejemplo n.º 17
0
def get_import_file(csv_file_name, force=False):
    file_name = csv_file_name + '.csv'
    _file = frappe.db.exists('File', {'file_name': file_name})
    if force and _file:
        frappe.delete_doc_if_exists('File', _file)

    if frappe.db.exists('File', {'file_name': file_name}):
        f = frappe.get_doc('File', {'file_name': file_name})
    else:
        full_path = get_csv_file_path(file_name)
        f = frappe.get_doc(doctype='File',
                           content=frappe.read_file(full_path),
                           file_name=file_name,
                           is_private=1)
        f.save(ignore_permissions=True)

    return f
Ejemplo n.º 18
0
def prepare_header_footer(soup):
    options = {}

    head = soup.find("head").contents
    styles = soup.find_all("style")

    print_css = bundled_asset('print.bundle.css').lstrip('/')
    css = frappe.read_file(os.path.join(frappe.local.sites_path, print_css))

    # extract header and footer
    for html_id in ("header-html", "footer-html"):
        content = soup.find(id=html_id)
        if content:
            # there could be multiple instances of header-html/footer-html
            for tag in soup.find_all(id=html_id):
                tag.extract()

            toggle_visible_pdf(content)
            html = frappe.render_template(
                "templates/print_formats/pdf_header_footer.html", {
                    "head": head,
                    "content": content,
                    "styles": styles,
                    "html_id": html_id,
                    "css": css,
                    "lang": frappe.local.lang,
                    "layout_direction": "rtl" if is_rtl() else "ltr"
                })

            # create temp file
            fname = os.path.join(
                "/tmp", "frappe-pdf-{0}.html".format(frappe.generate_hash()))
            with open(fname, "wb") as f:
                f.write(html.encode("utf-8"))

            # {"header-html": "/tmp/frappe-pdf-random.html"}
            options[html_id] = fname
        else:
            if html_id == "header-html":
                options["margin-top"] = "15mm"
            elif html_id == "footer-html":
                options["margin-bottom"] = "15mm"

    return options
def execute():
	frappe.reload_doc("email", "doctype", "email_template")
	frappe.reload_doc("stock", "doctype", "delivery_settings")

	if not frappe.db.exists("Email Template", _("Dispatch Notification")):
		base_path = frappe.get_app_path("erpnext", "stock", "doctype")
		response = frappe.read_file(os.path.join(base_path, "delivery_trip/dispatch_notification_template.html"))

		frappe.get_doc({
			"doctype": "Email Template",
			"name": _("Dispatch Notification"),
			"response": response,
			"subject": _("Your order is out for delivery!"),
			"owner": frappe.session.user,
		}).insert(ignore_permissions=True)

	delivery_settings = frappe.get_doc("Delivery Settings")
	delivery_settings.dispatch_template = _("Dispatch Notification")
	delivery_settings.save()
def execute():
	frappe.reload_doc("email", "doctype", "email_template")
	frappe.reload_doc("stock", "doctype", "delivery_settings")

	if not frappe.db.exists("Email Template", _("Dispatch Notification")):
		base_path = frappe.get_app_path("erpnext", "stock", "doctype")
		response = frappe.read_file(os.path.join(base_path, "delivery_trip/dispatch_notification_template.html"))

		frappe.get_doc({
			"doctype": "Email Template",
			"name": _("Dispatch Notification"),
			"response": response,
			"subject": _("Your order is out for delivery!"),
			"owner": frappe.session.user,
		}).insert(ignore_permissions=True)

	delivery_settings = frappe.get_doc("Delivery Settings")
	delivery_settings.dispatch_template = _("Dispatch Notification")
	delivery_settings.save()
Ejemplo n.º 21
0
def execute():
    frappe.reload_doc("email", "doctype", "email_template")
    frappe.reload_doc("hr", "doctype", "hr_settings")

    if not frappe.db.exists("Email Template",
                            _("Birthday Email Notification")):
        base_path = frappe.get_app_path("erpnext", "templates", "emails")
        response = frappe.read_file(
            os.path.join(base_path, "birthday_email_notification.html"))

        frappe.get_doc({
            "doctype": "Email Template",
            "name": _("Birthday Email Notification"),
            "response": response,
            "subject": _("Happy Birthday!"),
            "owner": frappe.session.user,
        }).insert(ignore_permissions=True)

    hr_settings = frappe.get_doc("HR Settings")
    hr_settings.birthday_email_template = _("Birthday Email Notification")
    hr_settings.save()
Ejemplo n.º 22
0
def execute():
    frappe.reload_doc("email", "doctype", "email_template")
    frappe.reload_doc("accounts", "doctype", "accounts_settings")

    if not frappe.db.exists("Email Template", "Statement of Account"):
        base_path = frappe.get_app_path("erpnext", "templates", "emails")
        response = frappe.read_file(
            os.path.join(base_path,
                         "statement_of_account_email_notification.html"))

        frappe.get_doc({
            "doctype": "Email Template",
            "name": "Statement of Account",
            "response": response,
            "subject": "Statement of Account",
            "owner": frappe.session.user,
        }).insert(ignore_permissions=True)

    accounts_settings = frappe.get_doc("Accounts Settings")
    accounts_settings.statement_of_account_email_template = "Statement of Account"
    accounts_settings.save()
Ejemplo n.º 23
0
def get_assets_json():
    if not hasattr(frappe.local, "assets_json"):
        cache = frappe.cache()

        # using .get instead of .get_value to avoid pickle.loads
        try:
            assets_json = cache.get("assets_json")
        except ConnectionError:
            assets_json = None

        # if value found, decode it
        if assets_json is not None:
            try:
                assets_json = assets_json.decode('utf-8')
            except (UnicodeDecodeError, AttributeError):
                assets_json = None

        if not assets_json:
            assets_json = frappe.read_file("assets/assets.json")
            cache.set_value("assets_json", assets_json, shared=True)

        frappe.local.assets_json = frappe.safe_decode(assets_json)

    return frappe.parse_json(frappe.local.assets_json)
Ejemplo n.º 24
0
def get_js(path):
	js = frappe.read_file(path)
	if js:
		return render_include(js)
Ejemplo n.º 25
0
	def _add_code(self, path, fieldname):
		js = frappe.read_file(path)
		if js:
			self.set(fieldname, (self.get(fieldname) or "") + "\n\n" + render_jinja(js))
Ejemplo n.º 26
0
def install(country=None):
    records = [
        # domains
        {
            'doctype': 'Domain',
            'domain': 'Distribution'
        },
        {
            'doctype': 'Domain',
            'domain': 'Manufacturing'
        },
        {
            'doctype': 'Domain',
            'domain': 'Retail'
        },
        {
            'doctype': 'Domain',
            'domain': 'Services'
        },
        {
            'doctype': 'Domain',
            'domain': 'Education'
        },
        {
            'doctype': 'Domain',
            'domain': 'Healthcare'
        },
        {
            'doctype': 'Domain',
            'domain': 'Agriculture'
        },
        {
            'doctype': 'Domain',
            'domain': 'Non Profit'
        },

        # Setup Progress
        {
            'doctype':
            "Setup Progress",
            "actions": [{
                "action_name": "Add Company",
                "action_doctype": "Company",
                "min_doc_count": 1,
                "is_completed": 1,
                "domains": '[]'
            }, {
                "action_name":
                "Set Sales Target",
                "action_doctype":
                "Company",
                "min_doc_count":
                99,
                "action_document":
                frappe.defaults.get_defaults().get("company") or '',
                "action_field":
                "monthly_sales_target",
                "is_completed":
                0,
                "domains":
                '["Manufacturing", "Services", "Retail", "Distribution"]'
            }, {
                "action_name":
                "Add Customers",
                "action_doctype":
                "Customer",
                "min_doc_count":
                1,
                "is_completed":
                0,
                "domains":
                '["Manufacturing", "Services", "Retail", "Distribution"]'
            }, {
                "action_name":
                "Add Suppliers",
                "action_doctype":
                "Supplier",
                "min_doc_count":
                1,
                "is_completed":
                0,
                "domains":
                '["Manufacturing", "Services", "Retail", "Distribution"]'
            }, {
                "action_name":
                "Add Products",
                "action_doctype":
                "Item",
                "min_doc_count":
                1,
                "is_completed":
                0,
                "domains":
                '["Manufacturing", "Services", "Retail", "Distribution"]'
            }, {
                "action_name": "Add Programs",
                "action_doctype": "Program",
                "min_doc_count": 1,
                "is_completed": 0,
                "domains": '["Education"]'
            }, {
                "action_name": "Add Instructors",
                "action_doctype": "Instructor",
                "min_doc_count": 1,
                "is_completed": 0,
                "domains": '["Education"]'
            }, {
                "action_name": "Add Courses",
                "action_doctype": "Course",
                "min_doc_count": 1,
                "is_completed": 0,
                "domains": '["Education"]'
            }, {
                "action_name": "Add Rooms",
                "action_doctype": "Room",
                "min_doc_count": 1,
                "is_completed": 0,
                "domains": '["Education"]'
            }, {
                "action_name": "Add Users",
                "action_doctype": "User",
                "min_doc_count": 4,
                "is_completed": 0,
                "domains": '[]'
            }, {
                "action_name": "Add Letterhead",
                "action_doctype": "Letter Head",
                "min_doc_count": 1,
                "is_completed": 0,
                "domains": '[]'
            }]
        },

        # address template
        {
            'doctype': "Address Template",
            "country": country
        },

        # item group
        {
            'doctype': 'Item Group',
            'item_group_name': _('All Item Groups'),
            'is_group': 1,
            'parent_item_group': ''
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Products'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups'),
            "show_in_website": 1
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Raw Material'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Services'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Sub Assemblies'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Consumable'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },

        # salary component
        {
            'doctype': 'Salary Component',
            'salary_component': _('Income Tax'),
            'description': _('Income Tax'),
            'type': 'Deduction'
        },
        {
            'doctype': 'Salary Component',
            'salary_component': _('Basic'),
            'description': _('Basic'),
            'type': 'Earning'
        },
        {
            'doctype': 'Salary Component',
            'salary_component': _('Arrear'),
            'description': _('Arrear'),
            'type': 'Earning'
        },
        {
            'doctype': 'Salary Component',
            'salary_component': _('Leave Encashment'),
            'description': _('Leave Encashment'),
            'type': 'Earning'
        },

        # expense claim type
        {
            'doctype': 'Expense Claim Type',
            'name': _('Calls'),
            'expense_type': _('Calls')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Food'),
            'expense_type': _('Food')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Medical'),
            'expense_type': _('Medical')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Others'),
            'expense_type': _('Others')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Travel'),
            'expense_type': _('Travel')
        },

        # leave type
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Casual Leave'),
            'name': _('Casual Leave'),
            'is_encash': 1,
            'is_carry_forward': 1,
            'max_days_allowed': '3',
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Compensatory Off'),
            'name': _('Compensatory Off'),
            'is_encash': 0,
            'is_carry_forward': 0,
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Sick Leave'),
            'name': _('Sick Leave'),
            'is_encash': 0,
            'is_carry_forward': 0,
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Privilege Leave'),
            'name': _('Privilege Leave'),
            'is_encash': 0,
            'is_carry_forward': 0,
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Leave Without Pay'),
            'name': _('Leave Without Pay'),
            'is_encash': 0,
            'is_carry_forward': 0,
            'is_lwp': 1,
            'include_holiday': 1
        },

        # Employment Type
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Full-time')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Part-time')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Probation')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Contract')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Commission')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Piecework')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Intern')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Apprentice')
        },

        # Department
        {
            'doctype': 'Department',
            'department_name': _('All Departments'),
            'is_group': 1,
            'parent_department': ''
        },
        {
            'doctype': 'Department',
            'department_name': _('Accounts'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Marketing'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Sales'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Purchase'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Operations'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Production'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Dispatch'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Customer Service'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Human Resources'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Management'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Quality Management'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Research & Development'),
            'parent_department': _('All Departments')
        },
        {
            'doctype': 'Department',
            'department_name': _('Legal'),
            'parent_department': _('All Departments')
        },

        # Designation
        {
            'doctype': 'Designation',
            'designation_name': _('CEO')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Analyst')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Engineer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Accountant')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Secretary')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Associate')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Administrative Officer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Business Development Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('HR Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Project Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Head of Marketing and Sales')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Software Developer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Designer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Researcher')
        },

        # territory
        {
            'doctype': 'Territory',
            'territory_name': _('All Territories'),
            'is_group': 1,
            'name': _('All Territories'),
            'parent_territory': ''
        },

        # customer group
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('All Customer Groups'),
            'is_group': 1,
            'name': _('All Customer Groups'),
            'parent_customer_group': ''
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Individual'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Commercial'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Non Profit'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Government'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },

        # supplier type
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Services')
        },
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Local')
        },
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Raw Material')
        },
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Electrical')
        },
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Hardware')
        },
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Pharmaceutical')
        },
        {
            'doctype': 'Supplier Type',
            'supplier_type': _('Distributor')
        },

        # Sales Person
        {
            'doctype': 'Sales Person',
            'sales_person_name': _('Sales Team'),
            'is_group': 1,
            "parent_sales_person": ""
        },

        # UOM
        {
            'uom_name': _('Unit'),
            'doctype': 'UOM',
            'name': _('Unit'),
            "must_be_whole_number": 1
        },
        {
            'uom_name': _('Box'),
            'doctype': 'UOM',
            'name': _('Box'),
            "must_be_whole_number": 1
        },
        {
            'uom_name': _('Kg'),
            'doctype': 'UOM',
            'name': _('Kg')
        },
        {
            'uom_name': _('Meter'),
            'doctype': 'UOM',
            'name': _('Meter')
        },
        {
            'uom_name': _('Litre'),
            'doctype': 'UOM',
            'name': _('Litre')
        },
        {
            'uom_name': _('Gram'),
            'doctype': 'UOM',
            'name': _('Gram')
        },
        {
            'uom_name': _('Nos'),
            'doctype': 'UOM',
            'name': _('Nos'),
            "must_be_whole_number": 1
        },
        {
            'uom_name': _('Pair'),
            'doctype': 'UOM',
            'name': _('Pair'),
            "must_be_whole_number": 1
        },
        {
            'uom_name': _('Set'),
            'doctype': 'UOM',
            'name': _('Set'),
            "must_be_whole_number": 1
        },
        {
            'uom_name': _('Hour'),
            'doctype': 'UOM',
            'name': _('Hour')
        },
        {
            'uom_name': _('Minute'),
            'doctype': 'UOM',
            'name': _('Minute')
        },

        # Mode of Payment
        {
            'doctype':
            'Mode of Payment',
            'mode_of_payment':
            'Check' if country == "United States" else _('Cheque'),
            'type':
            'Bank'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Cash'),
            'type': 'Cash'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Credit Card'),
            'type': 'Bank'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Wire Transfer'),
            'type': 'Bank'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Bank Draft'),
            'type': 'Bank'
        },

        # Activity Type
        {
            'doctype': 'Activity Type',
            'activity_type': _('Planning')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Research')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Proposal Writing')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Execution')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Communication')
        },

        # Lead Source
        {
            'doctype':
            "Item Attribute",
            "attribute_name":
            _("Size"),
            "item_attribute_values": [{
                "attribute_value": _("Extra Small"),
                "abbr": "XS"
            }, {
                "attribute_value": _("Small"),
                "abbr": "S"
            }, {
                "attribute_value": _("Medium"),
                "abbr": "M"
            }, {
                "attribute_value": _("Large"),
                "abbr": "L"
            }, {
                "attribute_value": _("Extra Large"),
                "abbr": "XL"
            }]
        },
        {
            'doctype':
            "Item Attribute",
            "attribute_name":
            _("Colour"),
            "item_attribute_values": [{
                "attribute_value": _("Red"),
                "abbr": "RED"
            }, {
                "attribute_value": _("Green"),
                "abbr": "GRE"
            }, {
                "attribute_value": _("Blue"),
                "abbr": "BLU"
            }, {
                "attribute_value": _("Black"),
                "abbr": "BLA"
            }, {
                "attribute_value": _("White"),
                "abbr": "WHI"
            }]
        },
        {
            'doctype': "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Opportunity"
        },
        {
            'doctype': "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Issue"
        },
        {
            'doctype': "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Job Applicant"
        },
        {
            'doctype': "Party Type",
            "party_type": "Customer"
        },
        {
            'doctype': "Party Type",
            "party_type": "Supplier"
        },
        {
            'doctype': "Party Type",
            "party_type": "Employee"
        },
        {
            'doctype': "Party Type",
            "party_type": "Member"
        },
        {
            'doctype': "Party Type",
            "party_type": "Shareholder"
        },
        {
            'doctype': "Party Type",
            "party_type": "Student"
        },
        {
            'doctype': "Opportunity Type",
            "name": "Hub"
        },
        {
            'doctype': "Opportunity Type",
            "name": _("Sales")
        },
        {
            'doctype': "Opportunity Type",
            "name": _("Support")
        },
        {
            'doctype': "Opportunity Type",
            "name": _("Maintenance")
        },
        {
            'doctype': "Project Type",
            "project_type": "Internal"
        },
        {
            'doctype': "Project Type",
            "project_type": "External"
        },
        {
            'doctype': "Project Type",
            "project_type": "Other"
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Date of Joining")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Annual Salary")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Probationary Period")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Employee Benefits")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Working Hours")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Stock Options")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Department")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Job Description")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Responsibilities")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Leaves per Year")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Notice Period")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Incentives")
        },
        {
            'doctype': "Print Heading",
            'print_heading': _("Credit Note")
        },
        {
            'doctype': "Print Heading",
            'print_heading': _("Debit Note")
        },

        # Assessment Group
        {
            'doctype': 'Assessment Group',
            'assessment_group_name': _('All Assessment Groups'),
            'is_group': 1,
            'parent_assessment_group': ''
        },

        # Share Management
        {
            "doctype": "Share Type",
            "title": _("Equity")
        },
        {
            "doctype": "Share Type",
            "title": _("Preference")
        },
    ]

    from erpnext.setup.setup_wizard.data.industry_type import get_industry_types
    records += [{
        "doctype": "Industry Type",
        "industry": d
    } for d in get_industry_types()]
    # records += [{"doctype":"Operation", "operation": d} for d in get_operations()]

    records += [{
        'doctype': 'Lead Source',
        'source_name': _(d)
    } for d in default_lead_sources]

    base_path = frappe.get_app_path("erpnext", "hr", "doctype")
    response = frappe.read_file(
        os.path.join(
            base_path,
            "leave_application/leave_application_email_template.html"))

    records += [{'doctype': 'Email Template', 'name': _("Leave Approval Notification"), 'response': response,\
     'subject': _("Leave Approval Notification"), 'owner': frappe.session.user}]

    records += [{'doctype': 'Email Template', 'name': _("Leave Status Notification"), 'response': response,\
     'subject': _("Leave Status Notification"), 'owner': frappe.session.user}]

    # Records for the Supplier Scorecard
    from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records
    make_default_records()

    from frappe.modules import scrub
    for r in records:
        doc = frappe.new_doc(r.get("doctype"))
        doc.update(r)

        # ignore mandatory for root
        parent_link_field = ("parent_" + scrub(doc.doctype))
        if doc.meta.get_field(
                parent_link_field) and not doc.get(parent_link_field):
            doc.flags.ignore_mandatory = True

        try:
            doc.insert(ignore_permissions=True)
        except frappe.DuplicateEntryError as e:
            # pass DuplicateEntryError and continue
            if e.args and e.args[0] == doc.doctype and e.args[1] == doc.name:
                # make sure DuplicateEntryError is for the exact same doc and not a related doc
                pass
            else:
                raise

    # set default customer group and territory
    selling_settings = frappe.get_doc("Selling Settings")
    selling_settings.set_default_customer_group_and_territory()
    selling_settings.save()
Ejemplo n.º 27
0
def get_js(path):
	js = frappe.read_file(path)
	if js:
		return render_include(js)
Ejemplo n.º 28
0
def install(country=None):
	records = [
		# domains
		{ 'doctype': 'Domain', 'domain': 'Distribution'},
		{ 'doctype': 'Domain', 'domain': 'Manufacturing'},
		{ 'doctype': 'Domain', 'domain': 'Retail'},
		{ 'doctype': 'Domain', 'domain': 'Services'},
		{ 'doctype': 'Domain', 'domain': 'Education'},
		{ 'doctype': 'Domain', 'domain': 'Healthcare'},
		{ 'doctype': 'Domain', 'domain': 'Agriculture'},
		{ 'doctype': 'Domain', 'domain': 'Non Profit'},

		# Setup Progress
		{'doctype': "Setup Progress", "actions": [
			{"action_name": "Add Company", "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
				"domains": '[]' },
			{"action_name": "Set Sales Target", "action_doctype": "Company", "min_doc_count": 99,
				"action_document": frappe.defaults.get_defaults().get("company") or '',
				"action_field": "monthly_sales_target", "is_completed": 0,
				"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
			{"action_name": "Add Customers", "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
			{"action_name": "Add Suppliers", "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
			{"action_name": "Add Products", "action_doctype": "Item", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
			{"action_name": "Add Programs", "action_doctype": "Program", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Education"]' },
			{"action_name": "Add Instructors", "action_doctype": "Instructor", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Education"]' },
			{"action_name": "Add Courses", "action_doctype": "Course", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Education"]' },
			{"action_name": "Add Rooms", "action_doctype": "Room", "min_doc_count": 1, "is_completed": 0,
				"domains": '["Education"]' },
			{"action_name": "Add Users", "action_doctype": "User", "min_doc_count": 4, "is_completed": 0,
				"domains": '[]' },
			{"action_name": "Add Letterhead", "action_doctype": "Letter Head", "min_doc_count": 1, "is_completed": 0,
				"domains": '[]' }
		]},

		# address template
		{'doctype':"Address Template", "country": country},

		# item group
		{'doctype': 'Item Group', 'item_group_name': _('All Item Groups'),
			'is_group': 1, 'parent_item_group': ''},
		{'doctype': 'Item Group', 'item_group_name': _('Products'),
			'is_group': 0, 'parent_item_group': _('All Item Groups'), "show_in_website": 1 },
		{'doctype': 'Item Group', 'item_group_name': _('Raw Material'),
			'is_group': 0, 'parent_item_group': _('All Item Groups') },
		{'doctype': 'Item Group', 'item_group_name': _('Services'),
			'is_group': 0, 'parent_item_group': _('All Item Groups') },
		{'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'),
			'is_group': 0, 'parent_item_group': _('All Item Groups') },
		{'doctype': 'Item Group', 'item_group_name': _('Consumable'),
			'is_group': 0, 'parent_item_group': _('All Item Groups') },

		# salary component
		{'doctype': 'Salary Component', 'salary_component': _('Income Tax'), 'description': _('Income Tax'), 'type': 'Deduction'},
		{'doctype': 'Salary Component', 'salary_component': _('Basic'), 'description': _('Basic'), 'type': 'Earning'},
		{'doctype': 'Salary Component', 'salary_component': _('Arrear'), 'description': _('Arrear'), 'type': 'Earning'},
		{'doctype': 'Salary Component', 'salary_component': _('Leave Encashment'), 'description': _('Leave Encashment'), 'type': 'Earning'},


		# expense claim type
		{'doctype': 'Expense Claim Type', 'name': _('Calls'), 'expense_type': _('Calls')},
		{'doctype': 'Expense Claim Type', 'name': _('Food'), 'expense_type': _('Food')},
		{'doctype': 'Expense Claim Type', 'name': _('Medical'), 'expense_type': _('Medical')},
		{'doctype': 'Expense Claim Type', 'name': _('Others'), 'expense_type': _('Others')},
		{'doctype': 'Expense Claim Type', 'name': _('Travel'), 'expense_type': _('Travel')},

		# leave type
		{'doctype': 'Leave Type', 'leave_type_name': _('Casual Leave'), 'name': _('Casual Leave'),
			'allow_encashment': 1, 'is_carry_forward': 1, 'max_continuous_days_allowed': '3', 'include_holiday': 1},
		{'doctype': 'Leave Type', 'leave_type_name': _('Compensatory Off'), 'name': _('Compensatory Off'),
			'allow_encashment': 0, 'is_carry_forward': 0, 'include_holiday': 1},
		{'doctype': 'Leave Type', 'leave_type_name': _('Sick Leave'), 'name': _('Sick Leave'),
			'allow_encashment': 0, 'is_carry_forward': 0, 'include_holiday': 1},
		{'doctype': 'Leave Type', 'leave_type_name': _('Privilege Leave'), 'name': _('Privilege Leave'),
			'allow_encashment': 0, 'is_carry_forward': 0, 'include_holiday': 1},
		{'doctype': 'Leave Type', 'leave_type_name': _('Leave Without Pay'), 'name': _('Leave Without Pay'),
			'allow_encashment': 0, 'is_carry_forward': 0, 'is_lwp':1, 'include_holiday': 1},

		# Employment Type
		{'doctype': 'Employment Type', 'employee_type_name': _('Full-time')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Part-time')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Probation')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Contract')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Commission')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Piecework')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Intern')},
		{'doctype': 'Employment Type', 'employee_type_name': _('Apprentice')},

		# Designation
		{'doctype': 'Designation', 'designation_name': _('CEO')},
		{'doctype': 'Designation', 'designation_name': _('Manager')},
		{'doctype': 'Designation', 'designation_name': _('Analyst')},
		{'doctype': 'Designation', 'designation_name': _('Engineer')},
		{'doctype': 'Designation', 'designation_name': _('Accountant')},
		{'doctype': 'Designation', 'designation_name': _('Secretary')},
		{'doctype': 'Designation', 'designation_name': _('Associate')},
		{'doctype': 'Designation', 'designation_name': _('Administrative Officer')},
		{'doctype': 'Designation', 'designation_name': _('Business Development Manager')},
		{'doctype': 'Designation', 'designation_name': _('HR Manager')},
		{'doctype': 'Designation', 'designation_name': _('Project Manager')},
		{'doctype': 'Designation', 'designation_name': _('Head of Marketing and Sales')},
		{'doctype': 'Designation', 'designation_name': _('Software Developer')},
		{'doctype': 'Designation', 'designation_name': _('Designer')},
		{'doctype': 'Designation', 'designation_name': _('Researcher')},

		# territory
		{'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 1, 'name': _('All Territories'), 'parent_territory': ''},

		# customer group
		{'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 1, 	'name': _('All Customer Groups'), 'parent_customer_group': ''},
		{'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
		{'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
		{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
		{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},

		# supplier group
		{'doctype': 'Supplier Group', 'supplier_group_name': _('All Supplier Groups'), 'is_group': 1, 'name': _('All Supplier Groups'), 'parent_supplier_group': ''},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Services'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Local'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Raw Material'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Electrical'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Hardware'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Pharmaceutical'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
		{'doctype': 'Supplier Group', 'supplier_group_name': _('Distributor'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},

		# Sales Person
		{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""},

		# Mode of Payment
		{'doctype': 'Mode of Payment',
			'mode_of_payment': 'Check' if country=="United States" else _('Cheque'),
			'type': 'Bank'},
		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Cash'),
			'type': 'Cash'},
		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Credit Card'),
			'type': 'Bank'},
		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Wire Transfer'),
			'type': 'Bank'},
		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Bank Draft'),
			'type': 'Bank'},

		# Activity Type
		{'doctype': 'Activity Type', 'activity_type': _('Planning')},
		{'doctype': 'Activity Type', 'activity_type': _('Research')},
		{'doctype': 'Activity Type', 'activity_type': _('Proposal Writing')},
		{'doctype': 'Activity Type', 'activity_type': _('Execution')},
		{'doctype': 'Activity Type', 'activity_type': _('Communication')},

		{'doctype': "Item Attribute", "attribute_name": _("Size"), "item_attribute_values": [
			{"attribute_value": _("Extra Small"), "abbr": "XS"},
			{"attribute_value": _("Small"), "abbr": "S"},
			{"attribute_value": _("Medium"), "abbr": "M"},
			{"attribute_value": _("Large"), "abbr": "L"},
			{"attribute_value": _("Extra Large"), "abbr": "XL"}
		]},

		{'doctype': "Item Attribute", "attribute_name": _("Colour"), "item_attribute_values": [
			{"attribute_value": _("Red"), "abbr": "RED"},
			{"attribute_value": _("Green"), "abbr": "GRE"},
			{"attribute_value": _("Blue"), "abbr": "BLU"},
			{"attribute_value": _("Black"), "abbr": "BLA"},
			{"attribute_value": _("White"), "abbr": "WHI"}
		]},

		#Job Applicant Source
		{'doctype': 'Job Applicant Source', 'source_name': _('Website Listing')},
		{'doctype': 'Job Applicant Source', 'source_name': _('Walk In')},
		{'doctype': 'Job Applicant Source', 'source_name': _('Employee Referral')},
		{'doctype': 'Job Applicant Source', 'source_name': _('Campaign')},

		{'doctype': "Email Account", "email_id": "*****@*****.**", "append_to": "Opportunity"},
		{'doctype': "Email Account", "email_id": "*****@*****.**", "append_to": "Issue"},
		{'doctype': "Email Account", "email_id": "*****@*****.**", "append_to": "Job Applicant"},

		{'doctype': "Party Type", "party_type": "Customer", "account_type": "Receivable"},
		{'doctype': "Party Type", "party_type": "Supplier", "account_type": "Payable"},
		{'doctype': "Party Type", "party_type": "Employee", "account_type": "Payable"},
		{'doctype': "Party Type", "party_type": "Member", "account_type": "Receivable"},
		{'doctype': "Party Type", "party_type": "Shareholder", "account_type": "Payable"},
		{'doctype': "Party Type", "party_type": "Student", "account_type": "Receivable"},

		{'doctype': "Opportunity Type", "name": "Hub"},
		{'doctype': "Opportunity Type", "name": _("Sales")},
		{'doctype': "Opportunity Type", "name": _("Support")},
		{'doctype': "Opportunity Type", "name": _("Maintenance")},

		{'doctype': "Project Type", "project_type": "Internal"},
		{'doctype': "Project Type", "project_type": "External"},
		{'doctype': "Project Type", "project_type": "Other"},

		{"doctype": "Offer Term", "offer_term": _("Date of Joining")},
		{"doctype": "Offer Term", "offer_term": _("Annual Salary")},
		{"doctype": "Offer Term", "offer_term": _("Probationary Period")},
		{"doctype": "Offer Term", "offer_term": _("Employee Benefits")},
		{"doctype": "Offer Term", "offer_term": _("Working Hours")},
		{"doctype": "Offer Term", "offer_term": _("Stock Options")},
		{"doctype": "Offer Term", "offer_term": _("Department")},
		{"doctype": "Offer Term", "offer_term": _("Job Description")},
		{"doctype": "Offer Term", "offer_term": _("Responsibilities")},
		{"doctype": "Offer Term", "offer_term": _("Leaves per Year")},
		{"doctype": "Offer Term", "offer_term": _("Notice Period")},
		{"doctype": "Offer Term", "offer_term": _("Incentives")},

		{'doctype': "Print Heading", 'print_heading': _("Credit Note")},
		{'doctype': "Print Heading", 'print_heading': _("Debit Note")},

		# Assessment Group
		{'doctype': 'Assessment Group', 'assessment_group_name': _('All Assessment Groups'),
			'is_group': 1, 'parent_assessment_group': ''},

		# Share Management
		{"doctype": "Share Type", "title": _("Equity")},
		{"doctype": "Share Type", "title": _("Preference")},


	]

	from erpnext.setup.setup_wizard.data.industry_type import get_industry_types
	records += [{"doctype":"Industry Type", "industry": d} for d in get_industry_types()]
	# records += [{"doctype":"Operation", "operation": d} for d in get_operations()]
	records += [{'doctype': 'Lead Source', 'source_name': _(d)} for d in default_lead_sources]

	records += [{'doctype': 'Sales Partner Type', 'sales_partner_type': _(d)} for d in default_sales_partner_type]

	base_path = frappe.get_app_path("erpnext", "hr", "doctype")
	response = frappe.read_file(os.path.join(base_path, "leave_application/leave_application_email_template.html"))

	records += [{'doctype': 'Email Template', 'name': _("Leave Approval Notification"), 'response': response,\
		'subject': _("Leave Approval Notification"), 'owner': frappe.session.user}]

	records += [{'doctype': 'Email Template', 'name': _("Leave Status Notification"), 'response': response,\
		'subject': _("Leave Status Notification"), 'owner': frappe.session.user}]

	# Records for the Supplier Scorecard
	from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records
	make_default_records()

	make_fixture_records(records)

	# set default customer group and territory
	selling_settings = frappe.get_doc("Selling Settings")
	selling_settings.set_default_customer_group_and_territory()
	selling_settings.save()

	add_uom_data()
Ejemplo n.º 29
0
def get_startup_js():
    return frappe.read_file(
        frappe.get_app_path('flows', *['asserts', 'js', 'flows.js']))
	def read_config(self):
		config = frappe.get_conf() or {}
		curr_site = os.path.join("currentsite.txt")
		config.default_site = frappe.read_file(curr_site) or frappe.local.site

		return config
Ejemplo n.º 31
0
def install(country=None):
    records = [
        # domains
        {
            'doctype': 'Domain',
            'domain': 'Distribution'
        },
        {
            'doctype': 'Domain',
            'domain': 'Manufacturing'
        },
        {
            'doctype': 'Domain',
            'domain': 'Retail'
        },
        {
            'doctype': 'Domain',
            'domain': 'Services'
        },
        {
            'doctype': 'Domain',
            'domain': 'Education'
        },
        {
            'doctype': 'Domain',
            'domain': 'Healthcare'
        },
        {
            'doctype': 'Domain',
            'domain': 'Agriculture'
        },
        {
            'doctype': 'Domain',
            'domain': 'Non Profit'
        },

        # ensure at least an empty Address Template exists for this Country
        {
            'doctype': "Address Template",
            "country": country
        },

        # item group
        {
            'doctype': 'Item Group',
            'item_group_name': _('All Item Groups'),
            'is_group': 1,
            'parent_item_group': ''
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Products'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups'),
            "show_in_website": 1
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Raw Material'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Services'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Sub Assemblies'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },
        {
            'doctype': 'Item Group',
            'item_group_name': _('Consumable'),
            'is_group': 0,
            'parent_item_group': _('All Item Groups')
        },

        # salary component
        {
            'doctype': 'Salary Component',
            'salary_component': _('Income Tax'),
            'description': _('Income Tax'),
            'type': 'Deduction'
        },
        {
            'doctype': 'Salary Component',
            'salary_component': _('Basic'),
            'description': _('Basic'),
            'type': 'Earning'
        },
        {
            'doctype': 'Salary Component',
            'salary_component': _('Arrear'),
            'description': _('Arrear'),
            'type': 'Earning'
        },
        {
            'doctype': 'Salary Component',
            'salary_component': _('Leave Encashment'),
            'description': _('Leave Encashment'),
            'type': 'Earning'
        },

        # expense claim type
        {
            'doctype': 'Expense Claim Type',
            'name': _('Calls'),
            'expense_type': _('Calls')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Food'),
            'expense_type': _('Food')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Medical'),
            'expense_type': _('Medical')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Others'),
            'expense_type': _('Others')
        },
        {
            'doctype': 'Expense Claim Type',
            'name': _('Travel'),
            'expense_type': _('Travel')
        },

        # leave type
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Casual Leave'),
            'name': _('Casual Leave'),
            'allow_encashment': 1,
            'is_carry_forward': 1,
            'max_continuous_days_allowed': '3',
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Compensatory Off'),
            'name': _('Compensatory Off'),
            'allow_encashment': 0,
            'is_carry_forward': 0,
            'include_holiday': 1,
            'is_compensatory': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Sick Leave'),
            'name': _('Sick Leave'),
            'allow_encashment': 0,
            'is_carry_forward': 0,
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Privilege Leave'),
            'name': _('Privilege Leave'),
            'allow_encashment': 0,
            'is_carry_forward': 0,
            'include_holiday': 1
        },
        {
            'doctype': 'Leave Type',
            'leave_type_name': _('Leave Without Pay'),
            'name': _('Leave Without Pay'),
            'allow_encashment': 0,
            'is_carry_forward': 0,
            'is_lwp': 1,
            'include_holiday': 1
        },

        # Employment Type
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Full-time')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Part-time')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Probation')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Contract')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Commission')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Piecework')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Intern')
        },
        {
            'doctype': 'Employment Type',
            'employee_type_name': _('Apprentice')
        },

        # Stock Entry Type
        {
            'doctype': 'Stock Entry Type',
            'name': 'Material Issue',
            'purpose': 'Material Issue'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Material Receipt',
            'purpose': 'Material Receipt'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Material Transfer',
            'purpose': 'Material Transfer'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Manufacture',
            'purpose': 'Manufacture'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Repack',
            'purpose': 'Repack'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Send to Subcontractor',
            'purpose': 'Send to Subcontractor'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Material Transfer for Manufacture',
            'purpose': 'Material Transfer for Manufacture'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Material Consumption for Manufacture',
            'purpose': 'Material Consumption for Manufacture'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Send to Warehouse',
            'purpose': 'Send to Warehouse'
        },
        {
            'doctype': 'Stock Entry Type',
            'name': 'Receive at Warehouse',
            'purpose': 'Receive at Warehouse'
        },

        # Designation
        {
            'doctype': 'Designation',
            'designation_name': _('CEO')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Analyst')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Engineer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Accountant')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Secretary')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Associate')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Administrative Officer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Business Development Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('HR Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Project Manager')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Head of Marketing and Sales')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Software Developer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Designer')
        },
        {
            'doctype': 'Designation',
            'designation_name': _('Researcher')
        },

        # territory: with two default territories, one for home country and one named Rest of the World
        {
            'doctype': 'Territory',
            'territory_name': _('All Territories'),
            'is_group': 1,
            'name': _('All Territories'),
            'parent_territory': ''
        },
        {
            'doctype': 'Territory',
            'territory_name': country.replace("'", ""),
            'is_group': 0,
            'parent_territory': _('All Territories')
        },
        {
            'doctype': 'Territory',
            'territory_name': _("Rest Of The World"),
            'is_group': 0,
            'parent_territory': _('All Territories')
        },

        # customer group
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('All Customer Groups'),
            'is_group': 1,
            'name': _('All Customer Groups'),
            'parent_customer_group': ''
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Individual'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Commercial'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Non Profit'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },
        {
            'doctype': 'Customer Group',
            'customer_group_name': _('Government'),
            'is_group': 0,
            'parent_customer_group': _('All Customer Groups')
        },

        # supplier group
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('All Supplier Groups'),
            'is_group': 1,
            'name': _('All Supplier Groups'),
            'parent_supplier_group': ''
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Services'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Local'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Raw Material'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Electrical'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Hardware'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Pharmaceutical'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },
        {
            'doctype': 'Supplier Group',
            'supplier_group_name': _('Distributor'),
            'is_group': 0,
            'parent_supplier_group': _('All Supplier Groups')
        },

        # Sales Person
        {
            'doctype': 'Sales Person',
            'sales_person_name': _('Sales Team'),
            'is_group': 1,
            "parent_sales_person": ""
        },

        # Mode of Payment
        {
            'doctype':
            'Mode of Payment',
            'mode_of_payment':
            'Check' if country == "United States" else _('Cheque'),
            'type':
            'Bank'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Cash'),
            'type': 'Cash'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Credit Card'),
            'type': 'Bank'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Wire Transfer'),
            'type': 'Bank'
        },
        {
            'doctype': 'Mode of Payment',
            'mode_of_payment': _('Bank Draft'),
            'type': 'Bank'
        },

        # Activity Type
        {
            'doctype': 'Activity Type',
            'activity_type': _('Planning')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Research')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Proposal Writing')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Execution')
        },
        {
            'doctype': 'Activity Type',
            'activity_type': _('Communication')
        },
        {
            'doctype':
            "Item Attribute",
            "attribute_name":
            _("Size"),
            "item_attribute_values": [{
                "attribute_value": _("Extra Small"),
                "abbr": "XS"
            }, {
                "attribute_value": _("Small"),
                "abbr": "S"
            }, {
                "attribute_value": _("Medium"),
                "abbr": "M"
            }, {
                "attribute_value": _("Large"),
                "abbr": "L"
            }, {
                "attribute_value": _("Extra Large"),
                "abbr": "XL"
            }]
        },
        {
            'doctype':
            "Item Attribute",
            "attribute_name":
            _("Colour"),
            "item_attribute_values": [{
                "attribute_value": _("Red"),
                "abbr": "RED"
            }, {
                "attribute_value": _("Green"),
                "abbr": "GRE"
            }, {
                "attribute_value": _("Blue"),
                "abbr": "BLU"
            }, {
                "attribute_value": _("Black"),
                "abbr": "BLA"
            }, {
                "attribute_value": _("White"),
                "abbr": "WHI"
            }]
        },

        # Issue Priority
        {
            'doctype': 'Issue Priority',
            'name': _('Low')
        },
        {
            'doctype': 'Issue Priority',
            'name': _('Medium')
        },
        {
            'doctype': 'Issue Priority',
            'name': _('High')
        },

        #Job Applicant Source
        {
            'doctype': 'Job Applicant Source',
            'source_name': _('Website Listing')
        },
        {
            'doctype': 'Job Applicant Source',
            'source_name': _('Walk In')
        },
        {
            'doctype': 'Job Applicant Source',
            'source_name': _('Employee Referral')
        },
        {
            'doctype': 'Job Applicant Source',
            'source_name': _('Campaign')
        },
        {
            'doctype': "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Opportunity"
        },
        {
            'doctype': "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Issue"
        },
        {
            'doctype': "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Job Applicant"
        },
        {
            'doctype': "Party Type",
            "party_type": "Customer",
            "account_type": "Receivable"
        },
        {
            'doctype': "Party Type",
            "party_type": "Supplier",
            "account_type": "Payable"
        },
        {
            'doctype': "Party Type",
            "party_type": "Employee",
            "account_type": "Payable"
        },
        {
            'doctype': "Party Type",
            "party_type": "Member",
            "account_type": "Receivable"
        },
        {
            'doctype': "Party Type",
            "party_type": "Shareholder",
            "account_type": "Payable"
        },
        {
            'doctype': "Party Type",
            "party_type": "Student",
            "account_type": "Receivable"
        },
        {
            'doctype': "Opportunity Type",
            "name": "Hub"
        },
        {
            'doctype': "Opportunity Type",
            "name": _("Sales")
        },
        {
            'doctype': "Opportunity Type",
            "name": _("Support")
        },
        {
            'doctype': "Opportunity Type",
            "name": _("Maintenance")
        },
        {
            'doctype': "Project Type",
            "project_type": "Internal"
        },
        {
            'doctype': "Project Type",
            "project_type": "External"
        },
        {
            'doctype': "Project Type",
            "project_type": "Other"
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Date of Joining")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Annual Salary")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Probationary Period")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Employee Benefits")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Working Hours")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Stock Options")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Department")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Job Description")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Responsibilities")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Leaves per Year")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Notice Period")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Incentives")
        },
        {
            'doctype': "Print Heading",
            'print_heading': _("Credit Note")
        },
        {
            'doctype': "Print Heading",
            'print_heading': _("Debit Note")
        },

        # Assessment Group
        {
            'doctype': 'Assessment Group',
            'assessment_group_name': _('All Assessment Groups'),
            'is_group': 1,
            'parent_assessment_group': ''
        },

        # Share Management
        {
            "doctype": "Share Type",
            "title": _("Equity")
        },
        {
            "doctype": "Share Type",
            "title": _("Preference")
        },

        # Market Segments
        {
            "doctype": "Market Segment",
            "market_segment": _("Lower Income")
        },
        {
            "doctype": "Market Segment",
            "market_segment": _("Middle Income")
        },
        {
            "doctype": "Market Segment",
            "market_segment": _("Upper Income")
        },

        # Sales Stages
        {
            "doctype": "Sales Stage",
            "stage_name": _("Prospecting")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Qualification")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Needs Analysis")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Value Proposition")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Identifying Decision Makers")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Perception Analysis")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Proposal/Price Quote")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Negotiation/Review")
        }
    ]

    from erpnext.setup.setup_wizard.data.industry_type import get_industry_types
    records += [{
        "doctype": "Industry Type",
        "industry": d
    } for d in get_industry_types()]
    # records += [{"doctype":"Operation", "operation": d} for d in get_operations()]
    records += [{
        'doctype': 'Lead Source',
        'source_name': _(d)
    } for d in default_lead_sources]

    records += [{
        'doctype': 'Sales Partner Type',
        'sales_partner_type': _(d)
    } for d in default_sales_partner_type]

    base_path = frappe.get_app_path("erpnext", "hr", "doctype")
    response = frappe.read_file(
        os.path.join(
            base_path,
            "leave_application/leave_application_email_template.html"))

    records += [{'doctype': 'Email Template', 'name': _("Leave Approval Notification"), 'response': response,\
     'subject': _("Leave Approval Notification"), 'owner': frappe.session.user}]

    records += [{'doctype': 'Email Template', 'name': _("Leave Status Notification"), 'response': response,\
     'subject': _("Leave Status Notification"), 'owner': frappe.session.user}]

    base_path = frappe.get_app_path("erpnext", "stock", "doctype")
    response = frappe.read_file(
        os.path.join(base_path,
                     "delivery_trip/dispatch_notification_template.html"))

    records += [{'doctype': 'Email Template', 'name': _("Dispatch Notification"), 'response': response,\
     'subject': _("Your order is out for delivery!"), 'owner': frappe.session.user}]

    # Records for the Supplier Scorecard
    from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records

    make_default_records()
    make_records(records)
    set_up_address_templates(default_country=country)
    set_more_defaults()
    update_global_search_doctypes()
Ejemplo n.º 32
0
def install(country=None):
    records = [
        # domains
        {
            "doctype": "Domain",
            "domain": "Distribution"
        },
        {
            "doctype": "Domain",
            "domain": "Manufacturing"
        },
        {
            "doctype": "Domain",
            "domain": "Retail"
        },
        {
            "doctype": "Domain",
            "domain": "Services"
        },
        {
            "doctype": "Domain",
            "domain": "Education"
        },
        {
            "doctype": "Domain",
            "domain": "Healthcare"
        },
        {
            "doctype": "Domain",
            "domain": "Agriculture"
        },
        {
            "doctype": "Domain",
            "domain": "Non Profit"
        },
        # ensure at least an empty Address Template exists for this Country
        {
            "doctype": "Address Template",
            "country": country
        },
        # item group
        {
            "doctype": "Item Group",
            "item_group_name": _("All Item Groups"),
            "is_group": 1,
            "parent_item_group": "",
        },
        {
            "doctype": "Item Group",
            "item_group_name": _("Products"),
            "is_group": 0,
            "parent_item_group": _("All Item Groups"),
            "show_in_website": 1,
        },
        {
            "doctype": "Item Group",
            "item_group_name": _("Raw Material"),
            "is_group": 0,
            "parent_item_group": _("All Item Groups"),
        },
        {
            "doctype": "Item Group",
            "item_group_name": _("Services"),
            "is_group": 0,
            "parent_item_group": _("All Item Groups"),
        },
        {
            "doctype": "Item Group",
            "item_group_name": _("Sub Assemblies"),
            "is_group": 0,
            "parent_item_group": _("All Item Groups"),
        },
        {
            "doctype": "Item Group",
            "item_group_name": _("Consumable"),
            "is_group": 0,
            "parent_item_group": _("All Item Groups"),
        },
        # salary component
        {
            "doctype": "Salary Component",
            "salary_component": _("Income Tax"),
            "description": _("Income Tax"),
            "type": "Deduction",
            "is_income_tax_component": 1,
        },
        {
            "doctype": "Salary Component",
            "salary_component": _("Basic"),
            "description": _("Basic"),
            "type": "Earning",
        },
        {
            "doctype": "Salary Component",
            "salary_component": _("Arrear"),
            "description": _("Arrear"),
            "type": "Earning",
        },
        {
            "doctype": "Salary Component",
            "salary_component": _("Leave Encashment"),
            "description": _("Leave Encashment"),
            "type": "Earning",
        },
        # expense claim type
        {
            "doctype": "Expense Claim Type",
            "name": _("Calls"),
            "expense_type": _("Calls")
        },
        {
            "doctype": "Expense Claim Type",
            "name": _("Food"),
            "expense_type": _("Food")
        },
        {
            "doctype": "Expense Claim Type",
            "name": _("Medical"),
            "expense_type": _("Medical")
        },
        {
            "doctype": "Expense Claim Type",
            "name": _("Others"),
            "expense_type": _("Others")
        },
        {
            "doctype": "Expense Claim Type",
            "name": _("Travel"),
            "expense_type": _("Travel")
        },
        # leave type
        {
            "doctype": "Leave Type",
            "leave_type_name": _("Casual Leave"),
            "name": _("Casual Leave"),
            "allow_encashment": 1,
            "is_carry_forward": 1,
            "max_continuous_days_allowed": "3",
            "include_holiday": 1,
        },
        {
            "doctype": "Leave Type",
            "leave_type_name": _("Compensatory Off"),
            "name": _("Compensatory Off"),
            "allow_encashment": 0,
            "is_carry_forward": 0,
            "include_holiday": 1,
            "is_compensatory": 1,
        },
        {
            "doctype": "Leave Type",
            "leave_type_name": _("Sick Leave"),
            "name": _("Sick Leave"),
            "allow_encashment": 0,
            "is_carry_forward": 0,
            "include_holiday": 1,
        },
        {
            "doctype": "Leave Type",
            "leave_type_name": _("Privilege Leave"),
            "name": _("Privilege Leave"),
            "allow_encashment": 0,
            "is_carry_forward": 0,
            "include_holiday": 1,
        },
        {
            "doctype": "Leave Type",
            "leave_type_name": _("Leave Without Pay"),
            "name": _("Leave Without Pay"),
            "allow_encashment": 0,
            "is_carry_forward": 0,
            "is_lwp": 1,
            "include_holiday": 1,
        },
        # Employment Type
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Full-time")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Part-time")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Probation")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Contract")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Commission")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Piecework")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Intern")
        },
        {
            "doctype": "Employment Type",
            "employee_type_name": _("Apprentice")
        },
        # Stock Entry Type
        {
            "doctype": "Stock Entry Type",
            "name": "Material Issue",
            "purpose": "Material Issue"
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Material Receipt",
            "purpose": "Material Receipt"
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Material Transfer",
            "purpose": "Material Transfer"
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Manufacture",
            "purpose": "Manufacture"
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Repack",
            "purpose": "Repack"
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Send to Subcontractor",
            "purpose": "Send to Subcontractor",
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Material Transfer for Manufacture",
            "purpose": "Material Transfer for Manufacture",
        },
        {
            "doctype": "Stock Entry Type",
            "name": "Material Consumption for Manufacture",
            "purpose": "Material Consumption for Manufacture",
        },
        # Designation
        {
            "doctype": "Designation",
            "designation_name": _("CEO")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Manager")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Analyst")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Engineer")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Accountant")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Secretary")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Associate")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Administrative Officer")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Business Development Manager")
        },
        {
            "doctype": "Designation",
            "designation_name": _("HR Manager")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Project Manager")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Head of Marketing and Sales")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Software Developer")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Designer")
        },
        {
            "doctype": "Designation",
            "designation_name": _("Researcher")
        },
        # territory: with two default territories, one for home country and one named Rest of the World
        {
            "doctype": "Territory",
            "territory_name": _("All Territories"),
            "is_group": 1,
            "name": _("All Territories"),
            "parent_territory": "",
        },
        {
            "doctype": "Territory",
            "territory_name": country.replace("'", ""),
            "is_group": 0,
            "parent_territory": _("All Territories"),
        },
        {
            "doctype": "Territory",
            "territory_name": _("Rest Of The World"),
            "is_group": 0,
            "parent_territory": _("All Territories"),
        },
        # customer group
        {
            "doctype": "Customer Group",
            "customer_group_name": _("All Customer Groups"),
            "is_group": 1,
            "name": _("All Customer Groups"),
            "parent_customer_group": "",
        },
        {
            "doctype": "Customer Group",
            "customer_group_name": _("Individual"),
            "is_group": 0,
            "parent_customer_group": _("All Customer Groups"),
        },
        {
            "doctype": "Customer Group",
            "customer_group_name": _("Commercial"),
            "is_group": 0,
            "parent_customer_group": _("All Customer Groups"),
        },
        {
            "doctype": "Customer Group",
            "customer_group_name": _("Non Profit"),
            "is_group": 0,
            "parent_customer_group": _("All Customer Groups"),
        },
        {
            "doctype": "Customer Group",
            "customer_group_name": _("Government"),
            "is_group": 0,
            "parent_customer_group": _("All Customer Groups"),
        },
        # supplier group
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("All Supplier Groups"),
            "is_group": 1,
            "name": _("All Supplier Groups"),
            "parent_supplier_group": "",
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Services"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Local"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Raw Material"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Electrical"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Hardware"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Pharmaceutical"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        {
            "doctype": "Supplier Group",
            "supplier_group_name": _("Distributor"),
            "is_group": 0,
            "parent_supplier_group": _("All Supplier Groups"),
        },
        # Sales Person
        {
            "doctype": "Sales Person",
            "sales_person_name": _("Sales Team"),
            "is_group": 1,
            "parent_sales_person": "",
        },
        # Mode of Payment
        {
            "doctype":
            "Mode of Payment",
            "mode_of_payment":
            "Check" if country == "United States" else _("Cheque"),
            "type":
            "Bank",
        },
        {
            "doctype": "Mode of Payment",
            "mode_of_payment": _("Cash"),
            "type": "Cash"
        },
        {
            "doctype": "Mode of Payment",
            "mode_of_payment": _("Credit Card"),
            "type": "Bank"
        },
        {
            "doctype": "Mode of Payment",
            "mode_of_payment": _("Wire Transfer"),
            "type": "Bank"
        },
        {
            "doctype": "Mode of Payment",
            "mode_of_payment": _("Bank Draft"),
            "type": "Bank"
        },
        # Activity Type
        {
            "doctype": "Activity Type",
            "activity_type": _("Planning")
        },
        {
            "doctype": "Activity Type",
            "activity_type": _("Research")
        },
        {
            "doctype": "Activity Type",
            "activity_type": _("Proposal Writing")
        },
        {
            "doctype": "Activity Type",
            "activity_type": _("Execution")
        },
        {
            "doctype": "Activity Type",
            "activity_type": _("Communication")
        },
        {
            "doctype":
            "Item Attribute",
            "attribute_name":
            _("Size"),
            "item_attribute_values": [
                {
                    "attribute_value": _("Extra Small"),
                    "abbr": "XS"
                },
                {
                    "attribute_value": _("Small"),
                    "abbr": "S"
                },
                {
                    "attribute_value": _("Medium"),
                    "abbr": "M"
                },
                {
                    "attribute_value": _("Large"),
                    "abbr": "L"
                },
                {
                    "attribute_value": _("Extra Large"),
                    "abbr": "XL"
                },
            ],
        },
        {
            "doctype":
            "Item Attribute",
            "attribute_name":
            _("Colour"),
            "item_attribute_values": [
                {
                    "attribute_value": _("Red"),
                    "abbr": "RED"
                },
                {
                    "attribute_value": _("Green"),
                    "abbr": "GRE"
                },
                {
                    "attribute_value": _("Blue"),
                    "abbr": "BLU"
                },
                {
                    "attribute_value": _("Black"),
                    "abbr": "BLA"
                },
                {
                    "attribute_value": _("White"),
                    "abbr": "WHI"
                },
            ],
        },
        # Issue Priority
        {
            "doctype": "Issue Priority",
            "name": _("Low")
        },
        {
            "doctype": "Issue Priority",
            "name": _("Medium")
        },
        {
            "doctype": "Issue Priority",
            "name": _("High")
        },
        # Job Applicant Source
        {
            "doctype": "Job Applicant Source",
            "source_name": _("Website Listing")
        },
        {
            "doctype": "Job Applicant Source",
            "source_name": _("Walk In")
        },
        {
            "doctype": "Job Applicant Source",
            "source_name": _("Employee Referral")
        },
        {
            "doctype": "Job Applicant Source",
            "source_name": _("Campaign")
        },
        {
            "doctype": "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Opportunity"
        },
        {
            "doctype": "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Issue"
        },
        {
            "doctype": "Email Account",
            "email_id": "*****@*****.**",
            "append_to": "Job Applicant"
        },
        {
            "doctype": "Party Type",
            "party_type": "Customer",
            "account_type": "Receivable"
        },
        {
            "doctype": "Party Type",
            "party_type": "Supplier",
            "account_type": "Payable"
        },
        {
            "doctype": "Party Type",
            "party_type": "Employee",
            "account_type": "Payable"
        },
        {
            "doctype": "Party Type",
            "party_type": "Member",
            "account_type": "Receivable"
        },
        {
            "doctype": "Party Type",
            "party_type": "Shareholder",
            "account_type": "Payable"
        },
        {
            "doctype": "Party Type",
            "party_type": "Student",
            "account_type": "Receivable"
        },
        {
            "doctype": "Party Type",
            "party_type": "Donor",
            "account_type": "Receivable"
        },
        {
            "doctype": "Opportunity Type",
            "name": "Hub"
        },
        {
            "doctype": "Opportunity Type",
            "name": _("Sales")
        },
        {
            "doctype": "Opportunity Type",
            "name": _("Support")
        },
        {
            "doctype": "Opportunity Type",
            "name": _("Maintenance")
        },
        {
            "doctype": "Project Type",
            "project_type": "Internal"
        },
        {
            "doctype": "Project Type",
            "project_type": "External"
        },
        {
            "doctype": "Project Type",
            "project_type": "Other"
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Date of Joining")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Annual Salary")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Probationary Period")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Employee Benefits")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Working Hours")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Stock Options")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Department")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Job Description")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Responsibilities")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Leaves per Year")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Notice Period")
        },
        {
            "doctype": "Offer Term",
            "offer_term": _("Incentives")
        },
        {
            "doctype": "Print Heading",
            "print_heading": _("Credit Note")
        },
        {
            "doctype": "Print Heading",
            "print_heading": _("Debit Note")
        },
        # Assessment Group
        {
            "doctype": "Assessment Group",
            "assessment_group_name": _("All Assessment Groups"),
            "is_group": 1,
            "parent_assessment_group": "",
        },
        # Share Management
        {
            "doctype": "Share Type",
            "title": _("Equity")
        },
        {
            "doctype": "Share Type",
            "title": _("Preference")
        },
        # Market Segments
        {
            "doctype": "Market Segment",
            "market_segment": _("Lower Income")
        },
        {
            "doctype": "Market Segment",
            "market_segment": _("Middle Income")
        },
        {
            "doctype": "Market Segment",
            "market_segment": _("Upper Income")
        },
        # Sales Stages
        {
            "doctype": "Sales Stage",
            "stage_name": _("Prospecting")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Qualification")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Needs Analysis")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Value Proposition")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Identifying Decision Makers")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Perception Analysis")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Proposal/Price Quote")
        },
        {
            "doctype": "Sales Stage",
            "stage_name": _("Negotiation/Review")
        },
        # Warehouse Type
        {
            "doctype": "Warehouse Type",
            "name": "Transit"
        },
    ]

    from erpnext.setup.setup_wizard.data.industry_type import get_industry_types

    records += [{
        "doctype": "Industry Type",
        "industry": d
    } for d in get_industry_types()]
    # records += [{"doctype":"Operation", "operation": d} for d in get_operations()]
    records += [{
        "doctype": "Lead Source",
        "source_name": _(d)
    } for d in default_lead_sources]

    records += [{
        "doctype": "Sales Partner Type",
        "sales_partner_type": _(d)
    } for d in default_sales_partner_type]

    base_path = frappe.get_app_path("erpnext", "hr", "doctype")
    response = frappe.read_file(
        os.path.join(
            base_path,
            "leave_application/leave_application_email_template.html"))

    records += [{
        "doctype": "Email Template",
        "name": _("Leave Approval Notification"),
        "response": response,
        "subject": _("Leave Approval Notification"),
        "owner": frappe.session.user,
    }]

    records += [{
        "doctype": "Email Template",
        "name": _("Leave Status Notification"),
        "response": response,
        "subject": _("Leave Status Notification"),
        "owner": frappe.session.user,
    }]

    response = frappe.read_file(
        os.path.join(
            base_path,
            "interview/interview_reminder_notification_template.html"))

    records += [{
        "doctype": "Email Template",
        "name": _("Interview Reminder"),
        "response": response,
        "subject": _("Interview Reminder"),
        "owner": frappe.session.user,
    }]

    response = frappe.read_file(
        os.path.join(base_path,
                     "interview/interview_feedback_reminder_template.html"))

    records += [{
        "doctype": "Email Template",
        "name": _("Interview Feedback Reminder"),
        "response": response,
        "subject": _("Interview Feedback Reminder"),
        "owner": frappe.session.user,
    }]

    base_path = frappe.get_app_path("erpnext", "stock", "doctype")
    response = frappe.read_file(
        os.path.join(base_path,
                     "delivery_trip/dispatch_notification_template.html"))

    records += [{
        "doctype": "Email Template",
        "name": _("Dispatch Notification"),
        "response": response,
        "subject": _("Your order is out for delivery!"),
        "owner": frappe.session.user,
    }]

    # Records for the Supplier Scorecard
    from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records

    make_default_records()
    make_records(records)
    set_up_address_templates(default_country=country)
    set_more_defaults()
    update_global_search_doctypes()
Ejemplo n.º 33
0
def get_context(context):
	robots_txt = (
		frappe.db.get_single_value('Website Settings', 'robots_txt') or
		(frappe.local.conf.robots_txt and frappe.read_file(frappe.local.conf.robots_txt)) or '')

	return { 'robots_txt': robots_txt }