Merge branch 'responsive' of git://github.com/webnotes/erpnext into responsive
diff --git a/accounts/page/financial_statements/financial_statements.html b/accounts/page/financial_statements/financial_statements.html
deleted file mode 100644
index bc2fce0..0000000
--- a/accounts/page/financial_statements/financial_statements.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<div class="appframe col col-lg-12">
-<div id="fs_header"></div>
-<div id="print_html">
- <div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
- <div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
- <div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
-</div>
-</div>
diff --git a/accounts/page/financial_statements/financial_statements.js b/accounts/page/financial_statements/financial_statements.js
index cc79668..d562e32 100644
--- a/accounts/page/financial_statements/financial_statements.js
+++ b/accounts/page/financial_statements/financial_statements.js
@@ -14,66 +14,60 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-pscript['onload_Financial Statements'] = function() {
-
- // header and toolbar
- var h = new PageHeader('fs_header','Financial Statements','Profit & Loss and Balance Sheet Builder across multiple years');
- //$y(h.toolbar_area,{padding:'8px'});
-
- var dv = $a(h.toolbar_area,'div','',{margin:'4px 0px'});
-
- var t = make_table(dv,1,4,'640px', [], {padding:'4px', width:'160px'});
-
- var sel = $a($td(t,0,0),'select','',{width:'160px'});
- sel.id = 'stmt_type';
-
- var sel = $a($td(t,0,1),'select','',{width:'160px'});
- sel.id = 'stmt_company';
-
- var sel = $a($td(t,0,2),'select','',{width:'160px'});
- sel.id = 'stmt_period';
+erpnext.fs = {}
- var sel = $a($td(t,0,3),'select','',{width:'160px'});
- sel.id = 'stmt_fiscal_year';
-
- h.add_button('Create',function(){ pscript.stmt_new(); },0,'ui-icon-document');
- h.add_button('Print', function(){ _p.go($i('print_html').innerHTML); }, 0, 'ui-icon-print');
-/*
- var btn = $a($td(t,1,0),'button');
- btn.onclick = function(){ pscript.stmt_new(); }
- btn.innerHTML = 'Create';
+pscript['onload_Financial Statements'] = function(wrapper) {
+ wn.ui.make_app_page({
+ parent: wrapper,
+ "title": "Financial Statements",
+ "single_column": true,
+ });
- var btn = $a($td(t,1,1),'button');
- btn.onclick = function(){ alert('print'); }
- btn.innerHTML = 'Print';
+ erpnext.fs.stmt_type = wrapper.appframe.add_field({
+ fieldtype:"Select",
+ fieldname:"stmt_type",
+ options: ['Select Statement...','Balance Sheet','Profit & Loss']
+ })
- //Button to create new
- var btn = $a('stmt_new', 'button');
- btn.onclick = function() { pscript.stmt_new(); }
- btn.innerHTML = 'Create';*/
+ erpnext.fs.stmt_company = wrapper.appframe.add_field({
+ fieldtype:"Select",
+ fieldname:"stmt_company",
+ options: ['Loading Companies...']
+ })
- // select for statement
- add_sel_options($i('stmt_type'), ['Select Statement...','Balance Sheet','Profit & Loss']);
+ erpnext.fs.stmt_period = wrapper.appframe.add_field({
+ fieldtype:"Select",
+ fieldname:"stmt_period",
+ options: ['Select Period...', 'Annual', 'Quarterly', 'Monthly']
+ })
- // select for companies
- add_sel_options($i('stmt_company'), ['Loading Companies...']);
+ erpnext.fs.stmt_fiscal_year = wrapper.appframe.add_field({
+ fieldtype:"Select",
+ fieldname:"stmt_fiscal_year",
+ options: ['Loading...']
+ })
+ wrapper.appframe.add_button("Create", function() {
+ pscript.stmt_new();
+ }, "icon-refresh")
+
+ wrapper.appframe.add_button("Print", function() {
+ _p.go($i('print_html').innerHTML);
+ }, "icon-print")
+
+ $(wrapper).find(".layout-main").html('<div id="print_html">\
+ <div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>\
+ <div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>\
+ <div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto;">Please select options and click on Create</div>\
+ </div>').css({"min-height": "400px"});
// load companies
$c_obj('MIS Control','get_comp','', function(r,rt) {
// company
- empty_select($i('stmt_company'));
- add_sel_options($i('stmt_company'), add_lists(['Select Company...'], r.message.company), 'Select Company...');
-
-
- // period
- empty_select($i('stmt_period'));
- //add_sel_options($i('stmt_period'), add_lists(['Select Period...'], r.message.period), 'Select period...');
- add_sel_options($i('stmt_period'), add_lists(['Select Period...'], ['Annual', 'Quarterly', 'Monthly']), 'Select period...');
-
- // fiscal-year
- empty_select($i('stmt_fiscal_year'));
- add_sel_options($i('stmt_fiscal_year'), add_lists(['Select Year...'], r.message.fiscal_year), 'Select fiscal year...');
+ erpnext.fs.stmt_company.$input.empty()
+ .add_options(['Select Company...'].concat(r.message.company));
+ erpnext.fs.stmt_fiscal_year.$input.empty()
+ .add_options(['Select Year...'].concat(r.message.fiscal_year));
});
}
@@ -83,26 +77,27 @@
$i('stmt_tree').innerHTML = 'Refreshing....';
$i('stmt_tree').style.display = 'block';
- var company = sel_val($i('stmt_company'))
+ var company =erpnext.fs.stmt_company.get_value();
var arg = {
- statement:sel_val($i('stmt_type')),
- company:company,
- period:sel_val($i('stmt_period')),
- year:sel_val($i('stmt_fiscal_year'))
+ statement: erpnext.fs.stmt_type.get_value(),
+ company: company,
+ period: erpnext.fs.stmt_period.get_value(),
+ year: erpnext.fs.stmt_fiscal_year.get_value()
}
$c_obj('MIS Control', 'get_statement', docstring(arg), function(r,rt) {
var nl = r.message;
var t = $i('stmt_tree');
- var stmt_type = sel_val($i('stmt_type'));
+ var stmt_type = erpnext.fs.stmt_type.get_value();
t.innerHTML = '';
var tab = $a($a(t, 'div'),'table','stmt_table');
tab.style.tableLayout = 'fixed';
tab.style.width = '100%';
- $i('stmt_title1').innerHTML = sel_val($i('stmt_company'));
- $i('stmt_title2').innerHTML = sel_val($i('stmt_type')) + ' - ' + sel_val($i('stmt_fiscal_year'));
+ $i('stmt_title1').innerHTML = erpnext.fs.stmt_company.get_value()
+ $i('stmt_title2').innerHTML = erpnext.fs.stmt_type.get_value()
+ + ' - ' + erpnext.fs.stmt_fiscal_year.get_value();
for(i=0;i<nl.length;i++) {
tab.insertRow(i);
@@ -110,8 +105,6 @@
// heads
var per = tab.rows[i].insertCell(0);
- // var acc_width = (sel_val($i('stmt_period'))=='Monthly')? 12 : 20;
- // per.style.width = acc_width+'%';
per.style.width = '150px';
per.innerHTML = pscript.space_reqd(nl[i][0])+cstr(nl[i][1]);
per.className = 'stmt_level' + nl[i][0];
diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js
index d364655..901b3cc 100644
--- a/buying/doctype/supplier/supplier.js
+++ b/buying/doctype/supplier/supplier.js
@@ -21,15 +21,16 @@
}
cur_frm.cscript.refresh = function(doc,dt,dn) {
- if(sys_defaults.supp_master_name == 'Supplier Name')
- hide_field('naming_series');
- else
- unhide_field('naming_series');
+ cur_frm.cscript.make_dashboard(doc);
+ if(sys_defaults.supp_master_name == 'Supplier Name')
+ hide_field('naming_series');
+ else
+ unhide_field('naming_series');
- if(doc.__islocal){
+ if(doc.__islocal){
hide_field(['address_html','contact_html']);
- }
- else{
+ }
+ else{
unhide_field(['address_html','contact_html']);
// make lists
cur_frm.cscript.make_address(doc,dt,dn);
@@ -43,6 +44,36 @@
}
}
+cur_frm.cscript.make_dashboard = function(doc) {
+ cur_frm.dashboard.wrapper.empty().toggle(doc.__islocal ? false : true);
+ if(doc.__islocal)
+ return;
+ cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
+
+ cur_frm.dashboard.add_doctype_badge("Supplier Quotation", "supplier");
+ cur_frm.dashboard.add_doctype_badge("Purchase Order", "supplier");
+ cur_frm.dashboard.add_doctype_badge("Purchase Receipt", "supplier");
+ cur_frm.dashboard.add_doctype_badge("Purchase Invoice", "supplier");
+
+ wn.call({
+ type: "GET",
+ method:"buying.doctype.supplier.supplier.get_dashboard_info",
+ args: {
+ supplier: cur_frm.doc.name
+ },
+ callback: function(r) {
+ cur_frm.dashboard.set_headline(
+ wn._("Total Billing This Year: ") + "<b>"
+ + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ + format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ + '</b></span>');
+ cur_frm.dashboard.set_badge_count(r.message);
+ }
+ })
+}
+
+
cur_frm.cscript.make_address = function() {
if(!cur_frm.address_list) {
cur_frm.address_list = new wn.ui.Listing({
diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py
index a03ba33..d63d336 100644
--- a/buying/doctype/supplier/supplier.py
+++ b/buying/doctype/supplier/supplier.py
@@ -193,3 +193,24 @@
#update master_name in doctype account
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
master_type = 'Supplier' where master_name = %s""" , (new,old))
+
+@webnotes.whitelist()
+def get_dashboard_info(supplier):
+ if not webnotes.has_permission("Supplier", supplier):
+ webnotes.msgprint("No Permission", raise_exception=True)
+
+ out = {}
+ for doctype in ["Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice"]:
+ out[doctype] = webnotes.conn.get_value(doctype,
+ {"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
+
+ billing = webnotes.conn.sql("""select sum(grand_total), sum(outstanding_amount)
+ from `tabPurchase Invoice`
+ where supplier=%s
+ and docstatus = 1
+ and fiscal_year = %s""", (supplier, webnotes.conn.get_default("fiscal_year")))
+
+ out["total_billing"] = billing[0][0]
+ out["total_unpaid"] = billing[0][1]
+
+ return out
\ No newline at end of file
diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js
index 1db8d41..1972ad9 100644
--- a/buying/page/buying_home/buying_home.js
+++ b/buying/page/buying_home/buying_home.js
@@ -8,6 +8,11 @@
icon: "icon-copy",
items: [
{
+ label: wn._("Supplier"),
+ description: wn._("Supplier database."),
+ doctype:"Supplier"
+ },
+ {
label: wn._("Material Request"),
description: wn._("Request for purchase."),
doctype:"Material Request"
@@ -29,11 +34,6 @@
icon: "icon-book",
items: [
{
- label: wn._("Supplier"),
- description: wn._("Supplier database."),
- doctype:"Supplier"
- },
- {
label: wn._("Contact"),
description: wn._("All Contacts."),
doctype:"Contact"
diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js
index c0f6eab..914836c 100644
--- a/selling/doctype/customer/customer.js
+++ b/selling/doctype/customer/customer.js
@@ -32,7 +32,7 @@
cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
cur_frm.cscript.refresh = function(doc,dt,dn) {
- cur_frm.layout.clear_dashboard();
+ cur_frm.cscript.setup_dashboard(doc);
if(sys_defaults.cust_master_name == 'Customer Name')
hide_field('naming_series');
else
@@ -41,7 +41,6 @@
if(doc.__islocal){
hide_field(['address_html','contact_html']);
}else{
- cur_frm.cscript.setup_dashboard(doc);
unhide_field(['address_html','contact_html']);
// make lists
cur_frm.cscript.make_address(doc,dt,dn);
@@ -56,16 +55,16 @@
}
cur_frm.cscript.setup_dashboard = function(doc) {
- cur_frm.layout.dashboard.toggle(true);
- var headline = $('<div class="form-headline col col-lg-12">\
- <span class="text-muted">Loading...</span></div>')
- .appendTo(cur_frm.layout.dashboard);
+ cur_frm.dashboard.reset(doc);
+ if(doc.__islocal)
+ return;
+ cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
- cur_frm.layout.add_doctype_badge(wn._("Opportunities"), "Opportunity", "customer");
- cur_frm.layout.add_doctype_badge(wn._("Quotations"), "Quotation", "customer");
- cur_frm.layout.add_doctype_badge(wn._("Sales Orders"), "Sales Order", "customer");
- cur_frm.layout.add_doctype_badge(wn._("Delivery Notes"), "Delivery Note", "customer");
- cur_frm.layout.add_doctype_badge(wn._("Sales Invoices"), "Sales Invoice", "customer");
+ cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
+ cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
+ cur_frm.dashboard.add_doctype_badge("Sales Order", "customer");
+ cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
+ cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
wn.call({
type: "GET",
@@ -74,12 +73,13 @@
customer: cur_frm.doc.name
},
callback: function(r) {
- cur_frm.layout.dashboard.find(".form-headline")
- .html(wn._("Total Billing This Year: ") + "<b>"
- + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
- + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" +
- format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + '</b></span>');
- cur_frm.layout.set_badge_count(r.message);
+ cur_frm.dashboard.set_headline(
+ wn._("Total Billing This Year: ") + "<b>"
+ + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ + format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ + '</b></span>');
+ cur_frm.dashboard.set_badge_count(r.message);
}
})
}
diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt
index d7cecdd..86d40f8 100644
--- a/selling/doctype/customer/customer.txt
+++ b/selling/doctype/customer/customer.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-06-11 14:26:44",
"docstatus": 0,
- "modified": "2013-06-11 14:27:57",
+ "modified": "2013-07-03 10:26:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -43,6 +43,7 @@
"fieldtype": "Section Break",
"label": "Basic Info",
"oldfieldtype": "Section Break",
+ "options": "icon-user",
"permlevel": 0,
"reqd": 0
},
@@ -142,6 +143,7 @@
"fieldname": "address_contacts",
"fieldtype": "Section Break",
"label": "Address & Contacts",
+ "options": "icon-map-marker",
"permlevel": 0
},
{
@@ -190,6 +192,8 @@
"doctype": "DocField",
"fieldname": "communication_history",
"fieldtype": "Section Break",
+ "label": "Communication History",
+ "options": "icon-comments",
"permlevel": 0
},
{
@@ -205,6 +209,7 @@
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
+ "options": "icon-file-text",
"permlevel": 0
},
{
@@ -295,6 +300,7 @@
"fieldtype": "Section Break",
"label": "Sales Team",
"oldfieldtype": "Section Break",
+ "options": "icon-group",
"permlevel": 0
},
{
diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js
index 8fb26c5..3aea4c8 100644
--- a/selling/doctype/lead/lead.js
+++ b/selling/doctype/lead/lead.js
@@ -40,9 +40,19 @@
},
refresh: function() {
+ var doc = this.frm.doc;
erpnext.hide_naming_series();
this.frm.clear_custom_buttons();
+ this.frm.dashboard.reset(doc);
+ if(!doc.__islocal) {
+ if(doc.status=="Converted") {
+ this.frm.dashboard.set_headline_alert(wn._("Converted"), "alert-success", "icon-ok-sign");
+ } else {
+ this.frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
+ }
+ }
+
this.frm.__is_customer = this.frm.__is_customer || this.frm.doc.__is_customer;
if(!this.frm.doc.__islocal && !this.frm.__is_customer) {
this.frm.add_custom_button("Create Customer", this.frm.cscript['Create Customer']);
diff --git a/selling/doctype/lead/lead.txt b/selling/doctype/lead/lead.txt
index eed87ba..15f4dc0 100644
--- a/selling/doctype/lead/lead.txt
+++ b/selling/doctype/lead/lead.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-04-10 11:45:37",
"docstatus": 0,
- "modified": "2013-06-28 15:08:26",
+ "modified": "2013-07-03 10:22:31",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -41,6 +41,13 @@
"name": "Lead"
},
{
+ "doctype": "DocField",
+ "fieldname": "lead_details",
+ "fieldtype": "Section Break",
+ "label": "Lead Details",
+ "options": "icon-user"
+ },
+ {
"description": "To manage multiple series please go to Setup > Manage Series",
"doctype": "DocField",
"fieldname": "naming_series",
@@ -149,7 +156,9 @@
{
"doctype": "DocField",
"fieldname": "communication_history",
- "fieldtype": "Section Break"
+ "fieldtype": "Section Break",
+ "label": "Communication History",
+ "options": "icon-comments"
},
{
"allow_on_submit": 0,
@@ -165,7 +174,8 @@
"fieldname": "contact_info",
"fieldtype": "Section Break",
"label": "Address & Contact",
- "oldfieldtype": "Column Break"
+ "oldfieldtype": "Column Break",
+ "options": "icon-map-marker"
},
{
"depends_on": "eval:doc.__islocal",
@@ -248,7 +258,8 @@
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "options": "icon-file-text"
},
{
"doctype": "DocField",
diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js
index a4c84af..72afeea 100644
--- a/selling/doctype/opportunity/opportunity.js
+++ b/selling/doctype/opportunity/opportunity.js
@@ -18,9 +18,20 @@
cur_frm.cscript.refresh = function(doc, cdt, cdn){
erpnext.hide_naming_series();
+
+ cur_frm.dashboard.reset(doc);
+ if(!doc.__islocal) {
+ if(doc.status=="Converted" || doc.status=="Order Confirmed") {
+ cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign");
+ } else if(doc.status=="Opportunity Lost") {
+ cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign");
+ } else {
+ cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
+ }
+ }
cur_frm.clear_custom_buttons();
- if(doc.docstatus == 1) {
+ if(doc.docstatus === 1 && doc.status!=="Opportunity Lost") {
cur_frm.add_custom_button('Create Quotation', cur_frm.cscript['Create Quotation']);
cur_frm.add_custom_button('Opportunity Lost', cur_frm.cscript['Declare Opportunity Lost']);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
@@ -198,56 +209,35 @@
// declare enquiry lost
//-------------------------
cur_frm.cscript['Declare Opportunity Lost'] = function(){
- var e_lost_dialog;
+ var dialog = new wn.ui.Dialog({
+ title: "Set as Lost",
+ fields: [
+ {"fieldtype": "Text", "label": "Reason for losing", "fieldname": "reason",
+ "reqd": 1 },
+ {"fieldtype": "Button", "label": "Update", "fieldname": "update"},
+ ]
+ });
- set_e_lost_dialog = function(){
- e_lost_dialog = new Dialog(400,150,'Add Opportunity Lost Reason');
- e_lost_dialog.make_body([
- ['HTML', 'Message', '<div class="comment">Please add enquiry lost reason</div>'],
- ['Text', 'Opportunity Lost Reason'],
- ['HTML', 'Response', '<div class = "comment" id="update_enquiry_dialog_response"></div>'],
- ['HTML', 'Add Reason', '<div></div>']
- ]);
-
- var add_reason_btn1 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
- add_reason_btn1.innerHTML = 'Add';
- add_reason_btn1.onclick = function(){ e_lost_dialog.add(); }
-
- var add_reason_btn2 = $a($i(e_lost_dialog.widgets['Add Reason']), 'button', 'button');
- add_reason_btn2.innerHTML = 'Cancel';
- $y(add_reason_btn2,{marginLeft:'4px'});
- add_reason_btn2.onclick = function(){ e_lost_dialog.hide();}
-
- e_lost_dialog.onshow = function() {
- e_lost_dialog.widgets['Opportunity Lost Reason'].value = '';
- $i('update_enquiry_dialog_response').innerHTML = '';
- }
-
- e_lost_dialog.add = function() {
- // sending...
- $i('update_enquiry_dialog_response').innerHTML = 'Processing...';
- var arg = strip(e_lost_dialog.widgets['Opportunity Lost Reason'].value);
- var call_back = function(r,rt) {
- if(r.message == 'true'){
- $i('update_enquiry_dialog_response').innerHTML = 'Done';
- e_lost_dialog.hide();
- cur_frm.refresh();
+ dialog.fields_dict.update.$input.click(function() {
+ args = dialog.get_values();
+ if(!args) return;
+ cur_frm.call({
+ doc: cur_frm.doc,
+ method: "declare_enquiry_lost",
+ args: args.reason,
+ callback: function(r) {
+ if(r.exc) {
+ msgprint("There were errors.");
+ return;
}
- }
- if(arg) {
- $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);
- }
- else{
- msgprint("Please add enquiry lost reason");
- }
-
- }
- }
+ dialog.hide();
+ cur_frm.refresh();
+ },
+ btn: this
+ })
+ });
+ dialog.show();
- if(!e_lost_dialog){
- set_e_lost_dialog();
- }
- e_lost_dialog.show();
}
//get query select Territory
diff --git a/selling/doctype/opportunity/opportunity.txt b/selling/doctype/opportunity/opportunity.txt
index 7b86df2..c455440 100644
--- a/selling/doctype/opportunity/opportunity.txt
+++ b/selling/doctype/opportunity/opportunity.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
- "modified": "2013-07-02 17:22:21",
+ "modified": "2013-07-03 10:29:20",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -47,7 +47,8 @@
"doctype": "DocField",
"fieldname": "from_section",
"fieldtype": "Section Break",
- "label": "From"
+ "label": "From",
+ "options": "icon-user"
},
{
"description": "To manage multiple series please go to Setup > Manage Series",
@@ -144,6 +145,7 @@
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break",
+ "options": "icon-shopping-cart",
"read_only": 0
},
{
@@ -162,7 +164,9 @@
"doctype": "DocField",
"fieldname": "communication_history",
"fieldtype": "Section Break",
+ "label": "Communication History",
"oldfieldtype": "Section Break",
+ "options": "icon-comments",
"read_only": 0
},
{
@@ -180,6 +184,7 @@
"fieldname": "contact_info",
"fieldtype": "Section Break",
"label": "Contact Info",
+ "options": "icon-bullhorn",
"read_only": 0
},
{
@@ -284,6 +289,7 @@
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
+ "options": "icon-file-text",
"read_only": 0
},
{
diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js
index 654779c..fd8c706 100644
--- a/selling/doctype/quotation/quotation.js
+++ b/selling/doctype/quotation/quotation.js
@@ -36,10 +36,23 @@
},
refresh: function(doc, dt, dn) {
this._super(doc, dt, dn);
+
+ cur_frm.dashboard.reset(doc);
+ if(!doc.__islocal) {
+ if(doc.status=="Converted" || doc.status=="Order Confirmed") {
+ cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-success", "icon-ok-sign");
+ } else if(doc.status==="Order Lost") {
+ cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-danger", "icon-exclamation-sign");
+ } else {
+ cur_frm.dashboard.set_headline_alert(wn._(doc.status), "alert-info", "icon-exclamation-sign");
+ }
+ }
- if(doc.docstatus == 1 && doc.status!='Order Lost') {
+ if(doc.docstatus == 1 && doc.status!=='Order Lost') {
cur_frm.add_custom_button('Make Sales Order', cur_frm.cscript['Make Sales Order']);
- cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
+ if(doc.status!=="Order Confirmed") {
+ cur_frm.add_custom_button('Set as Lost', cur_frm.cscript['Declare Order Lost']);
+ }
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
@@ -150,51 +163,35 @@
// declare order lost
//-------------------------
cur_frm.cscript['Declare Order Lost'] = function(){
- var qtn_lost_dialog;
+ var dialog = new wn.ui.Dialog({
+ title: "Set as Lost",
+ fields: [
+ {"fieldtype": "Text", "label": "Reason for losing", "fieldname": "reason",
+ "reqd": 1 },
+ {"fieldtype": "Button", "label": "Update", "fieldname": "update"},
+ ]
+ });
- set_qtn_lost_dialog = function(){
- qtn_lost_dialog = new Dialog(400,400,'Add Quotation Lost Reason');
- qtn_lost_dialog.make_body([
- ['HTML', 'Message', '<div class="comment">Please add quotation lost reason</div>'],
- ['Text', 'Quotation Lost Reason'],
- ['HTML', 'Response', '<div class = "comment" id="update_quotation_dialog_response"></div>'],
- ['HTML', 'Add Reason', '<div></div>']
- ]);
-
- var add_reason_btn1 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
- add_reason_btn1.innerHTML = 'Add';
- add_reason_btn1.onclick = function(){ qtn_lost_dialog.add(); }
-
- var add_reason_btn2 = $a($i(qtn_lost_dialog.widgets['Add Reason']), 'button', 'button');
- add_reason_btn2.innerHTML = 'Cancel';
- $y(add_reason_btn2,{marginLeft:'4px'});
- add_reason_btn2.onclick = function(){ qtn_lost_dialog.hide();}
-
- qtn_lost_dialog.onshow = function() {
- qtn_lost_dialog.widgets['Quotation Lost Reason'].value = '';
- $i('update_quotation_dialog_response').innerHTML = '';
- }
-
- qtn_lost_dialog.add = function() {
- // sending...
- $i('update_quotation_dialog_response').innerHTML = 'Processing...';
- var arg = strip(qtn_lost_dialog.widgets['Quotation Lost Reason'].value);
- var call_back = function(r,rt) {
- if(r.message == 'true'){
- $i('update_quotation_dialog_response').innerHTML = 'Done';
- qtn_lost_dialog.hide();
- cur_frm.refresh();
+ dialog.fields_dict.update.$input.click(function() {
+ args = dialog.get_values();
+ if(!args) return;
+ cur_frm.call({
+ method: "declare_order_lost",
+ doc: cur_frm.doc,
+ args: args.reason,
+ callback: function(r) {
+ if(r.exc) {
+ msgprint("There were errors.");
+ return;
}
- }
- if(arg) $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_order_lost',arg,call_back);
- else msgprint("Please add Quotation lost reason");
- }
- }
-
- if(!qtn_lost_dialog){
- set_qtn_lost_dialog();
- }
- qtn_lost_dialog.show();
+ dialog.hide();
+ cur_frm.refresh();
+ },
+ btn: this
+ })
+ });
+ dialog.show();
+
}
//================ Last Quoted Price and Last Sold Price suggestion ======================
diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py
index d33cd6c..0cbc76e 100644
--- a/selling/doctype/quotation/quotation.py
+++ b/selling/doctype/quotation/quotation.py
@@ -191,7 +191,7 @@
# declare as order lost
#-------------------------
- def declare_order_lost(self,arg):
+ def declare_order_lost(self, arg):
chk = sql("select t1.name from `tabSales Order` t1, `tabSales Order Item` t2 where t2.parent = t1.name and t1.docstatus=1 and t2.prevdoc_docname = %s",self.doc.name)
if chk:
msgprint("Sales Order No. "+cstr(chk[0][0])+" is submitted against this Quotation. Thus 'Order Lost' can not be declared against it.")
diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt
index 433ccf3..f583dbe 100644
--- a/selling/doctype/quotation/quotation.txt
+++ b/selling/doctype/quotation/quotation.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
- "modified": "2013-07-02 16:49:52",
+ "modified": "2013-07-03 11:54:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -46,7 +46,8 @@
"doctype": "DocField",
"fieldname": "customer_section",
"fieldtype": "Section Break",
- "label": "Customer"
+ "label": "Customer",
+ "options": "icon-user"
},
{
"doctype": "DocField",
@@ -117,17 +118,16 @@
"doctype": "DocField",
"fieldname": "customer_name",
"fieldtype": "Data",
- "hidden": 0,
+ "hidden": 1,
"in_list_view": 1,
"label": "Customer Name",
"read_only": 1
},
{
- "depends_on": "customer",
"doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
- "hidden": 0,
+ "hidden": 1,
"in_filter": 0,
"label": "Address",
"oldfieldname": "customer_address",
@@ -138,32 +138,29 @@
"search_index": 0
},
{
- "depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_display",
"fieldtype": "Small Text",
- "hidden": 0,
+ "hidden": 1,
"in_filter": 0,
"label": "Contact",
"print_hide": 0,
"read_only": 1
},
{
- "depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_mobile",
"fieldtype": "Text",
- "hidden": 0,
+ "hidden": 1,
"label": "Mobile No",
"print_hide": 0,
"read_only": 1
},
{
- "depends_on": "customer",
"doctype": "DocField",
"fieldname": "contact_email",
"fieldtype": "Text",
- "hidden": 0,
+ "hidden": 1,
"label": "Contact Email",
"print_hide": 1,
"read_only": 1
@@ -240,6 +237,7 @@
"fieldname": "section_break0",
"fieldtype": "Section Break",
"label": "Price List and Currency",
+ "options": "icon-globe",
"read_only": 0
},
{
@@ -322,6 +320,7 @@
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break",
+ "options": "icon-shopping-cart",
"print_hide": 0,
"read_only": 0,
"search_index": 0
@@ -343,7 +342,6 @@
"doctype": "DocField",
"fieldname": "sec_break23",
"fieldtype": "Section Break",
- "options": "Simple",
"read_only": 0
},
{
@@ -419,6 +417,7 @@
"fieldtype": "Section Break",
"label": "Taxes",
"oldfieldtype": "Section Break",
+ "options": "icon-money",
"read_only": 0
},
{
@@ -518,6 +517,7 @@
"fieldtype": "Section Break",
"label": "Totals",
"oldfieldtype": "Section Break",
+ "options": "icon-money",
"print_hide": 1,
"read_only": 0
},
@@ -618,6 +618,7 @@
"fieldtype": "Section Break",
"label": "Terms and Conditions",
"oldfieldtype": "Section Break",
+ "options": "icon-legal",
"print_hide": 0,
"read_only": 0
},
@@ -665,6 +666,7 @@
"fieldname": "contact_section",
"fieldtype": "Section Break",
"label": "Contact Info",
+ "options": "icon-bullhorn",
"read_only": 0
},
{
@@ -754,6 +756,7 @@
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
+ "options": "icon-file-text",
"print_hide": 1,
"read_only": 0
},
@@ -880,8 +883,9 @@
"doctype": "DocField",
"fieldname": "communication_history",
"fieldtype": "Section Break",
+ "label": "Communication History",
"oldfieldtype": "Section Break",
- "options": "Simple",
+ "options": "icon-comments",
"print_hide": 1,
"read_only": 0
},