[buying] started cleanup, [mapper] started rewrite
This commit is contained in:
parent
bcff7dce8e
commit
8aded138c7
@ -53,6 +53,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
refresh: function(doc) {
|
||||||
|
this.frm.toggle_display("supplier_name",
|
||||||
|
(this.supplier_name && this.frm.doc.supplier_name!==this.frm.doc.supplier));
|
||||||
|
this._super();
|
||||||
|
},
|
||||||
|
|
||||||
supplier: function() {
|
supplier: function() {
|
||||||
if(this.frm.doc.supplier || this.frm.doc.credit_to) {
|
if(this.frm.doc.supplier || this.frm.doc.credit_to) {
|
||||||
if(!this.frm.doc.company) {
|
if(!this.frm.doc.company) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:39",
|
"creation": "2013-05-21 16:16:39",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-06-11 16:05:08",
|
"modified": "2013-07-04 10:48:54",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -39,6 +39,13 @@
|
|||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"name": "Purchase Order"
|
"name": "Purchase Order"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "supplier_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Supplier",
|
||||||
|
"options": "icon-user"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "To manage multiple series please go to Setup > Manage Series",
|
"description": "To manage multiple series please go to Setup > Manage Series",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -67,7 +74,6 @@
|
|||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "supplier_name",
|
"fieldname": "supplier_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@ -77,38 +83,34 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "address_display",
|
"fieldname": "address_display",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Address",
|
"label": "Address",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_display",
|
"fieldname": "contact_display",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Contact",
|
"label": "Contact",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_mobile",
|
"fieldname": "contact_mobile",
|
||||||
"fieldtype": "Text",
|
"fieldtype": "Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Mobile No",
|
"label": "Mobile No",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_email",
|
"fieldname": "contact_email",
|
||||||
"fieldtype": "Text",
|
"fieldtype": "Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Contact Email",
|
"label": "Contact Email",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
@ -139,7 +141,8 @@
|
|||||||
"fieldname": "items",
|
"fieldname": "items",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Items",
|
"label": "Items",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-shopping-cart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
@ -155,8 +158,7 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "sb_last_purchase",
|
"fieldname": "sb_last_purchase",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"options": "Simple"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -238,7 +240,8 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "price_list_and_currency",
|
"fieldname": "price_list_and_currency",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Currency & Price List"
|
"label": "Currency & Price List",
|
||||||
|
"options": "icon-tag"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -309,6 +312,7 @@
|
|||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Taxes",
|
"label": "Taxes",
|
||||||
"oldfieldtype": "Section Break",
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-money",
|
||||||
"print_hide": 0
|
"print_hide": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -364,7 +368,8 @@
|
|||||||
"fieldname": "totals",
|
"fieldname": "totals",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Totals",
|
"label": "Totals",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-money"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -523,7 +528,8 @@
|
|||||||
"fieldname": "terms_section_break",
|
"fieldname": "terms_section_break",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Terms and Conditions",
|
"label": "Terms and Conditions",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-legal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -555,7 +561,8 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_section",
|
"fieldname": "contact_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Contact Info"
|
"label": "Contact Info",
|
||||||
|
"options": "icon-bullhorn"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -759,8 +766,9 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "raw_material_details",
|
"fieldname": "raw_material_details",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Raw Material Details",
|
"label": "Raw Materials Supplied",
|
||||||
"oldfieldtype": "Section Break",
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-truck",
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,7 +45,7 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_dashboard = function(doc) {
|
cur_frm.cscript.make_dashboard = function(doc) {
|
||||||
cur_frm.dashboard.wrapper.empty().toggle(doc.__islocal ? false : true);
|
cur_frm.dashboard.reset();
|
||||||
if(doc.__islocal)
|
if(doc.__islocal)
|
||||||
return;
|
return;
|
||||||
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
|
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:11",
|
"creation": "2013-01-10 16:34:11",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-29 14:35:42",
|
"modified": "2013-07-04 10:13:19",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -46,7 +46,8 @@
|
|||||||
"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"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -91,7 +92,8 @@
|
|||||||
"fieldname": "address_contacts",
|
"fieldname": "address_contacts",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Address & Contacts",
|
"label": "Address & Contacts",
|
||||||
"oldfieldtype": "Column Break"
|
"oldfieldtype": "Column Break",
|
||||||
|
"options": "icon-map-marker"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.__islocal",
|
"depends_on": "eval:doc.__islocal",
|
||||||
@ -132,7 +134,9 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "communication_history",
|
"fieldname": "communication_history",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Communication History",
|
||||||
|
"options": "icon-comments"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -145,7 +149,8 @@
|
|||||||
"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"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Enter the company name under which Account Head will be created for this Supplier",
|
"description": "Enter the company name under which Account Head will be created for this Supplier",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:45",
|
"creation": "2013-05-21 16:16:45",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-06-11 16:05:53",
|
"modified": "2013-07-04 10:51:05",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -39,6 +39,13 @@
|
|||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"name": "Supplier Quotation"
|
"name": "Supplier Quotation"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "supplier_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Supplier",
|
||||||
|
"options": "icon-user"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "To manage multiple series please go to Setup > Manage Series",
|
"description": "To manage multiple series please go to Setup > Manage Series",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -67,7 +74,6 @@
|
|||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "supplier_name",
|
"fieldname": "supplier_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@ -77,38 +83,34 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "address_display",
|
"fieldname": "address_display",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Address",
|
"label": "Address",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_display",
|
"fieldname": "contact_display",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Contact",
|
"label": "Contact",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_mobile",
|
"fieldname": "contact_mobile",
|
||||||
"fieldtype": "Text",
|
"fieldtype": "Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Mobile No",
|
"label": "Mobile No",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "supplier",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_email",
|
"fieldname": "contact_email",
|
||||||
"fieldtype": "Text",
|
"fieldtype": "Text",
|
||||||
"hidden": 0,
|
"hidden": 1,
|
||||||
"label": "Contact Email",
|
"label": "Contact Email",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
@ -139,7 +141,8 @@
|
|||||||
"fieldname": "items",
|
"fieldname": "items",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Items",
|
"label": "Items",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-shopping-cart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
@ -155,8 +158,7 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "section_break0",
|
"fieldname": "section_break0",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"options": "Simple"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -168,8 +170,7 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "section_break_14",
|
"fieldname": "section_break_14",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"options": "Simple"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.",
|
"description": "You can make a purchase order from multiple Material Requests. Select Material Requests one by one and click on the button below.",
|
||||||
@ -197,7 +198,8 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "currency_price_list",
|
"fieldname": "currency_price_list",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Currency & Price List"
|
"label": "Currency & Price List",
|
||||||
|
"options": "icon-tag"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Supplier's currency",
|
"description": "Supplier's currency",
|
||||||
@ -264,7 +266,8 @@
|
|||||||
"fieldname": "taxes",
|
"fieldname": "taxes",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Taxes",
|
"label": "Taxes",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-money"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.",
|
"description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.",
|
||||||
@ -319,7 +322,8 @@
|
|||||||
"fieldname": "totals",
|
"fieldname": "totals",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Totals",
|
"label": "Totals",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-money"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -478,7 +482,8 @@
|
|||||||
"fieldname": "terms_section_break",
|
"fieldname": "terms_section_break",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Terms and Conditions",
|
"label": "Terms and Conditions",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-legal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
@ -512,7 +517,7 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "terms",
|
"fieldname": "terms",
|
||||||
"fieldtype": "Text Editor",
|
"fieldtype": "Text Editor",
|
||||||
"label": "Terms and Conditions1",
|
"label": "Terms and Conditions",
|
||||||
"oldfieldname": "terms",
|
"oldfieldname": "terms",
|
||||||
"oldfieldtype": "Text Editor"
|
"oldfieldtype": "Text Editor"
|
||||||
},
|
},
|
||||||
@ -521,7 +526,8 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "contact_section",
|
"fieldname": "contact_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Contact Info"
|
"label": "Contact Info",
|
||||||
|
"options": "icon-bullhorn"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -546,7 +552,8 @@
|
|||||||
"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"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -585,6 +592,11 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"report_hide": 0
|
"report_hide": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "column_break_57",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Select the relevant company name if you have multiple companies",
|
"description": "Select the relevant company name if you have multiple companies",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
|||||||
@ -99,38 +99,10 @@ erpnext.LeadController = wn.ui.form.Controller.extend({
|
|||||||
$.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm}));
|
$.extend(cur_frm.cscript, new erpnext.LeadController({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.cscript['Create Customer'] = function(){
|
cur_frm.cscript['Create Customer'] = function(){
|
||||||
var doc = cur_frm.doc;
|
wn.model.open_mapped_doc({
|
||||||
$c('runserverobj',args={ 'method':'check_status', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
method: "selling.doctype.lead.lead.make_customer",
|
||||||
function(r,rt){
|
source_name: cur_frm.doc.name
|
||||||
if(r.message == 'Converted'){
|
})
|
||||||
msgprint("This lead is already converted to customer");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
n = wn.model.make_new_doc_and_get_name("Customer");
|
|
||||||
$c('dt_map', args={
|
|
||||||
'docs':wn.model.compress([locals["Customer"][n]]),
|
|
||||||
'from_doctype':'Lead',
|
|
||||||
'to_doctype':'Customer',
|
|
||||||
'from_docname':doc.name,
|
|
||||||
'from_to_list':"[['Lead', 'Customer']]"
|
|
||||||
},
|
|
||||||
function(r,rt) {
|
|
||||||
wn.model.with_doctype("Customer", function() {
|
|
||||||
var customer = wn.model.get_doc("Customer", n);
|
|
||||||
var customer_copy = $.extend({}, customer);
|
|
||||||
|
|
||||||
var updated = wn.model.set_default_values(customer_copy);
|
|
||||||
$.each(updated, function(i, f) {
|
|
||||||
if(!customer[f]) customer[f] = customer_copy[f];
|
|
||||||
});
|
|
||||||
|
|
||||||
loaddoc("Customer", n);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create New Opportunity
|
// Create New Opportunity
|
||||||
|
|||||||
@ -96,3 +96,23 @@ class DocType(SellingController):
|
|||||||
self.doc.name)
|
self.doc.name)
|
||||||
|
|
||||||
self.delete_events()
|
self.delete_events()
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def make_customer(source_name, target_doclist=None):
|
||||||
|
from webnotes.model.mapper import get_mapped_doclist
|
||||||
|
|
||||||
|
if target_doclist:
|
||||||
|
target_doclist = json.loads(target_doclist)
|
||||||
|
|
||||||
|
doclist = get_mapped_doclist("Lead", source_name,
|
||||||
|
{"Lead": {
|
||||||
|
"doctype": "Customer",
|
||||||
|
"field_map": {
|
||||||
|
"name": "lead_name",
|
||||||
|
"company_name": "customer_name",
|
||||||
|
"contact_no": "phone_1",
|
||||||
|
"fax": "fax_1"
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
|
||||||
|
return [d.fields for d in doclist]
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open",
|
[{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open",
|
||||||
"email_id":"test_lead@example.com"}],
|
"email_id":"test_lead@example.com"}],
|
||||||
@ -8,3 +10,17 @@ test_records = [
|
|||||||
[{"doctype":"Lead", "lead_name": "_Test Lead 3", "status":"Converted",
|
[{"doctype":"Lead", "lead_name": "_Test Lead 3", "status":"Converted",
|
||||||
"email_id":"test_lead3@example.com"}],
|
"email_id":"test_lead3@example.com"}],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
import webnotes
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class TestLead(unittest.TestCase):
|
||||||
|
def test_make_customer(self):
|
||||||
|
from selling.doctype.lead.lead import make_customer
|
||||||
|
|
||||||
|
customer = make_customer("_T-Lead-00001")
|
||||||
|
self.assertEquals(customer[0]["doctype"], "Customer")
|
||||||
|
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
|
||||||
|
|
||||||
|
webnotes.bean(customer).insert()
|
||||||
|
|
||||||
@ -154,8 +154,11 @@ class DocType(SellingController):
|
|||||||
super(DocType, self).validate()
|
super(DocType, self).validate()
|
||||||
|
|
||||||
import utilities
|
import utilities
|
||||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted",
|
if not self.doc.status:
|
||||||
"Order Confirmed", "Order Lost", "Cancelled"])
|
self.doc.status = "Draft"
|
||||||
|
else:
|
||||||
|
utilities.validate_status(self.doc.status, ["Draft", "Submitted",
|
||||||
|
"Order Confirmed", "Order Lost", "Cancelled"])
|
||||||
|
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
self.set_last_contact_date()
|
self.set_last_contact_date()
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:08",
|
"creation": "2013-05-24 19:29:08",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-03 16:12:44",
|
"modified": "2013-07-04 10:56:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -114,7 +114,6 @@
|
|||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "customer",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "customer_name",
|
"fieldname": "customer_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
|
|||||||
49
selling/doctype/quotation/test_quotation.py
Normal file
49
selling/doctype/quotation/test_quotation.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import webnotes
|
||||||
|
from webnotes.utils import flt
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
test_dependencies = ["Sales BOM"]
|
||||||
|
|
||||||
|
class TestLead(unittest.TestCase):
|
||||||
|
def test_make_sales_order(self):
|
||||||
|
lead = webnotes.bean("Lead", "_T-Lead-00001")
|
||||||
|
lead.make_controller()
|
||||||
|
customer = lead.controller.make_customer()
|
||||||
|
self.assertEquals(customer[0].doctype, "Customer")
|
||||||
|
self.assertEquals(customer[0].lead_name, lead.doc.name)
|
||||||
|
webnotes.bean(customer).insert()
|
||||||
|
|
||||||
|
|
||||||
|
test_records = [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"company": "_Test Company",
|
||||||
|
"conversion_rate": 1.0,
|
||||||
|
"currency": "INR",
|
||||||
|
"customer": "_Test Customer",
|
||||||
|
"customer_name": "_Test Customer",
|
||||||
|
"customer_group": "_Test Customer Group",
|
||||||
|
"doctype": "Quotation",
|
||||||
|
"fiscal_year": "_Test Fiscal Year 2013",
|
||||||
|
"order_type": "Sales",
|
||||||
|
"plc_conversion_rate": 1.0,
|
||||||
|
"price_list_currency": "INR",
|
||||||
|
"price_list_name": "_Test Price List",
|
||||||
|
"territory": "_Test Territory",
|
||||||
|
"transaction_date": "2013-02-21",
|
||||||
|
"grand_total": 1000.0,
|
||||||
|
"grand_total_export": 1000.0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "CPU",
|
||||||
|
"doctype": "Quotation Item",
|
||||||
|
"item_code": "_Test Item Home Desktop 100",
|
||||||
|
"item_name": "CPU",
|
||||||
|
"parentfield": "quotation_details",
|
||||||
|
"qty": 10.0,
|
||||||
|
"basic_rate": 100.0,
|
||||||
|
"export_rate": 100.0,
|
||||||
|
"amount": 1000.0,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
]
|
||||||
@ -37,6 +37,12 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
this.toggle_rounded_total();
|
this.toggle_rounded_total();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
refresh: function(doc) {
|
||||||
|
this.frm.toggle_display("customer_name",
|
||||||
|
(this.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
|
||||||
|
this._super();
|
||||||
|
},
|
||||||
|
|
||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer || this.frm.doc.debit_to) {
|
if(this.frm.doc.customer || this.frm.doc.debit_to) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-06-18 12:39:59",
|
"creation": "2013-06-18 12:39:59",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-03 16:12:26",
|
"modified": "2013-07-04 10:56:35",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -84,7 +84,6 @@
|
|||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "customer",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "customer_name",
|
"fieldname": "customer_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
|
|||||||
@ -21,6 +21,8 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
|
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
|
||||||
// read only if any stock ledger entry exists
|
// read only if any stock ledger entry exists
|
||||||
|
|
||||||
|
cur_frm.cscript.make_dashboard()
|
||||||
|
|
||||||
cur_frm.toggle_display("naming_series", sys_defaults.item_naming_by=="Naming Series"
|
cur_frm.toggle_display("naming_series", sys_defaults.item_naming_by=="Naming Series"
|
||||||
&& doc.__islocal)
|
&& doc.__islocal)
|
||||||
cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series"
|
cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series"
|
||||||
@ -36,6 +38,12 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.make_dashboard = function() {
|
||||||
|
cur_frm.dashboard.reset();
|
||||||
|
if(doc.__islocal)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.cscript.item_code = function(doc) {
|
cur_frm.cscript.item_code = function(doc) {
|
||||||
if(!doc.item_name) cur_frm.set_value("item_name", doc.item_code);
|
if(!doc.item_name) cur_frm.set_value("item_name", doc.item_code);
|
||||||
if(!doc.description) cur_frm.set_value("description", doc.item_code);
|
if(!doc.description) cur_frm.set_value("description", doc.item_code);
|
||||||
|
|||||||
@ -24,6 +24,16 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
|
|||||||
refresh: function(doc) {
|
refresh: function(doc) {
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
|
// dashboard
|
||||||
|
cur_frm.dashboard.reset();
|
||||||
|
if(doc.docstatus===1) {
|
||||||
|
if(doc.status==="Stopped") {
|
||||||
|
cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop")
|
||||||
|
}
|
||||||
|
cur_frm.dashboard.add_progress(cint(doc.per_ordered) + "% "
|
||||||
|
+ wn._("Fulfilled"), cint(doc.per_ordered));
|
||||||
|
}
|
||||||
|
|
||||||
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
||||||
if(doc.material_request_type === "Purchase")
|
if(doc.material_request_type === "Purchase")
|
||||||
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);
|
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-07 14:48:38",
|
"creation": "2013-03-07 14:48:38",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-06-11 16:16:36",
|
"modified": "2013-07-04 10:24:53",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -44,6 +44,13 @@
|
|||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"name": "Material Request"
|
"name": "Material Request"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "type_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Type",
|
||||||
|
"options": "icon-pushpin"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "material_request_type",
|
"fieldname": "material_request_type",
|
||||||
@ -76,7 +83,8 @@
|
|||||||
"fieldname": "items",
|
"fieldname": "items",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Items",
|
"label": "Items",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-shopping-cart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -92,8 +100,7 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "section_break1",
|
"fieldname": "section_break1",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"options": "Simple"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -131,12 +138,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Give additional details about the indent.",
|
"default": "Give additional details about the indent.",
|
||||||
"description": "Filing in Additional Information about the Material Request will help you analyze your data better.",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"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"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -287,7 +294,8 @@
|
|||||||
"fieldname": "terms_section_break",
|
"fieldname": "terms_section_break",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Terms and Conditions",
|
"label": "Terms and Conditions",
|
||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break",
|
||||||
|
"options": "icon-legal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
|||||||
@ -7,6 +7,11 @@ wn.module_page["Stock"] = [
|
|||||||
top: true,
|
top: true,
|
||||||
icon: "icon-copy",
|
icon: "icon-copy",
|
||||||
items: [
|
items: [
|
||||||
|
{
|
||||||
|
label: wn._("Item"),
|
||||||
|
description: wn._("All Products or Services."),
|
||||||
|
doctype:"Item"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: wn._("Material Request"),
|
label: wn._("Material Request"),
|
||||||
description: wn._("Requests for items."),
|
description: wn._("Requests for items."),
|
||||||
@ -33,11 +38,6 @@ wn.module_page["Stock"] = [
|
|||||||
title: wn._("Masters"),
|
title: wn._("Masters"),
|
||||||
icon: "icon-book",
|
icon: "icon-book",
|
||||||
items: [
|
items: [
|
||||||
{
|
|
||||||
label: wn._("Item"),
|
|
||||||
description: wn._("All Products or Services."),
|
|
||||||
doctype:"Item"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: wn._("Serial No"),
|
label: wn._("Serial No"),
|
||||||
description: wn._("Single unit of an Item."),
|
description: wn._("Single unit of an Item."),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user