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