Merge branch 'responsive' of github.com:webnotes/erpnext into responsive

Conflicts:
	selling/doctype/lead/lead.txt
This commit is contained in:
Anand Doshi
2013-07-04 17:18:45 +05:30
44 changed files with 1061 additions and 622 deletions

View File

@@ -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() {
if(this.frm.doc.supplier || this.frm.doc.credit_to) {
if(!this.frm.doc.company) {

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-06-11 16:05:08",
"modified": "2013-07-04 10:48:54",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -39,6 +39,13 @@
"doctype": "DocType",
"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",
"doctype": "DocField",
@@ -67,7 +74,6 @@
"search_index": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "supplier_name",
"fieldtype": "Data",
@@ -77,38 +83,34 @@
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 0,
"hidden": 1,
"label": "Address",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 0,
"hidden": 1,
"label": "Contact",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_mobile",
"fieldtype": "Text",
"hidden": 0,
"hidden": 1,
"label": "Mobile No",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_email",
"fieldtype": "Text",
"hidden": 0,
"hidden": 1,
"label": "Contact Email",
"print_hide": 1,
"read_only": 1
@@ -139,7 +141,8 @@
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
},
{
"allow_on_submit": 1,
@@ -155,8 +158,7 @@
{
"doctype": "DocField",
"fieldname": "sb_last_purchase",
"fieldtype": "Section Break",
"options": "Simple"
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
@@ -238,7 +240,8 @@
"doctype": "DocField",
"fieldname": "price_list_and_currency",
"fieldtype": "Section Break",
"label": "Currency & Price List"
"label": "Currency & Price List",
"options": "icon-tag"
},
{
"doctype": "DocField",
@@ -309,6 +312,7 @@
"fieldtype": "Section Break",
"label": "Taxes",
"oldfieldtype": "Section Break",
"options": "icon-money",
"print_hide": 0
},
{
@@ -364,7 +368,8 @@
"fieldname": "totals",
"fieldtype": "Section Break",
"label": "Totals",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-money"
},
{
"doctype": "DocField",
@@ -523,7 +528,8 @@
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"label": "Terms and Conditions",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-legal"
},
{
"doctype": "DocField",
@@ -555,7 +561,8 @@
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",
"label": "Contact Info"
"label": "Contact Info",
"options": "icon-bullhorn"
},
{
"doctype": "DocField",
@@ -759,8 +766,9 @@
"doctype": "DocField",
"fieldname": "raw_material_details",
"fieldtype": "Section Break",
"label": "Raw Material Details",
"label": "Raw Materials Supplied",
"oldfieldtype": "Section Break",
"options": "icon-truck",
"print_hide": 1
},
{

View File

@@ -21,15 +21,16 @@ cur_frm.cscript.onload = function(doc,dt,dn){
}
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.refresh = function(doc,dt,dn) {
}
}
cur_frm.cscript.make_dashboard = function(doc) {
cur_frm.dashboard.reset();
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({

View File

@@ -193,3 +193,24 @@ class DocType(TransactionBase):
#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

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:11",
"docstatus": 0,
"modified": "2013-01-29 14:35:42",
"modified": "2013-07-04 10:13:19",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -46,7 +46,8 @@
"fieldname": "basic_info",
"fieldtype": "Section Break",
"label": "Basic Info",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-user"
},
{
"doctype": "DocField",
@@ -91,7 +92,8 @@
"fieldname": "address_contacts",
"fieldtype": "Section Break",
"label": "Address & Contacts",
"oldfieldtype": "Column Break"
"oldfieldtype": "Column Break",
"options": "icon-map-marker"
},
{
"depends_on": "eval:doc.__islocal",
@@ -132,7 +134,9 @@
{
"doctype": "DocField",
"fieldname": "communication_history",
"fieldtype": "Section Break"
"fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments"
},
{
"doctype": "DocField",
@@ -145,7 +149,8 @@
"fieldname": "more_info",
"fieldtype": "Section Break",
"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",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:45",
"docstatus": 0,
"modified": "2013-06-11 16:05:53",
"modified": "2013-07-04 10:51:05",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -39,6 +39,13 @@
"doctype": "DocType",
"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",
"doctype": "DocField",
@@ -67,7 +74,6 @@
"search_index": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "supplier_name",
"fieldtype": "Data",
@@ -77,38 +83,34 @@
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 0,
"hidden": 1,
"label": "Address",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 0,
"hidden": 1,
"label": "Contact",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_mobile",
"fieldtype": "Text",
"hidden": 0,
"hidden": 1,
"label": "Mobile No",
"read_only": 1
},
{
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "contact_email",
"fieldtype": "Text",
"hidden": 0,
"hidden": 1,
"label": "Contact Email",
"print_hide": 1,
"read_only": 1
@@ -139,7 +141,8 @@
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
},
{
"allow_on_submit": 1,
@@ -155,8 +158,7 @@
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"options": "Simple"
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
@@ -168,8 +170,7 @@
{
"doctype": "DocField",
"fieldname": "section_break_14",
"fieldtype": "Section Break",
"options": "Simple"
"fieldtype": "Section Break"
},
{
"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",
"fieldname": "currency_price_list",
"fieldtype": "Section Break",
"label": "Currency & Price List"
"label": "Currency & Price List",
"options": "icon-tag"
},
{
"description": "Supplier's currency",
@@ -264,7 +266,8 @@
"fieldname": "taxes",
"fieldtype": "Section Break",
"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.",
@@ -319,7 +322,8 @@
"fieldname": "totals",
"fieldtype": "Section Break",
"label": "Totals",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-money"
},
{
"doctype": "DocField",
@@ -478,7 +482,8 @@
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"label": "Terms and Conditions",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-legal"
},
{
"allow_on_submit": 1,
@@ -512,7 +517,7 @@
"doctype": "DocField",
"fieldname": "terms",
"fieldtype": "Text Editor",
"label": "Terms and Conditions1",
"label": "Terms and Conditions",
"oldfieldname": "terms",
"oldfieldtype": "Text Editor"
},
@@ -521,7 +526,8 @@
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",
"label": "Contact Info"
"label": "Contact Info",
"options": "icon-bullhorn"
},
{
"doctype": "DocField",
@@ -546,7 +552,8 @@
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break"
"oldfieldtype": "Section Break",
"options": "icon-file-text"
},
{
"doctype": "DocField",
@@ -585,6 +592,11 @@
"read_only": 1,
"report_hide": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_57",
"fieldtype": "Column Break"
},
{
"description": "Select the relevant company name if you have multiple companies",
"doctype": "DocField",