Fixed Make Sales Order from Quotation #1522

This commit is contained in:
Anand Doshi 2014-04-24 12:40:19 +05:30
parent 78eeacb53c
commit 8c62c40a3d
2 changed files with 263 additions and 260 deletions

View File

@ -1,333 +1,333 @@
{ {
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2013-06-11 14:26:44.000000", "creation": "2013-06-11 14:26:44.000000",
"description": "Buyer of Goods and Services.", "description": "Buyer of Goods and Services.",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Master", "document_type": "Master",
"fields": [ "fields": [
{ {
"fieldname": "basic_info", "fieldname": "basic_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Basic Info", "label": "Basic Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-user", "options": "icon-user",
"permlevel": 0, "permlevel": 0,
"reqd": 0 "reqd": 0
}, },
{ {
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Series", "label": "Series",
"no_copy": 1, "no_copy": 1,
"options": "\nCUST\nCUSTMUM", "options": "\nCUST\nCUSTMUM",
"permlevel": 0, "permlevel": 0,
"print_hide": 0 "print_hide": 0
}, },
{ {
"fieldname": "customer_name", "fieldname": "customer_name",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Full Name", "label": "Full Name",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "customer_name", "oldfieldname": "customer_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "customer_type", "fieldname": "customer_type",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Type", "label": "Type",
"oldfieldname": "customer_type", "oldfieldname": "customer_type",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nCompany\nIndividual", "options": "\nCompany\nIndividual",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "lead_name", "fieldname": "lead_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"in_filter": 1, "in_filter": 1,
"label": "From Lead", "label": "From Lead",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "lead_name", "oldfieldname": "lead_name",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Lead", "options": "Lead",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"report_hide": 1 "report_hide": 1
}, },
{ {
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>", "description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>",
"fieldname": "customer_group", "fieldname": "customer_group",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"in_filter": 1, "in_filter": 1,
"label": "Group", "label": "Customer Group",
"oldfieldname": "customer_group", "oldfieldname": "customer_group",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Customer Group", "options": "Customer Group",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{ {
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>", "description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
"fieldname": "territory", "fieldname": "territory",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Territory", "label": "Territory",
"oldfieldname": "territory", "oldfieldname": "territory",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Territory", "options": "Territory",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "address_contacts", "fieldname": "address_contacts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Address & Contacts", "label": "Address & Contacts",
"options": "icon-map-marker", "options": "icon-map-marker",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "address_html", "fieldname": "address_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Address HTML", "label": "Address HTML",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "contact_html", "fieldname": "contact_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Contact HTML", "label": "Contact HTML",
"oldfieldtype": "HTML", "oldfieldtype": "HTML",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "communication_history", "fieldname": "communication_history",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Communication History", "label": "Communication History",
"options": "icon-comments", "options": "icon-comments",
"permlevel": 0, "permlevel": 0,
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "communication_html", "fieldname": "communication_html",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Communication HTML", "label": "Communication HTML",
"permlevel": 0, "permlevel": 0,
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-file-text", "options": "icon-file-text",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"description": "To create an Account Head under a different company, select the company and save customer.", "description": "To create an Account Head under a different company, select the company and save customer.",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"label": "Company", "label": "Company",
"oldfieldname": "company", "oldfieldname": "company",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{ {
"description": "Your Customer's TAX registration numbers (if applicable) or any general information", "description": "Your Customer's TAX registration numbers (if applicable) or any general information",
"fieldname": "customer_details", "fieldname": "customer_details",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Customer Details", "label": "Customer Details",
"oldfieldname": "customer_details", "oldfieldname": "customer_details",
"oldfieldtype": "Code", "oldfieldtype": "Code",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{ {
"fieldname": "default_currency", "fieldname": "default_currency",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Currency", "label": "Currency",
"no_copy": 1, "no_copy": 1,
"options": "Currency", "options": "Currency",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_price_list", "fieldname": "default_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Price List", "label": "Price List",
"options": "Price List", "options": "Price List",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_taxes_and_charges", "fieldname": "default_taxes_and_charges",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Taxes and Charges", "label": "Taxes and Charges",
"options": "Sales Taxes and Charges Master", "options": "Sales Taxes and Charges Master",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "credit_days", "fieldname": "credit_days",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Credit Days", "label": "Credit Days",
"oldfieldname": "credit_days", "oldfieldname": "credit_days",
"oldfieldtype": "Int", "oldfieldtype": "Int",
"permlevel": 1 "permlevel": 1
}, },
{ {
"fieldname": "credit_limit", "fieldname": "credit_limit",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Credit Limit", "label": "Credit Limit",
"oldfieldname": "credit_limit", "oldfieldname": "credit_limit",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 1 "permlevel": 1
}, },
{ {
"fieldname": "website", "fieldname": "website",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Website", "label": "Website",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "sales_team_section_break", "fieldname": "sales_team_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Sales Team", "label": "Sales Team",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "icon-group", "options": "icon-group",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_sales_partner", "fieldname": "default_sales_partner",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Sales Partner", "label": "Sales Partner",
"oldfieldname": "default_sales_partner", "oldfieldname": "default_sales_partner",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Sales Partner", "options": "Sales Partner",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_commission_rate", "fieldname": "default_commission_rate",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Commission Rate", "label": "Commission Rate",
"oldfieldname": "default_commission_rate", "oldfieldname": "default_commission_rate",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "sales_team", "fieldname": "sales_team",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Sales Team Details", "label": "Sales Team Details",
"oldfieldname": "sales_team", "oldfieldname": "sales_team",
"oldfieldtype": "Table", "oldfieldtype": "Table",
"options": "Sales Team", "options": "Sales Team",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "communications", "fieldname": "communications",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 1, "hidden": 1,
"label": "Communications", "label": "Communications",
"options": "Communication", "options": "Communication",
"permlevel": 0, "permlevel": 0,
"print_hide": 1 "print_hide": 1
} }
], ],
"icon": "icon-user", "icon": "icon-user",
"idx": 1, "idx": 1,
"modified": "2014-03-03 19:05:58.000000", "modified": "2014-03-03 19:06:00.000000",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Customer", "name": "Customer",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "amend": 0,
"cancel": 0, "cancel": 0,
"create": 1, "create": 1,
"delete": 0, "delete": 0,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Sales User", "role": "Sales User",
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{ {
"cancel": 0, "cancel": 0,
"delete": 0, "delete": 0,
"permlevel": 1, "permlevel": 1,
"read": 1, "read": 1,
"role": "Sales User" "role": "Sales User"
}, },
{ {
"amend": 0, "amend": 0,
"cancel": 0, "cancel": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"restrict": 1, "restrict": 1,
"role": "Sales Master Manager", "role": "Sales Master Manager",
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{ {
"cancel": 0, "cancel": 0,
"delete": 0, "delete": 0,
"permlevel": 1, "permlevel": 1,
"read": 1, "read": 1,
"role": "Sales Master Manager", "role": "Sales Master Manager",
"write": 1 "write": 1
} }
], ],
"search_fields": "customer_name,customer_group,territory" "search_fields": "customer_name,customer_group,territory"
} }

View File

@ -138,7 +138,8 @@ def _make_customer(source_name, ignore_permissions=False):
quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type"]) quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type"])
if quotation and quotation[0]: if quotation and quotation[0]:
lead_name = quotation[0] lead_name = quotation[0]
customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name}) customer_name = frappe.db.get_value("Customer", {"lead_name": lead_name},
["name", "customer_name"], as_dict=True)
if not customer_name: if not customer_name:
from erpnext.selling.doctype.lead.lead import _make_customer from erpnext.selling.doctype.lead.lead import _make_customer
customer_doclist = _make_customer(lead_name, ignore_permissions=ignore_permissions) customer_doclist = _make_customer(lead_name, ignore_permissions=ignore_permissions)
@ -162,3 +163,5 @@ def _make_customer(source_name, ignore_permissions=False):
except frappe.MandatoryError: except frappe.MandatoryError:
from frappe.utils import get_url_to_form from frappe.utils import get_url_to_form
frappe.throw(_("Please create Customer from Lead {0}").format(lead_name)) frappe.throw(_("Please create Customer from Lead {0}").format(lead_name))
else:
return customer_name