2015-03-03 09:25:30 +00:00
|
|
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2014-04-18 10:30:41 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
|
2018-06-06 04:14:46 +00:00
|
|
|
import json
|
|
|
|
import os
|
2014-04-18 10:30:41 +00:00
|
|
|
|
2018-11-12 11:49:56 +00:00
|
|
|
import frappe
|
2014-04-18 10:30:41 +00:00
|
|
|
from frappe import _
|
2019-09-26 19:29:48 +00:00
|
|
|
from frappe.desk.doctype.global_search_settings.global_search_settings import (
|
|
|
|
update_global_search_doctypes,
|
2021-09-02 11:14:59 +00:00
|
|
|
)
|
2018-11-12 11:49:56 +00:00
|
|
|
from frappe.desk.page.setup_wizard.setup_wizard import make_records
|
|
|
|
from frappe.utils import cstr, getdate
|
2019-09-26 19:29:48 +00:00
|
|
|
from frappe.utils.nestedset import rebuild_tree
|
2014-04-18 10:30:41 +00:00
|
|
|
|
2020-04-08 03:26:57 +00:00
|
|
|
from erpnext.accounts.doctype.account.account import RootNotEditable
|
|
|
|
from erpnext.regional.address_template.setup import set_up_address_templates
|
|
|
|
|
2016-09-16 06:07:38 +00:00
|
|
|
default_lead_sources = [
|
|
|
|
"Existing Customer",
|
|
|
|
"Reference",
|
|
|
|
"Advertisement",
|
|
|
|
"Cold Calling",
|
|
|
|
"Exhibition",
|
|
|
|
"Supplier Reference",
|
|
|
|
"Mass Mailing",
|
|
|
|
"Customer's Vendor",
|
|
|
|
"Campaign",
|
|
|
|
"Walk In",
|
2022-03-28 13:22:46 +00:00
|
|
|
]
|
|
|
|
|
2018-06-11 09:23:25 +00:00
|
|
|
default_sales_partner_type = [
|
|
|
|
"Channel Partner",
|
|
|
|
"Distributor",
|
|
|
|
"Dealer",
|
2022-03-28 13:22:46 +00:00
|
|
|
"Agent",
|
2018-06-11 09:23:25 +00:00
|
|
|
"Retailer",
|
|
|
|
"Implementation Partner",
|
|
|
|
"Reseller",
|
2016-09-16 06:07:38 +00:00
|
|
|
]
|
|
|
|
|
2018-06-11 09:23:25 +00:00
|
|
|
|
2014-05-02 08:24:49 +00:00
|
|
|
def install(country=None):
|
2014-04-18 10:30:41 +00:00
|
|
|
records = [
|
2020-04-30 14:17:18 +00:00
|
|
|
# ensure at least an empty Address Template exists for this Country
|
2014-06-05 07:47:45 +00:00
|
|
|
{"doctype": "Address Template", "country": country},
|
2014-04-18 10:30:41 +00:00
|
|
|
# item group
|
2014-04-21 16:40:15 +00:00
|
|
|
{
|
|
|
|
"doctype": "Item Group",
|
|
|
|
"item_group_name": _("All Item Groups"),
|
2016-07-14 08:33:19 +00:00
|
|
|
"is_group": 1,
|
|
|
|
"parent_item_group": "",
|
|
|
|
},
|
2014-04-21 16:40:15 +00:00
|
|
|
{
|
|
|
|
"doctype": "Item Group",
|
|
|
|
"item_group_name": _("Products"),
|
2016-07-14 08:33:19 +00:00
|
|
|
"is_group": 0,
|
|
|
|
"parent_item_group": _("All Item Groups"),
|
|
|
|
"show_in_website": 1,
|
|
|
|
},
|
2014-04-21 16:40:15 +00:00
|
|
|
{
|
|
|
|
"doctype": "Item Group",
|
|
|
|
"item_group_name": _("Raw Material"),
|
2016-07-14 08:33:19 +00:00
|
|
|
"is_group": 0,
|
|
|
|
"parent_item_group": _("All Item Groups"),
|
|
|
|
},
|
2014-04-21 16:40:15 +00:00
|
|
|
{
|
|
|
|
"doctype": "Item Group",
|
|
|
|
"item_group_name": _("Services"),
|
2016-07-14 08:33:19 +00:00
|
|
|
"is_group": 0,
|
|
|
|
"parent_item_group": _("All Item Groups"),
|
|
|
|
},
|
2014-04-21 16:40:15 +00:00
|
|
|
{
|
|
|
|
"doctype": "Item Group",
|
|
|
|
"item_group_name": _("Sub Assemblies"),
|
2016-07-14 08:33:19 +00:00
|
|
|
"is_group": 0,
|
|
|
|
"parent_item_group": _("All Item Groups"),
|
|
|
|
},
|
2014-04-21 16:40:15 +00:00
|
|
|
{
|
|
|
|
"doctype": "Item Group",
|
|
|
|
"item_group_name": _("Consumable"),
|
2016-07-14 08:33:19 +00:00
|
|
|
"is_group": 0,
|
|
|
|
"parent_item_group": _("All Item Groups"),
|
|
|
|
},
|
2016-07-30 14:40:00 +00:00
|
|
|
# salary component
|
2020-06-19 13:47:57 +00:00
|
|
|
{
|
|
|
|
"doctype": "Salary Component",
|
|
|
|
"salary_component": _("Income Tax"),
|
|
|
|
"description": _("Income Tax"),
|
|
|
|
"type": "Deduction",
|
|
|
|
"is_income_tax_component": 1,
|
2016-12-15 05:57:35 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Salary Component",
|
|
|
|
"salary_component": _("Basic"),
|
|
|
|
"description": _("Basic"),
|
2017-02-09 08:43:35 +00:00
|
|
|
"type": "Earning",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Salary Component",
|
|
|
|
"salary_component": _("Arrear"),
|
|
|
|
"description": _("Arrear"),
|
|
|
|
"type": "Earning",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Salary Component",
|
|
|
|
"salary_component": _("Leave Encashment"),
|
|
|
|
"description": _("Leave Encashment"),
|
2018-11-12 11:49:56 +00:00
|
|
|
"type": "Earning",
|
2022-03-28 13:22:46 +00:00
|
|
|
},
|
2014-04-18 10:30:41 +00:00
|
|
|
# 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
|
2015-08-25 07:19:40 +00:00
|
|
|
{
|
|
|
|
"doctype": "Leave Type",
|
|
|
|
"leave_type_name": _("Casual Leave"),
|
|
|
|
"name": _("Casual Leave"),
|
2018-05-23 05:01:39 +00:00
|
|
|
"allow_encashment": 1,
|
|
|
|
"is_carry_forward": 1,
|
|
|
|
"max_continuous_days_allowed": "3",
|
|
|
|
"include_holiday": 1,
|
2015-08-25 07:19:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Leave Type",
|
|
|
|
"leave_type_name": _("Compensatory Off"),
|
|
|
|
"name": _("Compensatory Off"),
|
2019-10-21 08:12:17 +00:00
|
|
|
"allow_encashment": 0,
|
|
|
|
"is_carry_forward": 0,
|
|
|
|
"include_holiday": 1,
|
|
|
|
"is_compensatory": 1,
|
|
|
|
},
|
2015-08-25 07:19:40 +00:00
|
|
|
{
|
|
|
|
"doctype": "Leave Type",
|
|
|
|
"leave_type_name": _("Sick Leave"),
|
|
|
|
"name": _("Sick Leave"),
|
2018-05-11 14:40:07 +00:00
|
|
|
"allow_encashment": 0,
|
|
|
|
"is_carry_forward": 0,
|
|
|
|
"include_holiday": 1,
|
2015-08-25 07:19:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Leave Type",
|
|
|
|
"leave_type_name": _("Privilege Leave"),
|
|
|
|
"name": _("Privilege Leave"),
|
2018-05-11 14:40:07 +00:00
|
|
|
"allow_encashment": 0,
|
|
|
|
"is_carry_forward": 0,
|
|
|
|
"include_holiday": 1,
|
2015-08-25 07:19:40 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Leave Type",
|
|
|
|
"leave_type_name": _("Leave Without Pay"),
|
|
|
|
"name": _("Leave Without Pay"),
|
2018-05-11 14:40:07 +00:00
|
|
|
"allow_encashment": 0,
|
|
|
|
"is_carry_forward": 0,
|
|
|
|
"is_lwp": 1,
|
|
|
|
"include_holiday": 1,
|
|
|
|
},
|
2014-05-02 08:24:49 +00:00
|
|
|
# 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")},
|
2019-03-13 12:53:18 +00:00
|
|
|
# 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"},
|
2019-03-26 07:09:28 +00:00
|
|
|
{
|
|
|
|
"doctype": "Stock Entry Type",
|
|
|
|
"name": "Send to Subcontractor",
|
|
|
|
"purpose": "Send to Subcontractor",
|
|
|
|
},
|
2019-03-13 12:53:18 +00:00
|
|
|
{
|
|
|
|
"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",
|
|
|
|
},
|
2014-05-02 08:24:49 +00:00
|
|
|
# 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")},
|
2018-11-12 11:49:56 +00:00
|
|
|
# territory: with two default territories, one for home country and one named Rest of the World
|
2016-07-14 08:33:19 +00:00
|
|
|
{
|
|
|
|
"doctype": "Territory",
|
|
|
|
"territory_name": _("All Territories"),
|
|
|
|
"is_group": 1,
|
|
|
|
"name": _("All Territories"),
|
2018-11-19 09:31:25 +00:00
|
|
|
"parent_territory": "",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Territory",
|
|
|
|
"territory_name": country.replace("'", ""),
|
|
|
|
"is_group": 0,
|
|
|
|
"parent_territory": _("All Territories"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Territory",
|
|
|
|
"territory_name": _("Rest Of The World"),
|
2021-05-06 13:44:06 +00:00
|
|
|
"is_group": 0,
|
2018-11-12 11:49:56 +00:00
|
|
|
"parent_territory": _("All Territories"),
|
2022-03-28 13:22:46 +00:00
|
|
|
},
|
2014-04-18 10:30:41 +00:00
|
|
|
# customer group
|
2016-07-14 08:33:19 +00:00
|
|
|
{
|
|
|
|
"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"),
|
2021-05-06 13:44:06 +00:00
|
|
|
"is_group": 0,
|
2016-07-14 08:33:19 +00:00
|
|
|
"parent_customer_group": _("All Customer Groups"),
|
2022-03-28 13:22:46 +00:00
|
|
|
},
|
2018-04-19 13:07:29 +00:00
|
|
|
# supplier group
|
2018-04-20 05:37:19 +00:00
|
|
|
{
|
|
|
|
"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"),
|
2021-05-06 13:44:06 +00:00
|
|
|
"is_group": 0,
|
2018-04-20 05:37:19 +00:00
|
|
|
"parent_supplier_group": _("All Supplier Groups"),
|
2022-03-28 13:22:46 +00:00
|
|
|
},
|
2014-04-18 10:30:41 +00:00
|
|
|
# Sales Person
|
2016-07-14 08:33:19 +00:00
|
|
|
{
|
|
|
|
"doctype": "Sales Person",
|
|
|
|
"sales_person_name": _("Sales Team"),
|
|
|
|
"is_group": 1,
|
|
|
|
"parent_sales_person": "",
|
|
|
|
},
|
2014-05-02 08:24:49 +00:00
|
|
|
# Mode of Payment
|
2016-06-10 07:04:41 +00:00
|
|
|
{
|
|
|
|
"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"},
|
2014-05-02 08:24:49 +00:00
|
|
|
# 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")},
|
2015-02-20 14:39:42 +00:00
|
|
|
{
|
|
|
|
"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"},
|
|
|
|
],
|
|
|
|
},
|
2019-06-06 08:47:07 +00:00
|
|
|
# Issue Priority
|
|
|
|
{"doctype": "Issue Priority", "name": _("Low")},
|
|
|
|
{"doctype": "Issue Priority", "name": _("Medium")},
|
|
|
|
{"doctype": "Issue Priority", "name": _("High")},
|
2018-06-21 05:17:54 +00:00
|
|
|
# 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")},
|
2015-04-02 16:30:34 +00:00
|
|
|
{"doctype": "Email Account", "email_id": "sales@example.com", "append_to": "Opportunity"},
|
2015-01-23 09:52:13 +00:00
|
|
|
{"doctype": "Email Account", "email_id": "support@example.com", "append_to": "Issue"},
|
2015-04-01 09:43:15 +00:00
|
|
|
{"doctype": "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"},
|
2018-05-16 05:32:26 +00:00
|
|
|
{"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": "Shareholder", "account_type": "Payable"},
|
2017-11-16 11:33:52 +00:00
|
|
|
{"doctype": "Opportunity Type", "name": _("Sales")},
|
|
|
|
{"doctype": "Opportunity Type", "name": _("Support")},
|
|
|
|
{"doctype": "Opportunity Type", "name": _("Maintenance")},
|
2017-07-26 12:25:25 +00:00
|
|
|
{"doctype": "Project Type", "project_type": "Internal"},
|
|
|
|
{"doctype": "Project Type", "project_type": "External"},
|
|
|
|
{"doctype": "Project Type", "project_type": "Other"},
|
2015-04-01 09:43:15 +00:00
|
|
|
{"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")},
|
2015-08-25 07:19:40 +00:00
|
|
|
{"doctype": "Print Heading", "print_heading": _("Credit Note")},
|
2016-07-08 12:54:46 +00:00
|
|
|
{"doctype": "Print Heading", "print_heading": _("Debit Note")},
|
2018-02-12 06:02:47 +00:00
|
|
|
# Share Management
|
|
|
|
{"doctype": "Share Type", "title": _("Equity")},
|
2018-11-12 11:49:56 +00:00
|
|
|
{"doctype": "Share Type", "title": _("Preference")},
|
2018-11-20 18:14:13 +00:00
|
|
|
# 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")},
|
2020-08-12 12:25:02 +00:00
|
|
|
{"doctype": "Sales Stage", "stage_name": _("Negotiation/Review")},
|
|
|
|
# Warehouse Type
|
|
|
|
{"doctype": "Warehouse Type", "name": "Transit"},
|
2014-04-18 10:30:41 +00:00
|
|
|
]
|
|
|
|
|
2017-12-21 06:25:58 +00:00
|
|
|
from erpnext.setup.setup_wizard.data.industry_type import get_industry_types
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2015-09-07 04:41:23 +00:00
|
|
|
records += [{"doctype": "Industry Type", "industry": d} for d in get_industry_types()]
|
|
|
|
# records += [{"doctype":"Operation", "operation": d} for d in get_operations()]
|
2016-09-16 06:07:38 +00:00
|
|
|
records += [{"doctype": "Lead Source", "source_name": _(d)} for d in default_lead_sources]
|
|
|
|
|
2018-06-11 09:23:25 +00:00
|
|
|
records += [
|
|
|
|
{"doctype": "Sales Partner Type", "sales_partner_type": _(d)} for d in default_sales_partner_type
|
|
|
|
]
|
|
|
|
|
2018-04-20 04:58:52 +00:00
|
|
|
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")
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2018-04-20 04:58:52 +00:00
|
|
|
|
2021-10-01 07:45:40 +00:00
|
|
|
records += [
|
2022-03-28 13:22:46 +00:00
|
|
|
{
|
2021-10-01 07:45:40 +00:00
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Leave Approval Notification"),
|
|
|
|
"response": response,
|
2018-04-24 06:50:21 +00:00
|
|
|
"subject": _("Leave Approval Notification"),
|
|
|
|
"owner": frappe.session.user,
|
2022-03-28 13:22:46 +00:00
|
|
|
}
|
2018-04-24 06:50:21 +00:00
|
|
|
]
|
2018-04-20 04:58:52 +00:00
|
|
|
|
2021-10-01 07:45:40 +00:00
|
|
|
records += [
|
2022-03-28 13:22:46 +00:00
|
|
|
{
|
2021-10-01 07:45:40 +00:00
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Leave Status Notification"),
|
|
|
|
"response": response,
|
2018-04-24 06:50:21 +00:00
|
|
|
"subject": _("Leave Status Notification"),
|
|
|
|
"owner": frappe.session.user,
|
2022-03-28 13:22:46 +00:00
|
|
|
}
|
2018-04-24 06:50:21 +00:00
|
|
|
]
|
2018-04-20 04:58:52 +00:00
|
|
|
|
2021-10-01 07:45:40 +00:00
|
|
|
response = frappe.read_file(
|
|
|
|
os.path.join(base_path, "interview/interview_reminder_notification_template.html")
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2021-10-01 07:45:40 +00:00
|
|
|
|
|
|
|
records += [
|
2022-03-28 13:22:46 +00:00
|
|
|
{
|
2021-10-01 07:45:40 +00:00
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Interview Reminder"),
|
|
|
|
"response": response,
|
|
|
|
"subject": _("Interview Reminder"),
|
|
|
|
"owner": frappe.session.user,
|
2022-03-28 13:22:46 +00:00
|
|
|
}
|
2021-10-01 07:45:40 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
response = frappe.read_file(
|
|
|
|
os.path.join(base_path, "interview/interview_feedback_reminder_template.html")
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2021-10-01 07:45:40 +00:00
|
|
|
|
|
|
|
records += [
|
2022-03-28 13:22:46 +00:00
|
|
|
{
|
2021-10-01 07:45:40 +00:00
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Interview Feedback Reminder"),
|
|
|
|
"response": response,
|
|
|
|
"subject": _("Interview Feedback Reminder"),
|
|
|
|
"owner": frappe.session.user,
|
2022-03-28 13:22:46 +00:00
|
|
|
}
|
2021-10-01 07:45:40 +00:00
|
|
|
]
|
|
|
|
|
2021-12-05 11:36:29 +00:00
|
|
|
response = frappe.read_file(
|
|
|
|
os.path.join(base_path, "exit_interview/exit_questionnaire_notification_template.html")
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2021-12-05 11:36:29 +00:00
|
|
|
|
|
|
|
records += [
|
2022-03-28 13:22:46 +00:00
|
|
|
{
|
2021-12-05 11:36:29 +00:00
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Exit Questionnaire Notification"),
|
|
|
|
"response": response,
|
|
|
|
"subject": _("Exit Questionnaire Notification"),
|
|
|
|
"owner": frappe.session.user,
|
2022-03-28 13:22:46 +00:00
|
|
|
}
|
2021-12-05 11:36:29 +00:00
|
|
|
]
|
|
|
|
|
2018-09-30 16:08:47 +00:00
|
|
|
base_path = frappe.get_app_path("erpnext", "stock", "doctype")
|
|
|
|
response = frappe.read_file(
|
|
|
|
os.path.join(base_path, "delivery_trip/dispatch_notification_template.html")
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2018-09-30 16:08:47 +00:00
|
|
|
|
2021-10-01 07:45:40 +00:00
|
|
|
records += [
|
2022-03-28 13:22:46 +00:00
|
|
|
{
|
2021-10-01 07:45:40 +00:00
|
|
|
"doctype": "Email Template",
|
|
|
|
"name": _("Dispatch Notification"),
|
|
|
|
"response": response,
|
2018-09-30 16:08:47 +00:00
|
|
|
"subject": _("Your order is out for delivery!"),
|
|
|
|
"owner": frappe.session.user,
|
2022-03-28 13:22:46 +00:00
|
|
|
}
|
2018-09-30 16:08:47 +00:00
|
|
|
]
|
|
|
|
|
2017-07-24 17:12:30 +00:00
|
|
|
# Records for the Supplier Scorecard
|
|
|
|
from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import make_default_records
|
2020-04-30 14:17:18 +00:00
|
|
|
|
2017-07-24 17:12:30 +00:00
|
|
|
make_default_records()
|
2019-02-12 02:11:52 +00:00
|
|
|
make_records(records)
|
2020-04-08 03:26:57 +00:00
|
|
|
set_up_address_templates(default_country=country)
|
2018-11-12 11:49:56 +00:00
|
|
|
set_more_defaults()
|
2019-09-26 19:29:48 +00:00
|
|
|
update_global_search_doctypes()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2018-11-12 11:49:56 +00:00
|
|
|
def set_more_defaults():
|
|
|
|
# Do more setup stuff that can be done here with no dependencies
|
2021-05-06 13:44:06 +00:00
|
|
|
update_selling_defaults()
|
|
|
|
update_buying_defaults()
|
|
|
|
update_hr_defaults()
|
|
|
|
add_uom_data()
|
|
|
|
update_item_variant_settings()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def update_selling_defaults():
|
2018-05-15 08:22:46 +00:00
|
|
|
selling_settings = frappe.get_doc("Selling Settings")
|
2019-01-31 02:49:38 +00:00
|
|
|
selling_settings.cust_master_name = "Customer Name"
|
|
|
|
selling_settings.so_required = "No"
|
|
|
|
selling_settings.dn_required = "No"
|
|
|
|
selling_settings.allow_multiple_items = 1
|
|
|
|
selling_settings.sales_update_frequency = "Each Transaction"
|
2018-05-15 08:22:46 +00:00
|
|
|
selling_settings.save()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def update_buying_defaults():
|
2018-11-12 11:49:56 +00:00
|
|
|
buying_settings = frappe.get_doc("Buying Settings")
|
|
|
|
buying_settings.supp_master_name = "Supplier Name"
|
|
|
|
buying_settings.po_required = "No"
|
|
|
|
buying_settings.pr_required = "No"
|
|
|
|
buying_settings.maintain_same_rate = 1
|
|
|
|
buying_settings.allow_multiple_items = 1
|
|
|
|
buying_settings.save()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def update_hr_defaults():
|
2018-11-12 11:49:56 +00:00
|
|
|
hr_settings = frappe.get_doc("HR Settings")
|
|
|
|
hr_settings.emp_created_by = "Naming Series"
|
|
|
|
hr_settings.leave_approval_notification_template = _("Leave Approval Notification")
|
|
|
|
hr_settings.leave_status_notification_template = _("Leave Status Notification")
|
2021-10-01 07:45:40 +00:00
|
|
|
|
|
|
|
hr_settings.send_interview_reminder = 1
|
|
|
|
hr_settings.interview_reminder_template = _("Interview Reminder")
|
|
|
|
hr_settings.remind_before = "00:15:00"
|
|
|
|
|
|
|
|
hr_settings.send_interview_feedback_reminder = 1
|
|
|
|
hr_settings.feedback_reminder_notification_template = _("Interview Feedback Reminder")
|
|
|
|
|
2018-11-12 11:49:56 +00:00
|
|
|
hr_settings.save()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def update_item_variant_settings():
|
|
|
|
# set no copy fields of an item doctype to item variant settings
|
|
|
|
doc = frappe.get_doc("Item Variant Settings")
|
|
|
|
doc.set_default_fields()
|
|
|
|
doc.save()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2018-06-06 04:14:46 +00:00
|
|
|
def add_uom_data():
|
|
|
|
# add UOMs
|
|
|
|
uoms = json.loads(
|
|
|
|
open(frappe.get_app_path("erpnext", "setup", "setup_wizard", "data", "uom_data.json")).read()
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2018-06-06 04:14:46 +00:00
|
|
|
for d in uoms:
|
2018-07-27 07:24:34 +00:00
|
|
|
if not frappe.db.exists("UOM", _(d.get("uom_name"))):
|
|
|
|
uom_doc = frappe.get_doc(
|
|
|
|
{
|
|
|
|
"doctype": "UOM",
|
|
|
|
"uom_name": _(d.get("uom_name")),
|
|
|
|
"name": _(d.get("uom_name")),
|
2022-01-11 11:36:31 +00:00
|
|
|
"must_be_whole_number": d.get("must_be_whole_number"),
|
|
|
|
"enabled": 1,
|
2021-05-06 13:44:06 +00:00
|
|
|
}
|
|
|
|
).db_insert()
|
2018-06-06 04:14:46 +00:00
|
|
|
|
|
|
|
# bootstrap uom conversion factors
|
|
|
|
uom_conversions = json.loads(
|
|
|
|
open(
|
|
|
|
frappe.get_app_path("erpnext", "setup", "setup_wizard", "data", "uom_conversion_data.json")
|
|
|
|
).read()
|
2022-03-28 13:22:46 +00:00
|
|
|
)
|
2018-06-06 04:14:46 +00:00
|
|
|
for d in uom_conversions:
|
2018-07-27 07:24:34 +00:00
|
|
|
if not frappe.db.exists("UOM Category", _(d.get("category"))):
|
|
|
|
frappe.get_doc({"doctype": "UOM Category", "category_name": _(d.get("category"))}).db_insert()
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2020-05-25 09:24:19 +00:00
|
|
|
if not frappe.db.exists(
|
|
|
|
"UOM Conversion Factor", {"from_uom": _(d.get("from_uom")), "to_uom": _(d.get("to_uom"))}
|
|
|
|
):
|
|
|
|
uom_conversion = frappe.get_doc(
|
|
|
|
{
|
|
|
|
"doctype": "UOM Conversion Factor",
|
|
|
|
"category": _(d.get("category")),
|
|
|
|
"from_uom": _(d.get("from_uom")),
|
|
|
|
"to_uom": _(d.get("to_uom")),
|
|
|
|
"value": d.get("value"),
|
|
|
|
}
|
|
|
|
).insert(ignore_permissions=True)
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2018-06-06 04:14:46 +00:00
|
|
|
|
2018-12-12 05:20:54 +00:00
|
|
|
def add_market_segments():
|
|
|
|
records = [
|
|
|
|
# Market Segments
|
|
|
|
{"doctype": "Market Segment", "market_segment": _("Lower Income")},
|
|
|
|
{"doctype": "Market Segment", "market_segment": _("Middle Income")},
|
|
|
|
{"doctype": "Market Segment", "market_segment": _("Upper Income")},
|
|
|
|
]
|
|
|
|
|
|
|
|
make_records(records)
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2018-12-12 05:20:54 +00:00
|
|
|
def add_sale_stages():
|
|
|
|
# Sale Stages
|
|
|
|
records = [
|
|
|
|
{"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")},
|
|
|
|
]
|
2021-05-06 13:44:06 +00:00
|
|
|
for sales_stage in records:
|
|
|
|
frappe.get_doc(sales_stage).db_insert()
|
2018-12-12 05:20:54 +00:00
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2018-11-12 11:49:56 +00:00
|
|
|
def install_company(args):
|
|
|
|
records = [
|
|
|
|
# Fiscal Year
|
2019-05-14 10:51:09 +00:00
|
|
|
{
|
|
|
|
"doctype": "Fiscal Year",
|
|
|
|
"year": get_fy_details(args.fy_start_date, args.fy_end_date),
|
|
|
|
"year_start_date": args.fy_start_date,
|
|
|
|
"year_end_date": args.fy_end_date,
|
|
|
|
},
|
2018-11-12 11:49:56 +00:00
|
|
|
# Company
|
|
|
|
{
|
|
|
|
"doctype": "Company",
|
2018-11-28 05:14:33 +00:00
|
|
|
"company_name": args.company_name,
|
|
|
|
"enable_perpetual_inventory": 1,
|
|
|
|
"abbr": args.company_abbr,
|
|
|
|
"default_currency": args.currency,
|
|
|
|
"country": args.country,
|
2018-11-12 11:49:56 +00:00
|
|
|
"create_chart_of_accounts_based_on": "Standard Template",
|
2018-11-28 05:14:33 +00:00
|
|
|
"chart_of_accounts": args.chart_of_accounts,
|
2018-11-12 11:49:56 +00:00
|
|
|
"domain": args.domain,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2019-02-12 02:11:52 +00:00
|
|
|
make_records(records)
|
2018-11-12 11:49:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
def install_post_company_fixtures(args=None):
|
2018-05-15 08:22:46 +00:00
|
|
|
records = [
|
|
|
|
# Department
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("All Departments"),
|
|
|
|
"is_group": 1,
|
|
|
|
"parent_department": "",
|
2018-11-12 11:49:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Accounts"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Marketing"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Sales"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Purchase"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Operations"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Production"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Dispatch"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Customer Service"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Human Resources"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Management"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Quality Management"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Research & Development"),
|
|
|
|
"parent_department": _("All Departments"),
|
|
|
|
"company": args.company_name,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Department",
|
|
|
|
"department_name": _("Legal"),
|
|
|
|
"parent_department": _("All Departments"),
|
2021-07-05 11:38:27 +00:00
|
|
|
"company": args.company_name,
|
2022-03-28 13:22:46 +00:00
|
|
|
},
|
2018-11-20 18:08:19 +00:00
|
|
|
]
|
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
# Make root department with NSM updation
|
|
|
|
make_records(records[:1])
|
|
|
|
|
|
|
|
frappe.local.flags.ignore_update_nsm = True
|
|
|
|
make_records(records[1:])
|
|
|
|
frappe.local.flags.ignore_update_nsm = False
|
|
|
|
rebuild_tree("Department", "parent_department")
|
2018-11-12 11:49:56 +00:00
|
|
|
|
2018-11-28 05:14:33 +00:00
|
|
|
|
2018-11-20 18:08:19 +00:00
|
|
|
def install_defaults(args=None):
|
|
|
|
records = [
|
2018-11-12 11:49:56 +00:00
|
|
|
# Price Lists
|
|
|
|
{
|
|
|
|
"doctype": "Price List",
|
|
|
|
"price_list_name": _("Standard Buying"),
|
|
|
|
"enabled": 1,
|
|
|
|
"buying": 1,
|
|
|
|
"selling": 0,
|
|
|
|
"currency": args.currency,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"doctype": "Price List",
|
|
|
|
"price_list_name": _("Standard Selling"),
|
|
|
|
"enabled": 1,
|
|
|
|
"buying": 0,
|
|
|
|
"selling": 1,
|
|
|
|
"currency": args.currency,
|
2022-03-28 13:22:46 +00:00
|
|
|
},
|
2018-11-12 11:49:56 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
make_records(records)
|
|
|
|
|
|
|
|
# enable default currency
|
|
|
|
frappe.db.set_value("Currency", args.get("currency"), "enabled", 1)
|
2021-05-06 13:44:06 +00:00
|
|
|
frappe.db.set_value("Stock Settings", None, "email_footer_address", args.get("company_name"))
|
|
|
|
|
|
|
|
set_global_defaults(args)
|
|
|
|
update_stock_settings()
|
|
|
|
update_shopping_cart_settings(args)
|
2021-07-05 11:38:27 +00:00
|
|
|
|
|
|
|
args.update({"set_default": 1})
|
2021-05-06 13:44:06 +00:00
|
|
|
create_bank_account(args)
|
2018-11-12 11:49:56 +00:00
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def set_global_defaults(args):
|
2018-11-12 11:49:56 +00:00
|
|
|
global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
|
2018-11-13 07:48:08 +00:00
|
|
|
current_fiscal_year = frappe.get_all("Fiscal Year")[0]
|
|
|
|
|
2018-11-12 11:49:56 +00:00
|
|
|
global_defaults.update(
|
|
|
|
{
|
2018-11-13 07:48:08 +00:00
|
|
|
"current_fiscal_year": current_fiscal_year.name,
|
2018-11-12 11:49:56 +00:00
|
|
|
"default_currency": args.get("currency"),
|
|
|
|
"default_company": args.get("company_name"),
|
|
|
|
"country": args.get("country"),
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
global_defaults.save()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def update_stock_settings():
|
2018-11-12 11:49:56 +00:00
|
|
|
stock_settings = frappe.get_doc("Stock Settings")
|
|
|
|
stock_settings.item_naming_by = "Item Code"
|
|
|
|
stock_settings.valuation_method = "FIFO"
|
|
|
|
stock_settings.default_warehouse = frappe.db.get_value(
|
|
|
|
"Warehouse", {"warehouse_name": _("Stores")}
|
|
|
|
)
|
|
|
|
stock_settings.stock_uom = _("Nos")
|
|
|
|
stock_settings.auto_indent = 1
|
|
|
|
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
|
|
|
stock_settings.automatically_set_serial_nos_based_on_fifo = 1
|
|
|
|
stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1
|
|
|
|
stock_settings.save()
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2021-05-06 13:44:06 +00:00
|
|
|
def create_bank_account(args):
|
2021-06-23 07:47:01 +00:00
|
|
|
if not args.get("bank_account"):
|
2021-05-06 13:44:06 +00:00
|
|
|
return
|
|
|
|
|
2021-06-23 10:07:17 +00:00
|
|
|
company_name = args.get("company_name")
|
2021-05-06 13:44:06 +00:00
|
|
|
bank_account_group = frappe.db.get_value(
|
|
|
|
"Account", {"account_type": "Bank", "is_group": 1, "root_type": "Asset", "company": company_name}
|
|
|
|
)
|
|
|
|
if bank_account_group:
|
|
|
|
bank_account = frappe.get_doc(
|
|
|
|
{
|
|
|
|
"doctype": "Account",
|
2021-06-23 10:07:17 +00:00
|
|
|
"account_name": args.get("bank_account"),
|
2021-05-06 13:44:06 +00:00
|
|
|
"parent_account": bank_account_group,
|
|
|
|
"is_group": 0,
|
|
|
|
"company": company_name,
|
|
|
|
"account_type": "Bank",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
doc = bank_account.insert()
|
|
|
|
|
2021-07-05 11:38:27 +00:00
|
|
|
if args.get("set_default"):
|
|
|
|
frappe.db.set_value(
|
|
|
|
"Company",
|
|
|
|
args.get("company_name"),
|
|
|
|
"default_bank_account",
|
|
|
|
bank_account.name,
|
|
|
|
update_modified=False,
|
|
|
|
)
|
|
|
|
|
|
|
|
return doc
|
2021-05-06 13:44:06 +00:00
|
|
|
|
|
|
|
except RootNotEditable:
|
2021-06-23 10:07:17 +00:00
|
|
|
frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
|
2021-05-06 13:44:06 +00:00
|
|
|
except frappe.DuplicateEntryError:
|
|
|
|
# bank account same as a CoA entry
|
|
|
|
pass
|
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2022-02-02 07:28:31 +00:00
|
|
|
def update_shopping_cart_settings(args): # nosemgrep
|
2021-02-16 13:15:36 +00:00
|
|
|
shopping_cart = frappe.get_doc("E Commerce Settings")
|
2021-05-06 13:44:06 +00:00
|
|
|
shopping_cart.update(
|
|
|
|
{
|
|
|
|
"enabled": 1,
|
|
|
|
"company": args.company_name,
|
|
|
|
"price_list": frappe.db.get_value("Price List", {"selling": 1}),
|
|
|
|
"default_customer_group": _("Individual"),
|
|
|
|
"quotation_series": "QTN-",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
shopping_cart.update_single(shopping_cart.get_valid_dict())
|
2018-11-12 11:49:56 +00:00
|
|
|
|
2022-03-28 13:22:46 +00:00
|
|
|
|
2018-11-12 11:49:56 +00:00
|
|
|
def get_fy_details(fy_start_date, fy_end_date):
|
|
|
|
start_year = getdate(fy_start_date).year
|
|
|
|
if start_year == getdate(fy_end_date).year:
|
|
|
|
fy = cstr(start_year)
|
|
|
|
else:
|
|
|
|
fy = cstr(start_year) + "-" + cstr(start_year + 1)
|
|
|
|
return fy
|