[new-module] crm

This commit is contained in:
Rushabh Mehta 2015-02-17 10:36:54 +05:30
parent 36b84408a8
commit 60cfccbf77
30 changed files with 171 additions and 39 deletions

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

@ -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

@ -391,9 +391,9 @@
"icon": "icon-info-sign",
"idx": 1,
"is_submittable": 1,
"modified": "2015-02-05 05:11:41.732687",
"modified": "2015-02-16 23:52:23.489259",
"modified_by": "Administrator",
"module": "Selling",
"module": "CRM",
"name": "Opportunity",
"owner": "Administrator",
"permissions": [

View File

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

View File

@ -108,3 +108,5 @@ 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')

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

@ -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

@ -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",
@ -190,7 +190,7 @@
"in_create": 1,
"issingle": 0,
"max_attachments": 3,
"modified": "2015-02-16 05:44:59.435380",
"modified": "2015-02-16 23:50:48.113171",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",