fixed conflict

This commit is contained in:
Nabin Hait 2015-02-17 11:12:04 +05:30
commit 6f0a3ed8d4
62 changed files with 1220 additions and 897 deletions

View File

@ -97,5 +97,7 @@ def get_charts_for_country(country):
with open(os.path.join(os.path.dirname(__file__), "syscohada_syscohada_chart_template.json"), "r") as f:
_get_chart_name(f.read())
charts.append("Standard")
if len(charts) > 1:
charts.append("Standard")
return charts

126
erpnext/config/crm.py Normal file
View File

@ -0,0 +1,126 @@
from frappe import _
def get_data():
return [
{
"label": _("Documents"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Lead",
"description": _("Database of potential customers."),
},
{
"type": "doctype",
"name": "Customer",
"description": _("Customer database."),
},
{
"type": "doctype",
"name": "Opportunity",
"description": _("Potential opportunities for selling."),
},
{
"type": "doctype",
"name": "Contact",
"description": _("All Contacts."),
},
{
"type": "doctype",
"name": "Newsletter",
"description": _("Newsletters to contacts, leads."),
},
]
},
{
"label": _("Tools"),
"icon": "icon-wrench",
"items": [
{
"type": "doctype",
"name": "SMS Center",
"description":_("Send mass SMS to your contacts"),
},
]
},
{
"label": _("Setup"),
"icon": "icon-cog",
"items": [
{
"type": "doctype",
"name": "Campaign",
"description": _("Sales campaigns."),
},
{
"type": "page",
"label": _("Customer Group"),
"name": "Sales Browser",
"icon": "icon-sitemap",
"link": "Sales Browser/Customer Group",
"description": _("Manage Customer Group Tree."),
"doctype": "Customer Group",
},
{
"type": "page",
"label": _("Territory"),
"name": "Sales Browser",
"icon": "icon-sitemap",
"link": "Sales Browser/Territory",
"description": _("Manage Territory Tree."),
"doctype": "Territory",
},
{
"type": "page",
"label": _("Sales Person"),
"name": "Sales Browser",
"icon": "icon-sitemap",
"link": "Sales Browser/Sales Person",
"description": _("Manage Sales Person Tree."),
"doctype": "Sales Person",
},
{
"type": "doctype",
"name": "SMS Settings",
"description": _("Setup SMS gateway settings")
},
]
},
{
"label": _("Main Reports"),
"icon": "icon-table",
"items": [
{
"type": "page",
"name": "sales-funnel",
"label": _("Sales Funnel"),
"icon": "icon-bar-chart",
},
]
},
{
"label": _("Standard Reports"),
"icon": "icon-list",
"items": [
{
"type": "report",
"is_query_report": True,
"name": "Lead Details",
"doctype": "Lead"
},
{
"type": "report",
"is_query_report": True,
"name": "Customer Addresses and Contacts",
"doctype": "Contact"
},
{
"type": "report",
"is_query_report": True,
"name": "Customers Not Buying Since Long Time",
"doctype": "Sales Order"
},
]
},
]

View File

@ -45,6 +45,11 @@ def get_data():
"icon": "octicon octicon-tag",
"type": "module"
},
"CRM": {
"color": "#EF4DB6",
"icon": "octicon octicon-broadcast",
"type": "module"
},
"Stock": {
"color": "#f39c12",
"icon": "icon-truck",

View File

@ -13,8 +13,8 @@ def get_data():
},
{
"type": "doctype",
"name": "Customer Issue",
"description": _("Customer Issue against Serial No."),
"name": "Warranty Claim",
"description": _("Warranty Claim against Serial No."),
},
{
"type": "doctype",

View File

@ -20,7 +20,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
docname = last_route.slice(2).join("/");
if(["Customer", "Quotation", "Sales Order", "Sales Invoice", "Delivery Note",
"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
"Installation Note", "Opportunity", "Warranty Claim", "Maintenance Visit",
"Maintenance Schedule"]
.indexOf(doctype)!==-1) {
var refdoc = frappe.get_doc(doctype, docname);

View File

@ -55,7 +55,7 @@ class SellingController(StockController):
self.update_if_missing(party_details)
elif getattr(self, "lead", None):
from erpnext.selling.doctype.lead.lead import get_lead_details
from erpnext.crm.doctype.lead.lead import get_lead_details
self.update_if_missing(get_lead_details(self.lead))
def set_price_list_and_item_details(self):

0
erpnext/crm/__init__.py Normal file
View File

View File

View File

@ -0,0 +1,9 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Lead(Document):
pass

View File

View File

@ -41,14 +41,14 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
create_customer: function() {
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.lead.lead.make_customer",
method: "erpnext.crm.doctype.lead.lead.make_customer",
frm: cur_frm
})
},
create_opportunity: function() {
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.lead.lead.make_opportunity",
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
frm: cur_frm
})
}

View File

@ -331,9 +331,9 @@
],
"icon": "icon-user",
"idx": 1,
"modified": "2015-02-05 05:11:40.379661",
"modified": "2015-02-16 23:54:10.622839",
"modified_by": "Administrator",
"module": "Selling",
"module": "CRM",
"name": "Lead",
"owner": "Administrator",
"permissions": [

View File

@ -10,7 +10,7 @@ test_records = frappe.get_test_records('Lead')
class TestLead(unittest.TestCase):
def test_make_customer(self):
from erpnext.selling.doctype.lead.lead import make_customer
from erpnext.crm.doctype.lead.lead import make_customer
frappe.delete_doc_if_exists("Customer", "_Test Lead")

View File

@ -7,12 +7,12 @@ frappe.ui.form.on_change("Opportunity", "customer_address", erpnext.utils.get_ad
frappe.ui.form.on_change("Opportunity", "contact_person", erpnext.utils.get_contact_details);
frappe.provide("erpnext.selling");
frappe.provide("erpnext.crm");
frappe.require("assets/erpnext/js/utils.js");
cur_frm.email_field = "contact_email";
// TODO commonify this code
erpnext.selling.Opportunity = frappe.ui.form.Controller.extend({
erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
onload: function() {
if(!this.frm.doc.enquiry_from && this.frm.doc.customer)
this.frm.doc.enquiry_from = "Customer";
@ -62,13 +62,13 @@ erpnext.selling.Opportunity = frappe.ui.form.Controller.extend({
create_quotation: function() {
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.opportunity.opportunity.make_quotation",
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
frm: cur_frm
})
}
});
$.extend(cur_frm.cscript, new erpnext.selling.Opportunity({frm: cur_frm}));
$.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
erpnext.toggle_naming_series();
@ -102,7 +102,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
cur_frm.cscript.lead = function(doc, cdt, cdn) {
cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
frappe.model.map_current_doc({
method: "erpnext.selling.doctype.lead.lead.make_opportunity",
method: "erpnext.crm.doctype.lead.lead.make_opportunity",
source_name: cur_frm.doc.lead,
frm: cur_frm
});

View File

@ -0,0 +1,436 @@
{
"allow_import": 1,
"autoname": "naming_series:",
"creation": "2013-03-07 18:50:30",
"description": "Potential Sales Deal",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"fields": [
{
"fieldname": "from_section",
"fieldtype": "Section Break",
"label": "From",
"options": "icon-user",
"permlevel": 0
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
"options": "OPTY-",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "enquiry_from",
"fieldtype": "Select",
"in_list_view": 0,
"label": "Opportunity From",
"oldfieldname": "enquiry_from",
"oldfieldtype": "Select",
"options": "\nLead\nCustomer",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1
},
{
"depends_on": "eval:doc.enquiry_from===\"Customer\"",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Customer",
"no_copy": 1,
"oldfieldname": "customer",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 0
},
{
"depends_on": "eval:doc.enquiry_from===\"Lead\"",
"fieldname": "lead",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Lead",
"oldfieldname": "lead",
"oldfieldtype": "Link",
"options": "Lead",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"label": "Customer / Lead Name",
"permlevel": 0,
"print_hide": 0,
"read_only": 1
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"fieldname": "enquiry_type",
"fieldtype": "Select",
"label": "Opportunity Type",
"oldfieldname": "enquiry_type",
"oldfieldtype": "Select",
"options": "\nSales\nMaintenance",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 0,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "Draft\nSubmitted\nQuotation\nLost\nCancelled\nReplied\nOpen",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"reqd": 1
},
{
"fieldname": "items_section",
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart",
"permlevel": 0,
"read_only": 0
},
{
"description": "Items which do not exist in Item master can also be entered on customer's request",
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
"oldfieldname": "enquiry_details",
"oldfieldtype": "Table",
"options": "Opportunity Item",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "fold",
"fieldtype": "Fold",
"permlevel": 0
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_info",
"fieldtype": "Section Break",
"label": "Contact Info",
"options": "icon-bullhorn",
"permlevel": 0,
"read_only": 0
},
{
"depends_on": "eval:doc.customer || doc.lead",
"fieldname": "customer_address",
"fieldtype": "Link",
"in_filter": 1,
"label": "Customer / Lead Address",
"options": "Address",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Address",
"oldfieldname": "address",
"oldfieldtype": "Small Text",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "customer",
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Territory",
"options": "Territory",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"depends_on": "customer",
"description": "",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Customer Group",
"oldfieldname": "customer_group",
"oldfieldtype": "Link",
"options": "Customer Group",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_person",
"fieldtype": "Link",
"in_filter": 1,
"label": "Contact Person",
"options": "Contact",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"depends_on": "customer",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"label": "Contact",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_email",
"fieldtype": "Small Text",
"label": "Contact Email",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_mobile",
"fieldtype": "Small Text",
"label": "Contact Mobile No",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
"options": "icon-file-text",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
"label": "Opportunity Date",
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"read_only": 0,
"reqd": 1,
"width": "50px"
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 1,
"search_index": 1
},
{
"fieldname": "source",
"fieldtype": "Select",
"label": "Source",
"oldfieldname": "source",
"oldfieldtype": "Select",
"options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
"permlevel": 0,
"read_only": 0
},
{
"description": "Enter name of campaign if source of enquiry is campaign",
"fieldname": "campaign",
"fieldtype": "Link",
"label": "Campaign",
"oldfieldname": "campaign",
"oldfieldtype": "Link",
"options": "Campaign",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "fiscal_year",
"fieldtype": "Link",
"in_filter": 1,
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 1,
"search_index": 1
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "order_lost_reason",
"fieldtype": "Text",
"label": "Lost Reason",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "column_break2",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"description": "Your sales person who will contact the customer in future",
"fieldname": "contact_by",
"fieldtype": "Link",
"in_filter": 1,
"label": "Next Contact By",
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"read_only": 0,
"width": "75px"
},
{
"description": "Your sales person will get a reminder on this date to contact the customer",
"fieldname": "contact_date",
"fieldtype": "Datetime",
"label": "Next Contact Date",
"oldfieldname": "contact_date",
"oldfieldtype": "Date",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "to_discuss",
"fieldtype": "Small Text",
"label": "To Discuss",
"no_copy": 1,
"oldfieldname": "to_discuss",
"oldfieldtype": "Small Text",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Data",
"options": "Opportunity",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"width": "150px"
}
],
"icon": "icon-info-sign",
"idx": 1,
"is_submittable": 1,
"modified": "2015-02-16 23:52:23.489259",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",
"owner": "Administrator",
"permissions": [
{
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"share": 1,
"submit": 1,
"write": 1
}
],
"search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "customer_name"
}

View File

@ -68,3 +68,8 @@ scheduler_events = {
default_mail_footer = """<div style="padding: 7px; text-align: right;">
<a style="color: #888; font-size: 80%;" href="https://erpnext.com">Sent via ERPNext</a></div>"""
get_translated_dict = {
("page", "setup-wizard"): "frappe.geo.country_info.get_translated_dict",
("doctype", "Global Defaults"): "frappe.geo.country_info.get_translated_dict"
}

View File

@ -185,7 +185,7 @@
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "company",
"options": "Company",
"permlevel": 0,
"precision": ""
},
@ -252,7 +252,7 @@
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"modified": "2015-02-05 05:11:35.113320",
"modified": "2015-02-13 14:58:32.967368",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",

View File

@ -1,10 +1,11 @@
Accounts
CRM
Buying
HR
Manufacturing
Projects
Selling
Setup
HR
Manufacturing
Stock
Support
Utilities

View File

@ -108,3 +108,6 @@ erpnext.patches.v5_0.remove_shopping_cart_app
erpnext.patches.v5_0.update_companywise_payment_account
erpnext.patches.v5_0.remove_birthday_events
erpnext.patches.v5_0.update_item_name_in_bom
execute:frappe.reload_doc('crm', 'doctype', 'lead')
execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
erpnext.patches.v5_0.rename_customer_issue

View File

@ -13,7 +13,7 @@ doctype_series_map = {
'Attendance': 'ATT-',
'C-Form': 'C-FORM-',
'Customer': 'CUST-',
'Customer Issue': 'CI-',
'Warranty Claim': 'CI-',
'Delivery Note': 'DN-',
'Installation Note': 'IN-',
'Item': 'ITEM-',

View File

@ -10,7 +10,7 @@ doctype_series_map = {
'Attendance': 'ATT-',
'C-Form': 'C-FORM-',
'Customer': 'CUST-',
'Customer Issue': 'CI-',
'Warranty Claim': 'CI-',
'Delivery Note': 'DN-',
'Installation Note': 'IN-',
'Item': 'ITEM-',

View File

@ -0,0 +1,5 @@
import frappe
def execute():
if frappe.db.table_exists("tabCustomer Issue"):
frappe.rename_doc("DocType", "Customer Issue", "Warrany Claim")

View File

@ -64,7 +64,7 @@ erpnext.feature_setup.feature_dict = {
'Stock Ledger Entry': {'fields':['batch_no']}
},
'fs_item_serial_nos': {
'Customer Issue': {'fields':['serial_no']},
'Warranty Claim': {'fields':['serial_no']},
'Delivery Note': {'items':['serial_no'],'packed_items':['serial_no']},
'Installation Note': {'items':['serial_no']},
'Item': {'fields':['has_serial_no']},
@ -155,7 +155,7 @@ erpnext.feature_setup.feature_dict = {
'Sales Order': {'fields':['sales_team']}
},
'fs_more_info': {
"Customer Issue": {"fields": ["more_info"]},
"Warranty Claim": {"fields": ["more_info"]},
'Material Request': {'fields':['more_info']},
'Lead': {'fields':['more_info']},
'Opportunity': {'fields':['more_info']},

View File

@ -1 +0,0 @@
Prospective customer / prospect database. List of all prospects that could be source of business.

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,9 +0,0 @@
frappe.listview_settings['Lead'] = {
add_fields: ["territory", "company_name", "status", "source"],
get_indicator: function(doc) {
var indicator = [__(doc.status), "darkgrey", "status,=," + doc.status];
if(doc.status==="Open") indicator[1] = "red";
if(doc.status==="Opportunity") indicator[1] = "green";
return indicator;
}
};

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,436 +0,0 @@
{
"allow_import": 1,
"autoname": "naming_series:",
"creation": "2013-03-07 18:50:30",
"description": "Potential Sales Deal",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"fields": [
{
"fieldname": "from_section",
"fieldtype": "Section Break",
"label": "From",
"options": "icon-user",
"permlevel": 0
},
{
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
"options": "OPTY-",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "enquiry_from",
"fieldtype": "Select",
"in_list_view": 0,
"label": "Opportunity From",
"oldfieldname": "enquiry_from",
"oldfieldtype": "Select",
"options": "\nLead\nCustomer",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1
},
{
"depends_on": "eval:doc.enquiry_from===\"Customer\"",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Customer",
"no_copy": 1,
"oldfieldname": "customer",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 0
},
{
"depends_on": "eval:doc.enquiry_from===\"Lead\"",
"fieldname": "lead",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Lead",
"oldfieldname": "lead",
"oldfieldtype": "Link",
"options": "Lead",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"label": "Customer / Lead Name",
"permlevel": 0,
"print_hide": 0,
"read_only": 1
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"fieldname": "enquiry_type",
"fieldtype": "Select",
"label": "Opportunity Type",
"oldfieldname": "enquiry_type",
"oldfieldtype": "Select",
"options": "\nSales\nMaintenance",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 0,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "Draft\nSubmitted\nQuotation\nLost\nCancelled\nReplied\nOpen",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"reqd": 1
},
{
"fieldname": "items_section",
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart",
"permlevel": 0,
"read_only": 0
},
{
"description": "Items which do not exist in Item master can also be entered on customer's request",
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
"oldfieldname": "enquiry_details",
"oldfieldtype": "Table",
"options": "Opportunity Item",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "fold",
"fieldtype": "Fold",
"permlevel": 0
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_info",
"fieldtype": "Section Break",
"label": "Contact Info",
"options": "icon-bullhorn",
"permlevel": 0,
"read_only": 0
},
{
"depends_on": "eval:doc.customer || doc.lead",
"fieldname": "customer_address",
"fieldtype": "Link",
"in_filter": 1,
"label": "Customer / Lead Address",
"options": "Address",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Address",
"oldfieldname": "address",
"oldfieldtype": "Small Text",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "customer",
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Territory",
"options": "Territory",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"depends_on": "customer",
"description": "",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Customer Group",
"oldfieldname": "customer_group",
"oldfieldtype": "Link",
"options": "Customer Group",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 0,
"search_index": 1
},
{
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0,
"read_only": 0
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_person",
"fieldtype": "Link",
"in_filter": 1,
"label": "Contact Person",
"options": "Contact",
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{
"depends_on": "customer",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"label": "Contact",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_email",
"fieldtype": "Small Text",
"label": "Contact Email",
"permlevel": 0,
"read_only": 1
},
{
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_mobile",
"fieldtype": "Small Text",
"label": "Contact Mobile No",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
"options": "icon-file-text",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
"label": "Opportunity Date",
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"read_only": 0,
"reqd": 1,
"width": "50px"
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 1,
"search_index": 1
},
{
"fieldname": "source",
"fieldtype": "Select",
"label": "Source",
"oldfieldname": "source",
"oldfieldtype": "Select",
"options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign\nWalk In",
"permlevel": 0,
"read_only": 0
},
{
"description": "Enter name of campaign if source of enquiry is campaign",
"fieldname": "campaign",
"fieldtype": "Link",
"label": "Campaign",
"oldfieldname": "campaign",
"oldfieldtype": "Link",
"options": "Campaign",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "fiscal_year",
"fieldtype": "Link",
"in_filter": 1,
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 1,
"search_index": 1
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "order_lost_reason",
"fieldtype": "Text",
"label": "Lost Reason",
"no_copy": 1,
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "column_break2",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"description": "Your sales person who will contact the customer in future",
"fieldname": "contact_by",
"fieldtype": "Link",
"in_filter": 1,
"label": "Next Contact By",
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"read_only": 0,
"width": "75px"
},
{
"description": "Your sales person will get a reminder on this date to contact the customer",
"fieldname": "contact_date",
"fieldtype": "Datetime",
"label": "Next Contact Date",
"oldfieldname": "contact_date",
"oldfieldtype": "Date",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "to_discuss",
"fieldtype": "Small Text",
"label": "To Discuss",
"no_copy": 1,
"oldfieldname": "to_discuss",
"oldfieldtype": "Small Text",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Data",
"options": "Opportunity",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"width": "150px"
}
],
"icon": "icon-info-sign",
"idx": 1,
"is_submittable": 1,
"modified": "2015-02-11 14:45:30.174431",
"modified_by": "Administrator",
"module": "Selling",
"name": "Opportunity",
"owner": "Administrator",
"permissions": [
{
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"share": 1,
"submit": 1,
"write": 1
}
],
"search_fields": "status,transaction_date,customer,lead,enquiry_type,territory,company",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "customer_name"
}

View File

@ -32,7 +32,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
cur_frm.add_custom_button(__('From Opportunity'),
function() {
frappe.model.map_current_doc({
method: "erpnext.selling.doctype.opportunity.opportunity.make_quotation",
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
source_doctype: "Opportunity",
get_query_filters: {
docstatus: 1,
@ -94,7 +94,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
lead: function() {
var me = this;
frappe.call({
method: "erpnext.selling.doctype.lead.lead.get_lead_details",
method: "erpnext.crm.doctype.lead.lead.get_lead_details",
args: { "lead": this.frm.doc.lead },
callback: function(r) {
if(r.message) {

View File

@ -149,7 +149,7 @@ def _make_customer(source_name, ignore_permissions=False):
customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name},
["name", "customer_name"], as_dict=True)
if not customer_name:
from erpnext.selling.doctype.lead.lead import _make_customer
from erpnext.crm.doctype.lead.lead import _make_customer
customer_doclist = _make_customer(lead_name, ignore_permissions=ignore_permissions)
customer = frappe.get_doc(customer_doclist)
customer.flags.ignore_permissions = ignore_permissions

View File

@ -17,7 +17,8 @@ content_sequence = [
"invoiced_amount", "payables"]],
["Bank Balance", ["bank_balance"]],
["Buying", ["new_purchase_requests", "new_supplier_quotations", "new_purchase_orders"]],
["Selling", ["new_leads", "new_enquiries", "new_quotations", "new_sales_orders"]],
["CRM", ["new_leads", "new_enquiries"]],
["Selling", ["new_quotations", "new_sales_orders"]],
["Stock", ["new_delivery_notes", "new_purchase_receipts", "new_stock_entries"]],
["Support", ["new_communications", "new_support_tickets", "open_tickets"]],
["Projects", ["new_projects"]],

View File

@ -12,6 +12,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root item group
cur_frm.set_intro("");
if(!doc.parent_item_group) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root item group and cannot be edited."), true);

View File

@ -8,6 +8,13 @@
"doctype": "DocType",
"document_type": "Master",
"fields": [
{
"fieldname": "gs",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "General Settings",
"permlevel": 0
},
{
"fieldname": "item_group_name",
"fieldtype": "Data",
@ -20,13 +27,6 @@
"reqd": 1,
"search_index": 0
},
{
"fieldname": "gs",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "General Settings",
"permlevel": 0
},
{
"description": "",
"fieldname": "parent_item_group",
@ -104,7 +104,7 @@
"in_list_view": 0,
"label": "Page Name",
"permlevel": 0,
"read_only": 1
"read_only": 0
},
{
"depends_on": "show_in_website",
@ -190,7 +190,7 @@
"in_create": 1,
"issingle": 0,
"max_attachments": 3,
"modified": "2015-02-05 05:11:39.844136",
"modified": "2015-02-16 23:50:48.113171",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",

View File

@ -34,6 +34,17 @@ class ItemGroup(NestedSet, WebsiteGenerator):
NestedSet.on_trash(self)
WebsiteGenerator.on_trash(self)
def set_parent_website_route(self):
"""Overwrite `parent_website_route` from `WebsiteGenerator`.
Only set `parent_website_route` if parent is visble.
e.g. If `show_in_website` is set for Products then url should be `/products`"""
if self.parent_item_group and frappe.db.get_value("Item Group",
self.parent_item_group, "show_in_website"):
super(WebsiteGenerator, self)()
else:
self.parent_website_route = ""
def validate_name_with_item(self):
if frappe.db.exists("Item", self.name):
frappe.throw(frappe._("An item exists with same name ({0}), please change the item group name or rename the item").format(self.name))

View File

@ -1,26 +1,70 @@
#page-setup-wizard {
position: fixed;
top: 0px; bottom: 0px;
left: 0px; right: 0px;
overflow: auto;
padding-top: 30px;
}
.setup-wizard-wrapper {
margin: 0px auto;
.setup-wizard-slide {
padding-left: 0px;
padding-right: 0px;
}
@media (min-width: 768px) {
.setup-wizard-wrapper {
width: 725px;
.setup-wizard-slide.single-column {
max-width: 500px;
}
.setup-wizard-slide.two-column {
max-width: 768px;
}
}
#page-setup-wizard .col-md-6 .control-input .btn {
width: 100%;
.setup-wizard-slide .lead {
margin-bottom: 10px;
}
#page-setup-wizard .form-section {
margin: 0px -15px;
padding: 0px;
max-width: 400px;
.setup-wizard-slide .form {
margin-top: 20px;
border: 1px solid #d1d8dd;
box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.1);
}
.setup-wizard-slide .footer {
margin: 20px auto;
}
.setup-wizard-progress {
border-bottom: 1px solid #d1d8dd;
padding-bottom: 15px;
margin: -20px auto 20px;
}
.setup-wizard-slide .icon-fixed-width {
vertical-align: middle;
}
.setup-wizard-slide .icon-circle-blank {
font-size: 7px;
}
.setup-wizard-slide .icon-circle {
font-size: 10px;
}
.setup-wizard-slide .frappe-control[data-fieldtype="Attach Image"] {
text-align: center;
}
.setup-wizard-slide .missing-image,
.setup-wizard-slide .attach-image-display {
display: block;
position: relative;
left: 50%;
transform: translate(-50%, 0);
-webkit-transform: translate(-50%, 0);
}
.setup-wizard-slide .missing-image .octicon {
position: relative;
top: 50%;
transform: translate(0px, -50%);
-webkit-transform: translate(0px, -50%);
}
.setup-wizard-message-image {
margin: 15px auto;
}

View File

@ -1,3 +1,5 @@
frappe.provide("erpnext.wiz");
frappe.pages['setup-wizard'].on_page_load = function(wrapper) {
if(sys_defaults.company) {
frappe.set_route("desktop");
@ -10,360 +12,36 @@ frappe.pages['setup-wizard'].on_page_load = function(wrapper) {
page_name: "setup-wizard",
parent: wrapper,
on_complete: function(wiz) {
var values = wiz.get_values();
wiz.show_working();
frappe.call({
method: "erpnext.setup.page.setup_wizard.setup_wizard.setup_account",
args: values,
callback: function(r) {
wiz.show_complete();
setTimeout(function() {
if(user==="Administrator") {
msgprint(__("Login with your new User ID") + ": " + values.email);
setTimeout(function() {
frappe.app.logout();
}, 2000);
} else {
window.location = "/desk";
}
}, 2000);
},
error: function(r) {
var d = msgprint(__("There were errors."));
d.custom_onhide = function() {
frappe.set_route(erpnext.wiz.page_name, "0");
};
}
})
erpnext.wiz.setup_account(wiz);
},
title: __("Welcome"),
working_html: function() { return '<h3 class="text-muted text-center"><i class="icon-refresh icon-spin"></i></h3>\
<h2 class="text-center">'+__('Setting up...')+'</h2>\
<p class="text-center">' +
__('Sit tight while your system is being setup. This may take a few moments.') +
'</p>' },
complete_html: function() { return '<h1 class="text-muted text-center"></h1>\
<h2 class="text-center">'+__('Setup Complete')+'</h2>\
<p class="text-center">' +
__('Your setup is complete. Refreshing...') +
'</p>'},
working_html: erpnext.wiz.working_html,
complete_html: erpnext.wiz.complete_html,
slides: [
// User
{
title: __("Select Your Language"),
icon: "icon-globe",
fields: [
{
"fieldname": "language", "label": __("Language"), "fieldtype": "Select",
reqd:1
},
],
help: "",
onload: function(slide) {
var me = this;
var select = slide.get_field("language");
if (!this.language_list) {
frappe.call({
method: "erpnext.setup.page.setup_wizard.setup_wizard.load_languages",
callback: function(r) {
me.language_list = r.message;
select.df.options = me.language_list;
select.set_input("english");
}
})
} else {
select.df.options = this.language_list;
select.refresh();
}
slide.get_input("language").on("change", function() {
var lang = $(this).val() || "english";
frappe._messages = {};
frappe.call({
method: "erpnext.setup.page.setup_wizard.setup_wizard.load_messages",
args: {
language: lang
},
callback: function(r) {
// re-render all slides
$.each(slide.wiz.slide_dict, function(key, s) {
s.make();
});
// select is re-made after language change
var select = slide.get_field("language");
select.set_input(lang);
}
})
});
}
},
{
title: __("The First User: You"),
icon: "icon-user",
fields: [
{"fieldname": "first_name", "label": __("First Name"), "fieldtype": "Data",
reqd:1},
{"fieldname": "last_name", "label": __("Last Name"), "fieldtype": "Data",
reqd:1},
{"fieldname": "email", "label": __("Email Id"), "fieldtype": "Data",
reqd:1, "description": __("Your Login Id"), "options":"Email"},
{"fieldname": "password", "label": __("Password"), "fieldtype": "Password",
reqd:1},
{fieldtype:"Attach Image", fieldname:"attach_user",
label: __("Attach Your Picture")},
],
help: __('The first user will become the System Manager (you can change that later).'),
onload: function(slide) {
if(user!=="Administrator") {
slide.form.fields_dict.password.$wrapper.toggle(false);
slide.form.fields_dict.email.$wrapper.toggle(false);
slide.form.fields_dict.first_name.set_input(frappe.boot.user.first_name);
slide.form.fields_dict.last_name.set_input(frappe.boot.user.last_name);
var user_image = frappe.get_cookie("user_image");
if(user_image) {
var $attach_user = slide.form.fields_dict.attach_user.$wrapper;
$attach_user.find(".missing-image").toggle(false);
$attach_user.find("img").attr("src", user_image).toggle(true);
}
delete slide.form.fields_dict.email;
delete slide.form.fields_dict.password;
}
}
},
// Country
{
title: __("Country, Timezone and Currency"),
icon: "icon-flag",
fields: [
{fieldname:'country', label: __('Country'), reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'currency', label: __('Default Currency'), reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'timezone', label: __('Time Zone'), reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
options: "", fieldtype: 'Select'}
],
help: __('Select your home country and check the timezone and currency.'),
onload: function(slide, form) {
frappe.call({
method:"frappe.geo.country_info.get_country_timezone_info",
callback: function(data) {
frappe.country_info = data.message.country_info;
frappe.all_timezones = data.message.all_timezones;
slide.get_input("country").empty()
.add_options([""].concat(keys(frappe.country_info).sort()));
slide.get_input("currency").empty()
.add_options(frappe.utils.unique([""].concat($.map(frappe.country_info,
function(opts, country) { return opts.currency; }))).sort());
slide.get_input("timezone").empty()
.add_options([""].concat(frappe.all_timezones));
}
})
slide.get_input("country").on("change", function() {
var country = slide.get_input("country").val();
var $timezone = slide.get_input("timezone");
$timezone.empty();
// add country specific timezones first
if(country){
var timezone_list = frappe.country_info[country].timezones || [];
$timezone.add_options(timezone_list.sort());
slide.get_field("currency").set_input(frappe.country_info[country].currency);
}
// add all timezones at the end, so that user has the option to change it to any timezone
$timezone.add_options([""].concat(frappe.all_timezones));
slide.get_field("timezone").set_input($timezone.val());
// temporarily set date format
frappe.boot.sysdefaults.date_format = (frappe.country_info[country].date_format
|| "dd-mm-yyyy");
// get country specific chart of accounts
frappe.call({
method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.get_charts_for_country",
args: {"country": country},
callback: function(r) {
if(r.message)
slide.get_input("chart_of_accounts").empty()
.add_options([""].concat(r.message));
}
})
});
}
},
// Organization
{
title: __("The Organization"),
icon: "icon-building",
fields: [
{fieldname:'company_name', label: __('Company Name'), fieldtype:'Data', reqd:1,
placeholder: __('e.g. "My Company LLC"')},
{fieldname:'company_abbr', label: __('Company Abbreviation'), fieldtype:'Data',
description: __('Max 5 characters'), placeholder: __('e.g. "MC"'), reqd:1},
{fieldname:'bank_account', label: __('Bank Account'), fieldtype:'Data',
placeholder: __('e.g. "XYZ National Bank"'), reqd:1 },
{fieldname:'fy_start_date', label:__('Financial Year Start Date'), fieldtype:'Date',
description: __('Your financial year begins on'), reqd:1},
{fieldname:'fy_end_date', label:__('Financial Year End Date'), fieldtype:'Date',
description: __('Your financial year ends on'), reqd:1},
{fieldname:'company_tagline', label: __('What does it do?'), fieldtype:'Data',
placeholder:__('e.g. "Build tools for builders"'), reqd:1},
],
help: __('The name of your company for which you are setting up this system.'),
onload: function(slide) {
slide.get_input("company_name").on("change", function() {
var parts = slide.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
slide.get_field("company_abbr").set_input(abbr.slice(0, 5).toUpperCase());
}).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
slide.get_input("company_abbr").on("change", function() {
if(slide.get_input("company_abbr").val().length > 5) {
msgprint("Company Abbreviation cannot have more than 5 characters");
slide.get_field("company_abbr").set_input("");
}
});
slide.get_input("fy_start_date").on("change", function() {
var year_end_date =
frappe.datetime.add_days(frappe.datetime.add_months(
frappe.datetime.user_to_obj(slide.get_input("fy_start_date").val()), 12), -1);
slide.get_field("fy_end_date").set_input(year_end_date);
});
}
},
// Logo
{
icon: "icon-bookmark",
title: __("Logo and Letter Heads"),
help: __('Upload your letter head and logo - you can edit them later.'),
fields: [
{fieldtype:"Attach Image", fieldname:"attach_letterhead",
label: __("Attach Letterhead"),
description: __("Keep it web friendly 900px (w) by 100px (h)")
},
{fieldtype:"Attach Image", fieldname:"attach_logo",
label:__("Attach Logo"),
description: __("100px by 100px")},
],
},
// Taxes
{
icon: "icon-money",
"title": __("Add Taxes"),
"help": __("List your tax heads (e.g. VAT, Excise; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<4; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i,
placeholder:__("e.g. VAT") + " " + i},
{fieldtype:"Column Break"},
{fieldtype:"Float", fieldname:"tax_rate_" + i, label:__("Rate (%)"), placeholder:__("e.g. 5")},
{fieldtype:"Section Break"},
]);
}
}
},
// Customers
{
icon: "icon-group",
"title": __("Your Customers"),
"help": __("List a few of your customers. They could be organizations or individuals."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<6; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Data", fieldname:"customer_" + i, label:__("Customer") + " " + i,
placeholder:__("Customer Name")},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_" + i,
label:__("Contact Name") + " " + i, placeholder:__("Contact Name")},
{fieldtype:"Section Break"}
])
}
}
},
// Suppliers
{
icon: "icon-group",
"title": __("Your Suppliers"),
"help": __("List a few of your suppliers. They could be organizations or individuals."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<6; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Data", fieldname:"supplier_" + i, label:__("Supplier")+" " + i,
placeholder:__("Supplier Name")},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_" + i,
label:__("Contact Name") + " " + i, placeholder:__("Contact Name")},
{fieldtype:"Section Break"}
])
}
}
},
// Items to Sell
{
icon: "icon-barcode",
"title": __("Your Products or Services"),
"help": __("List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<6; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Section Break", show_section_border: true},
{fieldtype:"Data", fieldname:"item_" + i, label:__("Item") + " " + i,
placeholder:__("A Product or Service")},
{fieldtype: "Check", fieldname: "is_sales_item_" + i, label:__("We sell this Item")},
{fieldtype: "Check", fieldname: "is_purchase_item_" + i, label:__("We buy this Item")},
{fieldtype:"Column Break"},
{fieldtype:"Select", label:__("Group"), fieldname:"item_group_" + i,
options:[__("Products"), __("Services"),
__("Raw Material"), __("Consumable"), __("Sub Assemblies")]},
{fieldtype:"Select", fieldname:"item_uom_" + i, label:__("UOM"),
options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"),
__("Hour"), __("Minute")]},
{fieldtype:"Attach", fieldname:"item_img_" + i, label:__("Attach Image")},
])
}
}
},
erpnext.wiz.welcome.slide,
erpnext.wiz.region.slide,
erpnext.wiz.user.slide,
erpnext.wiz.org.slide,
erpnext.wiz.branding.slide,
erpnext.wiz.taxes.slide,
erpnext.wiz.customers.slide,
erpnext.wiz.suppliers.slide,
erpnext.wiz.items.slide,
]
}
erpnext.wiz = new frappe.wiz.Wizard(wizard_settings)
erpnext.wiz.wizard = new erpnext.wiz.Wizard(wizard_settings)
}
frappe.pages['setup-wizard'].on_page_show = function(wrapper) {
if(frappe.get_route()[1])
erpnext.wiz.show(frappe.get_route()[1]);
if(frappe.get_route()[1]) {
erpnext.wiz.wizard.show(frappe.get_route()[1]);
}
}
frappe.provide("frappe.wiz");
frappe.wiz.Wizard = Class.extend({
erpnext.wiz.Wizard = Class.extend({
init: function(opts) {
$.extend(this, opts);
this.make();
@ -398,7 +76,7 @@ frappe.wiz.Wizard = Class.extend({
if(this.current_slide && this.current_slide.id===id)
return;
if(!this.slide_dict[id]) {
this.slide_dict[id] = new frappe.wiz.WizardSlide($.extend(this.slides[id], {wiz:this, id:id}));
this.slide_dict[id] = new erpnext.wiz.WizardSlide($.extend(this.slides[id], {wiz:this, id:id}));
this.slide_dict[id].make();
}
@ -422,7 +100,7 @@ frappe.wiz.Wizard = Class.extend({
}
});
frappe.wiz.WizardSlide = Class.extend({
erpnext.wiz.WizardSlide = Class.extend({
init: function(opts) {
$.extend(this, opts);
this.$wrapper = $("<div>")
@ -437,9 +115,15 @@ frappe.wiz.WizardSlide = Class.extend({
this.before_load(this);
}
this.$body = $(frappe.render_template("setup_wizard_page",
{help: __(this.help), title:__(this.title), main_title:__(this.wiz.title), step: this.id + 1 }))
.appendTo(this.$wrapper);
this.$body = $(frappe.render_template("setup_wizard_page", {
help: __(this.help),
title:__(this.title),
main_title:__(this.wiz.title),
step: this.id + 1,
name: this.name,
css_class: this.css_class || "",
slides_count: this.wiz.slides.length
})).appendTo(this.$wrapper);
this.body = this.$body.find(".form")[0];
@ -494,4 +178,431 @@ frappe.wiz.WizardSlide = Class.extend({
get_field: function(fn) {
return this.form.get_field(fn);
}
})
});
$.extend(erpnext.wiz, {
welcome: {
slide: {
name: "welcome",
title: __("Welcome to ERPNext"),
icon: "icon-world",
help: __("Let's prepare the system for first use."),
fields: [
{ fieldname: "language", label: __("Select Your Language"), reqd:1,
fieldtype: "Select" },
],
onload: function(slide) {
if (!erpnext.wiz.welcome.data) {
erpnext.wiz.welcome.load_languages(slide);
} else {
erpnext.wiz.welcome.setup_fields(slide);
}
},
css_class: "single-column"
},
load_languages: function(slide) {
frappe.call({
method: "erpnext.setup.page.setup_wizard.setup_wizard.load_languages",
callback: function(r) {
erpnext.wiz.welcome.data = r.message;
erpnext.wiz.welcome.setup_fields(slide);
slide.get_field("language")
.set_input(erpnext.wiz.welcome.data.default_language || "english");
}
});
},
setup_fields: function(slide) {
var select = slide.get_field("language");
select.df.options = erpnext.wiz.welcome.data.languages;
select.refresh();
erpnext.wiz.welcome.bind_events(slide);
},
bind_events: function(slide) {
slide.get_input("language").unbind("change").on("change", function() {
var lang = $(this).val() || "english";
frappe._messages = {};
frappe.call({
method: "erpnext.setup.page.setup_wizard.setup_wizard.load_messages",
args: {
language: lang
},
callback: function(r) {
// TODO save values!
// re-render all slides
$.each(slide.wiz.slide_dict, function(key, s) {
s.make();
});
// select is re-made after language change
var select = slide.get_field("language");
select.set_input(lang);
}
})
});
},
},
region: {
slide: {
title: __("Region"),
icon: "icon-flag",
help: __("Select your Country, Time Zone and Currency"),
fields: [
{ fieldname: "country", label: __("Country"), reqd:1,
fieldtype: "Select" },
{ fieldname: "timezone", label: __("Time Zone"), reqd:1,
fieldtype: "Select" },
{ fieldname: "currency", label: __("Currency"), reqd:1,
fieldtype: "Select" },
],
onload: function(slide) {
frappe.call({
method:"frappe.geo.country_info.get_country_timezone_info",
callback: function(data) {
erpnext.wiz.region.data = data.message;
erpnext.wiz.region.setup_fields(slide);
erpnext.wiz.region.bind_events(slide);
}
});
},
css_class: "single-column"
},
setup_fields: function(slide) {
var data = erpnext.wiz.region.data;
slide.get_input("country").empty()
.add_options([""].concat(keys(data.country_info).sort()));
slide.get_input("currency").empty()
.add_options(frappe.utils.unique([""].concat($.map(data.country_info,
function(opts, country) { return opts.currency; }))).sort());
slide.get_input("timezone").empty()
.add_options([""].concat(data.all_timezones));
if (data.default_country) {
slide.set_input("country", data.default_country);
}
},
bind_events: function(slide) {
slide.get_input("country").on("change", function() {
var country = slide.get_input("country").val();
var $timezone = slide.get_input("timezone");
var data = erpnext.wiz.region.data;
$timezone.empty();
// add country specific timezones first
if(country){
var timezone_list = data.country_info[country].timezones || [];
$timezone.add_options(timezone_list.sort());
slide.get_field("currency").set_input(data.country_info[country].currency);
}
// add all timezones at the end, so that user has the option to change it to any timezone
$timezone.add_options([""].concat(data.all_timezones));
slide.get_field("timezone").set_input($timezone.val());
// temporarily set date format
frappe.boot.sysdefaults.date_format = (data.country_info[country].date_format
|| "dd-mm-yyyy");
});
}
},
user: {
slide: {
title: __("The First User: You"),
icon: "icon-user",
fields: [
{"fieldname": "first_name", "label": __("First Name"), "fieldtype": "Data",
reqd:1},
{"fieldname": "last_name", "label": __("Last Name"), "fieldtype": "Data"},
{"fieldname": "email", "label": __("Email Address"), "fieldtype": "Data",
reqd:1, "description": __("You will use it to Login"), "options":"Email"},
{"fieldname": "password", "label": __("Password"), "fieldtype": "Password",
reqd:1},
{fieldtype:"Attach Image", fieldname:"attach_user",
label: __("Attach Your Picture")},
],
help: __('The first user will become the System Manager (you can change this later).'),
onload: function(slide) {
if(user!=="Administrator") {
slide.form.fields_dict.password.$wrapper.toggle(false);
slide.form.fields_dict.email.$wrapper.toggle(false);
slide.form.fields_dict.first_name.set_input(frappe.boot.user.first_name);
slide.form.fields_dict.last_name.set_input(frappe.boot.user.last_name);
var user_image = frappe.get_cookie("user_image");
if(user_image) {
var $attach_user = slide.form.fields_dict.attach_user.$wrapper;
$attach_user.find(".missing-image").toggle(false);
$attach_user.find("img").attr("src", user_image).toggle(true);
}
delete slide.form.fields_dict.email;
delete slide.form.fields_dict.password;
}
},
css_class: "single-column"
},
},
org: {
slide: {
title: __("The Organization"),
icon: "icon-building",
fields: [
{fieldname:'company_name', label: __('Company Name'), fieldtype:'Data', reqd:1,
placeholder: __('e.g. "My Company LLC"')},
{fieldname:'company_abbr', label: __('Company Abbreviation'), fieldtype:'Data',
description: __('Max 5 characters'), placeholder: __('e.g. "MC"'), reqd:1},
{fieldname:'company_tagline', label: __('What does it do?'), fieldtype:'Data',
placeholder:__('e.g. "Build tools for builders"'), reqd:1},
{fieldname:'bank_account', label: __('Bank Account'), fieldtype:'Data',
placeholder: __('e.g. "XYZ National Bank"'), reqd:1 },
{fieldname:'chart_of_accounts', label: __('Chart of Accounts'),
options: "", fieldtype: 'Select'},
// TODO remove this
{fieldtype: "Section Break"},
{fieldname:'fy_start_date', label:__('Financial Year Start Date'), fieldtype:'Date',
description: __('Your financial year begins on'), reqd:1},
{fieldname:'fy_end_date', label:__('Financial Year End Date'), fieldtype:'Date',
description: __('Your financial year ends on'), reqd:1},
],
help: __('The name of your company for which you are setting up this system.'),
onload: function(slide) {
erpnext.wiz.org.load_chart_of_accounts(slide);
erpnext.wiz.org.bind_events(slide);
},
css_class: "single-column"
},
load_chart_of_accounts: function(slide) {
var country = slide.wiz.get_values().country;
frappe.call({
method: "erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts.get_charts_for_country",
args: {"country": country},
callback: function(r) {
if(r.message) {
slide.get_input("chart_of_accounts").empty()
.add_options(r.message);
if (r.message.length===1) {
var field = slide.get_field("chart_of_accounts");
field.set_value(r.message[0]);
field.df.hidden = 1;
field.refresh();
}
}
}
})
},
bind_events: function(slide) {
slide.get_input("company_name").on("change", function() {
var parts = slide.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
slide.get_field("company_abbr").set_input(abbr.slice(0, 5).toUpperCase());
}).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
slide.get_input("company_abbr").on("change", function() {
if(slide.get_input("company_abbr").val().length > 5) {
msgprint("Company Abbreviation cannot have more than 5 characters");
slide.get_field("company_abbr").set_input("");
}
});
// TODO remove this
slide.get_input("fy_start_date").on("change", function() {
var year_end_date =
frappe.datetime.add_days(frappe.datetime.add_months(
frappe.datetime.user_to_obj(slide.get_input("fy_start_date").val()), 12), -1);
slide.get_input("fy_end_date").val(frappe.datetime.obj_to_user(year_end_date));
});
}
},
branding: {
slide: {
icon: "icon-bookmark",
title: __("The Brand"),
help: __('Upload your letter head and logo. (you can edit them later).'),
fields: [
{fieldtype:"Attach Image", fieldname:"attach_letterhead",
label: __("Attach Letterhead"),
description: __("Keep it web friendly 900px (w) by 100px (h)")
},
{fieldtype: "Column Break"},
{fieldtype:"Attach Image", fieldname:"attach_logo",
label:__("Attach Logo"),
description: __("100px by 100px")},
],
css_class: "two-column"
},
},
taxes: {
slide: {
icon: "icon-money",
"title": __("Add Taxes"),
"help": __("List your tax heads (e.g. VAT, Excise; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<4; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i,
placeholder:__("e.g. VAT") + " " + i},
{fieldtype:"Column Break"},
{fieldtype:"Float", fieldname:"tax_rate_" + i, label:__("Rate (%)"), placeholder:__("e.g. 5")},
]);
}
},
css_class: "two-column"
},
},
customers: {
slide: {
icon: "icon-group",
"title": __("Your Customers"),
"help": __("List a few of your customers. They could be organizations or individuals."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<6; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"customer_" + i, label:__("Customer") + " " + i,
placeholder:__("Customer Name")},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"customer_contact_" + i,
label:__("Contact Name") + " " + i, placeholder:__("Contact Name")}
])
}
},
css_class: "two-column"
},
},
suppliers: {
slide: {
icon: "icon-group",
"title": __("Your Suppliers"),
"help": __("List a few of your suppliers. They could be organizations or individuals."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<6; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Section Break"},
{fieldtype:"Data", fieldname:"supplier_" + i, label:__("Supplier")+" " + i,
placeholder:__("Supplier Name")},
{fieldtype:"Column Break"},
{fieldtype:"Data", fieldname:"supplier_contact_" + i,
label:__("Contact Name") + " " + i, placeholder:__("Contact Name")},
])
}
},
css_class: "two-column"
},
},
items: {
slide: {
icon: "icon-barcode",
"title": __("Your Products or Services"),
"help": __("List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
"fields": [],
before_load: function(slide) {
slide.fields = [];
for(var i=1; i<6; i++) {
slide.fields = slide.fields.concat([
{fieldtype:"Section Break", show_section_border: true},
{fieldtype:"Data", fieldname:"item_" + i, label:__("Item") + " " + i,
placeholder:__("A Product or Service")},
{fieldtype:"Select", label:__("Group"), fieldname:"item_group_" + i,
options:[__("Products"), __("Services"),
__("Raw Material"), __("Consumable"), __("Sub Assemblies")]},
{fieldtype:"Select", fieldname:"item_uom_" + i, label:__("UOM"),
options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"),
__("Hour"), __("Minute")]},
{fieldtype: "Check", fieldname: "is_sales_item_" + i, label:__("We sell this Item"), default: 1},
{fieldtype: "Check", fieldname: "is_purchase_item_" + i, label:__("We buy this Item")},
{fieldtype:"Column Break"},
{fieldtype:"Attach Image", fieldname:"item_img_" + i, label:__("Attach Image")},
])
}
},
css_class: "two-column"
},
},
working_html: function() {
return frappe.render_template("setup_wizard_message", {
image: "/assets/frappe/images/ui/bubble-tea-smile.svg",
title: __("Setting Up"),
message: __('Sit tight while your system is being setup. This may take a few moments.')
});
},
complete_html: function() {
return frappe.render_template("setup_wizard_message", {
image: "/assets/frappe/images/ui/bubble-tea-happy.svg",
title: __('Setup Complete'),
message: __('Your setup is complete. Refreshing.') + ".."
});
},
setup_account: function(wiz) {
var values = wiz.get_values();
wiz.show_working();
return frappe.call({
method: "erpnext.setup.page.setup_wizard.setup_wizard.setup_account",
args: values,
callback: function(r) {
wiz.show_complete();
setTimeout(function() {
if(user==="Administrator") {
msgprint(__("Login with your new User ID") + ": " + values.email);
setTimeout(function() {
frappe.app.logout();
}, 2000);
} else {
window.location = "/desk";
}
}, 2000);
},
error: function(r) {
var d = msgprint(__("There were errors."));
d.custom_onhide = function() {
frappe.set_route(erpnext.wiz.page_name, "0");
};
}
});
},
});

View File

@ -7,7 +7,8 @@ import frappe, json
from frappe.utils import cstr, flt, getdate
from frappe import _
from frappe.utils.file_manager import save_file
from frappe.translate import set_default_language, get_dict, get_lang_dict, send_translations
from frappe.translate import (set_default_language, get_dict,
get_lang_dict, send_translations, get_language_from_code)
from frappe.geo.country_info import get_country_info
from frappe.utils.nestedset import get_root_of
from default_website import website_maker
@ -443,4 +444,9 @@ def load_messages(language):
@frappe.whitelist()
def load_languages():
return sorted(get_lang_dict().keys())
from frappe.sessions import get_geo_from_ip
return {
"default_language": get_language_from_code(frappe.local.lang),
"languages": sorted(get_lang_dict().keys())
}

View File

@ -0,0 +1,7 @@
<div class="container setup-wizard-slide">
<img class="img-responsive setup-wizard-message-image" src="{%= image %}">
<p class="text-center lead">{%= title %}</p>
<p class="text-center">{%= message %}</p>
</div>

View File

@ -1,19 +1,21 @@
<div>
<h3>{%= title %}</h3>
<hr>
<div class="container setup-wizard-slide {%= css_class %}" data-slide-name="{%= name %}">
<div class="text-center setup-wizard-progress text-extra-muted">
{% for (var i=0; i < slides_count; i++) { %}
<i class="icon-fixed-width {% if (i+1==step) { %} icon-circle {% } else { %} icon-circle-blank {% } %}"></i>
{% } %}
</div>
<p class="text-center lead">{%= title %}</p>
<div class="row">
<div class="col-sm-12">
<p class="text-muted">{%= help %}</p><br>
{% if (help) { %} <p class="text-center">{%= help %}</p> {% } %}
<div class="form"></div>
</div>
</div>
<br>
<div class="footer">
<div class="footer text-center">
<div>
<a class="prev-btn hide btn btn-default btn-sm">{%= __("Previous") %}</a>
<a class="prev-btn hide grey small">{%= __("Previous") %}</a>
<a class="next-btn hide btn btn-primary btn-sm">{%= __("Next") %}</a>
<a class="complete-btn hide btn btn-primary btn-sm"><b>{%= __("Complete Setup") %}</b></a>
</div>
</div>
<br><br>
</div>

View File

@ -8,7 +8,7 @@ def get_notification_config():
return { "for_doctype":
{
"Issue": {"status":"Open"},
"Customer Issue": {"status":"Open"},
"Warranty Claim": {"status":"Open"},
"Task": {"status":"Open"},
"Lead": {"status":"Open"},
"Contact": {"status":"Open"},

View File

@ -135,7 +135,7 @@ class PurchaseReceipt(BuyingController):
pr_qty = flt(d.qty) * flt(d.conversion_factor)
if pr_qty:
val_rate_db_precision = 6 if cint(self.precision("valuation_rate")) <= 6 else 9
val_rate_db_precision = 6 if cint(self.precision("valuation_rate", d)) <= 6 else 9
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": flt(pr_qty),
"serial_no": cstr(d.serial_no).strip(),

View File

@ -1 +0,0 @@
Issue raised by Customer, can be tagged against Invoice, Serial Number to verify warranty, service contract.

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,6 +0,0 @@
[
{
"doctype": "Customer Issue",
"name": "_Test Customer Issue 1"
}
]

View File

@ -27,11 +27,11 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
}
})
}, "icon-download", "btn-default");
cur_frm.add_custom_button(__('From Customer Issue'),
cur_frm.add_custom_button(__('From Warranty Claim'),
function() {
frappe.model.map_current_doc({
method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
source_doctype: "Customer Issue",
source_doctype: "Warranty Claim",
get_query_filters: {
status: ["in", "Open, Work in Progress"],
customer: cur_frm.doc.customer || undefined,

View File

@ -24,7 +24,7 @@ class MaintenanceVisit(TransactionBase):
def update_customer_issue(self, flag):
for d in self.get('purposes'):
if d.prevdoc_docname and d.prevdoc_doctype == 'Customer Issue' :
if d.prevdoc_docname and d.prevdoc_doctype == 'Warranty Claim' :
if flag==1:
mntc_date = self.mntc_date
service_person = d.service_person
@ -48,11 +48,11 @@ class MaintenanceVisit(TransactionBase):
service_person = ''
work_done = ''
frappe.db.sql("update `tabCustomer Issue` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname))
frappe.db.sql("update `tabWarranty Claim` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname))
def check_if_last_visit(self):
"""check if last maintenance visit against same sales order/ customer issue"""
"""check if last maintenance visit against same sales order/ Warranty Claim"""
check_for_docname = None
for d in self.get('purposes'):
if d.prevdoc_docname:

View File

@ -0,0 +1,6 @@
[
{
"doctype": "Warranty Claim",
"name": "_Test Warranty Claim 1"
}
]

View File

@ -4,7 +4,7 @@
import frappe
import unittest
test_records = frappe.get_test_records('Customer Issue')
test_records = frappe.get_test_records('Warranty Claim')
class TestCustomerIssue(unittest.TestCase):
class TestWarrantyClaim(unittest.TestCase):
pass

View File

@ -4,14 +4,14 @@
frappe.provide("erpnext.support");
frappe.require("assets/erpnext/js/utils.js");
frappe.ui.form.on_change("Customer Issue", "customer", function(frm) {
frappe.ui.form.on_change("Warranty Claim", "customer", function(frm) {
erpnext.utils.get_party_details(frm) });
frappe.ui.form.on_change("Customer Issue", "customer_address",
frappe.ui.form.on_change("Warranty Claim", "customer_address",
erpnext.utils.get_address_display);
frappe.ui.form.on_change("Customer Issue", "contact_person",
frappe.ui.form.on_change("Warranty Claim", "contact_person",
erpnext.utils.get_contact_details);
erpnext.support.CustomerIssue = frappe.ui.form.Controller.extend({
erpnext.support.WarrantyClaim = frappe.ui.form.Controller.extend({
refresh: function() {
if((cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) {
cur_frm.add_custom_button(__('Make Maintenance Visit'),
@ -27,7 +27,7 @@ erpnext.support.CustomerIssue = frappe.ui.form.Controller.extend({
}
});
$.extend(cur_frm.cscript, new erpnext.support.CustomerIssue({frm: cur_frm}));
$.extend(cur_frm.cscript, new erpnext.support.WarrantyClaim({frm: cur_frm}));
cur_frm.cscript.onload = function(doc,cdt,cdn){
if(!doc.status)

View File

@ -387,7 +387,7 @@
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Data",
"options": "Customer Issue",
"options": "Warranty Claim",
"permlevel": 0,
"print_hide": 1,
"width": "150px"
@ -396,10 +396,10 @@
"icon": "icon-bug",
"idx": 1,
"is_submittable": 0,
"modified": "2015-02-05 05:11:36.857779",
"modified": "2015-02-17 00:12:52.430072",
"modified_by": "Administrator",
"module": "Support",
"name": "Customer Issue",
"name": "Warranty Claim",
"owner": "harshada@webnotestech.com",
"permissions": [
{

View File

@ -11,7 +11,7 @@ from frappe.utils import today
from erpnext.utilities.transaction_base import TransactionBase
class CustomerIssue(TransactionBase):
class WarrantyClaim(TransactionBase):
def get_feed(self):
return _("{0}: From {1}").format(self.status, self.customer_name)
@ -20,7 +20,7 @@ class CustomerIssue(TransactionBase):
frappe.throw(_("Customer is required"))
if self.status=="Closed" and \
frappe.db.get_value("Customer Issue", self.name, "status")!="Closed":
frappe.db.get_value("Warranty Claim", self.name, "status")!="Closed":
self.resolution_date = today()
def on_cancel(self):
@ -30,7 +30,7 @@ class CustomerIssue(TransactionBase):
(self.name))
if lst:
lst1 = ','.join([x[0] for x in lst])
frappe.throw(_("Cancel Material Visit {0} before cancelling this Customer Issue").format(lst1))
frappe.throw(_("Cancel Material Visit {0} before cancelling this Warranty Claim").format(lst1))
else:
frappe.db.set(self, 'status', 'Cancelled')
@ -51,14 +51,14 @@ def make_maintenance_visit(source_name, target_doc=None):
and t1.docstatus=1 and t1.completion_status='Fully Completed'""", source_name)
if not visit:
target_doc = get_mapped_doc("Customer Issue", source_name, {
"Customer Issue": {
target_doc = get_mapped_doc("Warranty Claim", source_name, {
"Warranty Claim": {
"doctype": "Maintenance Visit",
"field_map": {}
}
}, target_doc)
source_doc = frappe.get_doc("Customer Issue", source_name)
source_doc = frappe.get_doc("Warranty Claim", source_name)
if source_doc.get("item_code"):
table_map = {
"doctype": "Maintenance Visit Purpose",

View File

@ -1,4 +1,4 @@
frappe.listview_settings['Customer Issue'] = {
frappe.listview_settings['Warranty Claim'] = {
add_fields: ["status", "customer", "item_code"],
filters:[["status","=", "Open"]]
};

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cstr, now_datetime, cint
import frappe.share
from erpnext.controllers.status_updater import StatusUpdater
@ -36,7 +37,7 @@ class TransactionBase(StatusUpdater):
opts = frappe._dict(opts)
if self.contact_date:
event_doclist = frappe.get_doc({
event = frappe.get_doc({
"doctype": "Event",
"owner": opts.owner or self.owner,
"subject": opts.subject,
@ -48,12 +49,9 @@ class TransactionBase(StatusUpdater):
})
if frappe.db.exists("User", self.contact_by):
event_doclist.append("users", {
"doctype": "Event User",
"person": self.contact_by
})
frappe.share("Event", event.name, self.contact_by)
event_doclist.insert(ignore_permissions=True)
event.insert(ignore_permissions=True)
def validate_uom_is_integer(self, uom_field, qty_fields):
validate_uom_is_integer(self, uom_field, qty_fields)