brotherton-erpnext/erpnext/setup/setup_wizard/install_fixtures.py

275 lines
14 KiB
Python
Raw Normal View History

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
"Cold Calling", "Exhibition", "Supplier Reference", "Mass Mailing",
"Customer's Vendor", "Campaign", "Walk In"]
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')},
[domain] Healthcare (#10664) * Medical module for erpnext * Changes in core for Medical module * patient registration updated * fix - appointment invioce - fields missing * pages- indicator instead of bg-color * Lab Test field renamed service type * Department added Lab Test * procedure name in prescription * fixes sample collection * filter disabled patient * fix patient admission * updated patient age * availability check msg updated * fixes, removed procedure from invoice * sample print renamed * fixes, validation * service desk physician in filter * refactor scheduler * Appointment -field property - set only once = 1 * Appointment - Mark closed and pending buttons removed * Appointment - readonly = 1 if value set * Appointment - availabilty * Appointment - Cancel - info - cancel invoice * Appointment - set pending appointments * Dosage form - new DT * Drug Prescription - Dosage form added * Facility - Floor - removed from Fecility * Floor - removed * Lab Test Template - item creation validation * Procedure - Create Procedure * Procedure Appointment - new DT * Service Unit - Floor reference removed * Zone Fcilities - Unused DT removed * Appointment Desk - fixed * Service Desk - method pointing from procedure changed to procedure_appointment * Consultation print - got featured * Consultation - removed patient refernce to procedure prescription * Procedure Prescription - removed patient refernce * Lab Test - Changed field properties and value * Lab Test - field property changed * Lab Test - methods rewrite - lab test doc creation * Lab Test - create lab test from invoice and consultaion - got changed * Button History changed to Medical Record * Service Desk - Updated * Notification - Procedure Appointment * fix-get procedure prescription * fix field added to test prescription * msgprint on invoice creation * fix data on install * Merge branch erpnext/develop * fixes- minor * Setup wizard - Create Sensitivity * Appointment - Validate and Save if there is no schedule for Physician * Consultation - Button create vital signs and medical record * Review Type - New DocType * Review Detail and Treatment Plan - Childs - Consultation * Patient Medical Record - field Attach doc * Consultation - New Fields * Consultation - Manage new Fields - Medical record add action * Patient Relation - Child DocType - Patient * Patient - Patient Relation added * Patient - collapsible = 1 * Laboratory Settings - fields - message for lab test * Laboratory Settings - get message for lab test * SMS text for lab test and invoice test report * Procedure Stock Detail - Stock detail for Procedure and Template * Template Stage Detail - Stage detail for Procedure Template * Procedure Stage Detail - Stage detail for Procedure * Service Unit - field - warehouse * Scheduler - msg - content changed * Laboratory Settings - defualt - msg content * Invoice Test Report - msg print * Print Format-Changed-Consultation-Invoice Test Report-Lab Test * OP Settings - Expnse Account for Stock Entry in Procedure * Procedure and Procedure Template - Manage Stock Stage and Sample Collection * Procedure Appointment - Manage Stock and Stage * Lab Test - fixed - resource not find * Invoice Test Report - fixed - resource not find * Procedure - doc reload after insert * Patient Medical Record - fixed - refernce missed * Create Vital Signs -on client side * Rename module Medical to Healthcare * Remove In Patient (IP) Feature. * Rename - Procedure to Clinical Procedure * Remove spaces in Naming Series * Rename Duration to Drug Prescription Duration * Duration to Drug Prescription Duration * Merge All Settings to Healthcare Settings * Healthcare settings - import fixed * Procedure related documents are removed * Appointment Desk and Sevrvice Desk are removed * Consultation - minimal * Consultation - minimal * Consultation - minimal - patient detials in collapsible section * Message Print to Alerts * Patient - some fields removed * Patient - create consultation - message print to alerts * Consultation - show patient details updated * Setup wizard - Duration to Drug Prescritpion Duration * Healthcare Settings - patient registration - fee collection * Lab Test - Create Sales Invoice bug fixed * Healthcare menu rearranged * Healthcare Settings - Optimised and Rearragnged * Healthcare Settings - Expense account removed * Receivable account removed from patient * Patient - Optimised and Rearragnged * Removed Referring Physician * Healthcare Settings - bold headings removed * Physician - Patient - Fields are Segregated * Remove Service Unit * Remove - Service Type * Consultation invoice * Lab Test - invoice * Patient - Invoice * Rename Appointment to Patient Appointment * wip * Patient Dashboard, Physician Form cleanup * Dosage renamed to Prescription Dosage * Renamed Drug Prescription Duration to Prescription Duration * Patient Appointment booking modal * Patient Age - calculate by dob * Remove - scheduler * Consultation - Appointment to Patient Appointment * Patient Dashboard - rearranged * Patient Appointment * Removed rer_physician from lab test and consultation * Patient Appontment Changes * Appointment and Consultation - optimized * Patient Appointment - fee validity code optimized * Consultation and Patient Appointment - Invoice validate two side * fix: #13 remove relation to admission * Healthcare - Patient Portal * fix import error * domain Healthcare added on install * Removed - Invoice Test Report * Physician Schedule - menu * Consultation - patient details - re write * New Doctype-Medical Code * Consultation - Daignosis codification * Medical Code - Codification - Settings * Medical Code Standard - Medical Code - Codification - Settings * fix appointment calendar * fix appointment analytics * Menu Medical Code Standard * New Doctype - Medical Code Standard * Set Physician Role insted of IP Physician and OP Physician Role * fixed some json files * Medical code - permission to physician * Unused Childs - Work Schedule and User List - Removed * Label Procedure to Lab Test * Lab Test and Patient - code optimised * Add Item Groups - setup wizard * Healthcare Settings - add Role - Medical Administrator * Healthcare - Demo setup - Make Demo * Fee Validity - Logic Test * Test Fee Validity - Optimised * Healthcare Doctypes - Restricted to Domain Healthcare * Domainify - remove Healthcare Roles - Other Domains * Healthcare doctypes - beta checked * Codacy fixes * Codacy - fixes * Codacy - fixes * Codacy - fixes * Codacy - fixes * Codacy - fixes * Lab Test - print hide =1 for some fields * Consultation - Codification field label to Medical Coding * Codacy fixes - import frappe and etc. * Codacy fixes - import frappe in test_vital_signs * Codacy fixes * Codacy fixes * Codacy fixes and remove delete perm for patient * send_sms - import form frappe * Healthcare Settings * Lab Prescription - Consultation - Test Code - read_only = 0 * Portal fixes * Patient Appointment - filter physician - if has schedule * Physician - IP Charge - Removed * test - files * Web Form - Patient Profile - removed * Role Medical Administrator to Healthcare Administrator * WIP healthcare documentation * Coday - fixes * Travis - fixes * Lab Test Report - menu * Reorder Healthcare settings - group lab config to bottom * Sample Collection - New - allow Sample and patient Selection * Rate - similar behaviour and Label as in Item Standard Selling Rate * Healthcare documentation * Lab Test Samples to Lab Test sample * Commplaints to Complaint * Commplaints to Complaint * Antibiotics to Antibiotic * Appointment Token Number - remove * View - Medical record * Codacy fixes * update healthcare docs * Cleanup Docs - Search, quick entry, trsck change, etc. * [minor] ux changes
2017-09-13 07:22:30 +00:00
{ 'doctype': 'Domain', 'domain': _('Healthcare')},
# 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": '[]' }
]},
2014-06-05 07:47:45 +00:00
# address template
{'doctype':"Address Template", "country": country},
# item group
2014-04-21 16:40:15 +00:00
{'doctype': 'Item Group', 'item_group_name': _('All Item Groups'),
'is_group': 1, 'parent_item_group': ''},
2014-04-21 16:40:15 +00:00
{'doctype': 'Item Group', 'item_group_name': _('Products'),
'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'),
'is_group': 0, 'parent_item_group': _('All Item Groups') },
2014-04-21 16:40:15 +00:00
{'doctype': 'Item Group', 'item_group_name': _('Services'),
'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'),
'is_group': 0, 'parent_item_group': _('All Item Groups') },
2014-04-21 16:40:15 +00:00
{'doctype': 'Item Group', 'item_group_name': _('Consumable'),
'is_group': 0, 'parent_item_group': _('All Item Groups') },
2016-07-30 14:40:00 +00:00
# salary component
{'doctype': 'Salary Component', 'salary_component': _('Income Tax'), 'description': _('Income Tax'), 'type': 'Deduction'},
{'doctype': 'Salary Component', 'salary_component': _('Basic'), 'description': _('Basic'), 'type': 'Earning'},
2017-02-09 08:43:35 +00:00
{'doctype': 'Salary Component', 'salary_component': _('Arrear'), 'description': _('Arrear'), 'type': 'Earning'},
{'doctype': 'Salary Component', 'salary_component': _('Leave Encashment'), 'description': _('Leave Encashment'), 'type': 'Earning'},
2016-09-15 09:45:45 +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
{'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': _('Accounts')},
{'doctype': 'Department', 'department_name': _('Marketing')},
{'doctype': 'Department', 'department_name': _('Sales')},
{'doctype': 'Department', 'department_name': _('Purchase')},
{'doctype': 'Department', 'department_name': _('Operations')},
{'doctype': 'Department', 'department_name': _('Production')},
{'doctype': 'Department', 'department_name': _('Dispatch')},
{'doctype': 'Department', 'department_name': _('Customer Service')},
{'doctype': 'Department', 'department_name': _('Human Resources')},
{'doctype': 'Department', 'department_name': _('Management')},
{'doctype': 'Department', 'department_name': _('Quality Management')},
{'doctype': 'Department', 'department_name': _('Research & Development')},
{'doctype': 'Department', 'department_name': _('Legal')},
# 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
2014-05-16 18:37:45 +00:00
{'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')},
2016-06-10 07:04:41 +00:00
{'uom_name': _('Meter'), 'doctype': 'UOM', 'name': _('Meter')},
{'uom_name': _('Litre'), 'doctype': 'UOM', 'name': _('Litre')},
{'uom_name': _('Gram'), 'doctype': 'UOM', 'name': _('Gram')},
2014-05-16 18:37:45 +00:00
{'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
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'},
# 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"}
]},
2015-01-23 09:52:13 +00:00
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"},
{'doctype': "Party Type", "party_type": "Customer"},
{'doctype': "Party Type", "party_type": "Supplier"},
{'doctype': "Party Type", "party_type": "Employee"},
{'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")},
{'doctype': "Print Heading", 'print_heading': _("Credit Note")},
2016-07-08 12:54:46 +00:00
{'doctype': "Print Heading", 'print_heading': _("Debit Note")},
# Assessment Group
{'doctype': 'Assessment Group', 'assessment_group_name': _('All Assessment Groups'),
'is_group': 1, 'parent_assessment_group': ''},
]
2015-11-09 11:23:11 +00:00
from erpnext.setup.setup_wizard.industry_type import get_industry_types
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()]
records += [{'doctype': 'Lead Source', 'source_name': _(d)} for d in default_lead_sources]
# 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:
2014-06-05 07:47:45 +00:00
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()