setting list_views

This commit is contained in:
Rushabh Mehta
2013-01-29 17:53:29 +05:30
parent 6abb2e67e9
commit 08da1a0a3d
105 changed files with 575 additions and 1736 deletions

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:32",
"docstatus": 0,
"modified": "2013-01-22 14:55:56",
"modified": "2013-01-29 13:24:45",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -79,6 +79,7 @@
"fieldname": "city",
"fieldtype": "Data",
"in_filter": 1,
"in_list_view": 1,
"label": "City/Town",
"reqd": 1,
"search_index": 1
@@ -96,6 +97,7 @@
"fieldname": "country",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"label": "Country",
"options": "link:Country",
"reqd": 1,
@@ -151,6 +153,7 @@
"doctype": "DocField",
"fieldname": "is_shipping_address",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Is Shipping Address"
},
{
@@ -173,6 +176,7 @@
"fieldname": "customer_name",
"fieldtype": "Data",
"in_filter": 1,
"in_list_view": 1,
"label": "Customer Name",
"read_only": 1
},
@@ -190,6 +194,7 @@
"fieldname": "supplier_name",
"fieldtype": "Data",
"in_filter": 1,
"in_list_view": 1,
"label": "Supplier Name",
"read_only": 1,
"search_index": 0

View File

@@ -1,55 +0,0 @@
wn.doclistviews['Address'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabAddress`.customer_name",
"`tabAddress`.supplier",
"`tabAddress`.supplier_name",
"`tabAddress`.sales_partner",
"`tabAddress`.city",
"`tabAddress`.country",
"ifnull(`tabAddress`.is_shipping_address, 0) as is_shipping_address",
]);
},
prepare_data: function(data) {
this._super(data);
// prepare address
var address = []
$.each(['city', 'country'], function(i, v) {
if(data[v]) address.push(data[v]);
});
data.address = address.join(", ");
// prepare shipping tag
if(data.is_shipping_address) {
data.shipping = '<span class="label label-info">Shipping</span>';
}
// prepare description
if(data.customer) {
data.description = (data.customer_name || data.customer);
data.contact_type = 'Customer';
} else if (data.supplier) {
data.description = (data.supplier_name || data.supplier);
data.contact_type = 'Supplier';
} else if (data.sales_partner) {
data.description = data.sales_partner;
data.contact_type = 'Sales Partner'
} else {
data.description = '';
data.contact_type = '';
}
},
columns: [
{width: '3%', content: 'check'},
{width: '20%', content: 'name'},
{width: '15%', content: 'contact_type'},
{width: '20%', content: 'description'},
{width: '30%', content: 'address+shipping+tags', css: {'padding': '2px 0px'}},
{width: '12%', content: 'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:32",
"docstatus": 0,
"modified": "2013-01-22 14:55:59",
"modified": "2013-01-29 13:26:39",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -65,6 +65,7 @@
"doctype": "DocField",
"fieldname": "email_id",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Email Id",
"oldfieldname": "email_id",
"oldfieldtype": "Data",
@@ -113,6 +114,7 @@
"doctype": "DocField",
"fieldname": "customer_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Customer Name",
"read_only": 1
},
@@ -130,6 +132,7 @@
"doctype": "DocField",
"fieldname": "supplier_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Supplier Name",
"read_only": 1
},

View File

@@ -1,50 +0,0 @@
wn.doclistviews['Contact'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabContact`.first_name",
"`tabContact`.last_name",
"`tabContact`.customer",
"`tabContact`.customer_name",
"`tabContact`.supplier",
"`tabContact`.supplier_name",
"`tabContact`.sales_partner",
"`tabContact`.email_id",
]);
},
prepare_data: function(data) {
this._super(data);
// prepare fullname
data.fullname = (data.first_name || '') +
(data.last_name ? ' ' + data.last_name : '');
if(!data.fullname) data.fullname = data.name;
data.fullname = repl("<a href='#!Form/Contact/%(name)s'>%(name)s\
</a>", data);
// prepare description
if(data.customer) {
data.description = (data.customer_name || data.customer);
data.contact_type = 'Customer';
} else if (data.supplier) {
data.description = (data.supplier_name || data.supplier);
data.contact_type = 'Supplier';
} else if (data.sales_partner) {
data.description = data.sales_partner;
data.contact_type = 'Sales Partner'
} else {
data.description = '';
data.contact_type = '';
}
},
columns: [
{width: '3%', content: 'check'},
{width: '20%', content: 'fullname'},
{width: '15%', content: 'contact_type'},
{width: '20%', content: 'description+tags'},
{width: '30%', content: 'email_id'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});