added listviews for sales, purchase

This commit is contained in:
Rushabh Mehta 2014-07-30 18:32:08 +05:30 committed by Anand Doshi
parent 67af99794d
commit 18eb4f5015
31 changed files with 427 additions and 57 deletions

View File

@ -0,0 +1,32 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-8">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
<span class="filterable"
data-filter="supplier,=,{%= doc.supplier %}">
{%= doc.supplier_name %}</span></span>
{% if(doc.per_received < 100 && doc.status!=="Stopped") { %}
<span class="label label-warning filterable"
data-filter="per_received,<,100|status,!=,Stopped">
{%= __("Pending") %}
</span>
{% } %}
{% if(doc.status==="Stopped" || doc.status==="Draft") { %}
<span class="label label-danger filterable"
data-filter="status,=,Stopped">{%= __(doc.status) %}</span>
{% } %}
</div>
</div>
<div class="col-xs-1 text-right">
{% var completed = doc.per_received, title = __("Received") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
<div class="col-xs-1 text-right">
{% var completed = doc.per_billed, title = __("Billed") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
<div class="col-xs-2 text-right">
{%= doc.get_formatted("grand_total") %}
</div>
</div>

View File

@ -0,0 +1,4 @@
frappe.listview_settings['Purchase Order'] = {
add_fields: ["grand_total", "company", "currency", "supplier",
"supplier_name", "per_received", "per_billed"]
};

View File

@ -0,0 +1,15 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
{% if(doc.supplier_name != doc.name) { %}
<span style="margin-right: 8px; display: inline-block">
{%= doc.supplier_name %}</span>
{% } %}
<span class="label label-info filterable"
data-filter="supplier_type,=,{%= doc.supplier_type %}">
{%= doc.supplier_type %}
</span>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Supplier'] = {
add_fields: ["supplier_name", "supplier_type"]
};

View File

@ -0,0 +1,20 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-10">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
<span class="filterable"
data-filter="supplier,=,{%= doc.supplier %}">
{%= doc.supplier %}</span>
</span>
</span>
<span class="label {%= doc.status=="Draft" ? "label-danger" :
(doc.status=="Ordered" ? "label-success": "label-info") %}
filterable"
data-filter="status,=,{%= doc.status %}">{%= doc.status %}</span>
</div>
</div>
<div class="col-xs-2 text-right">
{%= doc.get_formatted("grand_total") %}
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Supplier Quotation'] = {
add_fields: ["supplier", "grand_total", "status", "company", "currency"]
};

View File

@ -0,0 +1,29 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
{% if(doc.customer_name != doc.name) { %}
<span style="margin-right: 8px; display: inline-block">
{%= doc.customer_name %}</span>
{% } %}
<span style="margin-right: 8px; display: inline-block"
title="{%= doc.customer_type %}" class="filterable"
data-filter="customer_type,=,{%= doc.customer_type %}">
{% if(doc.customer_type==="Company") { %}
<i class="icon-building"></i>
{% } else { %}
<i class="icon-user"></i>
{% } %}
</span>
<span class="label label-info filterable"
data-filter="customer_group,=,{%= doc.customer_group %}">
{%= doc.customer_group %}</span>
{% if(doc.territory) { %}
<span class="label label-default filterable"
data-filter="territory,=,{%= doc.territory %}">
<i class="icon-map-marker"></i>
{%= doc.territory %}</span>
{% } %}
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Customer'] = {
add_fields: ["customer_name", "territory", "customer_group", "customer_type"]
};

View File

@ -0,0 +1,18 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
{%= doc.company_name %}</span>
<span class="label
{%= doc.status=="Open" ? "label-danger" : "label-info" %} filterable"
data-filter="status,=,{%= doc.status %}">{%= doc.status %}</span>
{% if(doc.territory) { %}
<span class="label label-default filterable"
data-filter="territory,=,{%= doc.territory %}">
<i class="icon-map-marker"></i>
{%= doc.territory %}</span>
{% } %}
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Lead'] = {
add_fields: ["territory", "company_name", "status", "source"]
};

View File

@ -0,0 +1,23 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
<span class="filterable"
data-filter="{%= doc.enquiry_from.toLowerCase() %},=,{%= doc[doc.enquiry_from.toLowerCase()] %}">
{%= doc.customer_name %}</span> ({%= doc.enquiry_from %})</span>
<span style="margin-right: 8px; display: inline-block"
title="{%= doc.enquiry_type %}" class="filterable"
data-filter="enquiry_type,=,{%= doc.enquiry_type %}">
{% if(doc.enquiry_type==="Sales") { %}
<i class="icon-tag"></i>
{% } else { %}
<i class="icon-wrench"></i>
{% } %}
</span>
<span class="label
{%= doc.status=="Draft" ? "label-danger" : "label-info" %} filterable"
data-filter="status,=,{%= doc.status %}">{%= doc.status %}</span>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Opportunity'] = {
add_fields: ["customer_name", "enquiry_type", "enquiry_from", "status"]
};

View File

@ -0,0 +1,29 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-10">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
<span class="filterable"
data-filter="{%= doc.quotation_to.toLowerCase() %},=,{%= doc[doc.quotation_to.toLowerCase()] %}">
{%= doc.customer_name %}</span> ({%= doc.quotation_to %})
</span>
</span>
<span style="margin-right: 8px; display: inline-block"
title="{%= doc.order_type %}" class="filterable"
data-filter="order_type,=,{%= doc.order_type %}">
{% if(doc.order_type==="Service") { %}
<i class="icon-wrench"></i>
{% } else { %}
<i class="icon-tag"></i>
{% } %}
</span>
<span class="label {%= doc.status=="Draft" ? "label-danger" :
(doc.status=="Ordered" ? "label-success": "label-info") %}
filterable"
data-filter="status,=,{%= doc.status %}">{%= doc.status %}</span>
</div>
</div>
<div class="col-xs-2 text-right">
{%= doc.get_formatted("grand_total") %}
</div>
</div>

View File

@ -0,0 +1,4 @@
frappe.listview_settings['Quotation'] = {
add_fields: ["customer_name", "quotation_to", "grand_total", "status",
"company", "currency", "order_type", "lead", "customer"]
};

View File

@ -1,8 +1,41 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-9">{%= list.get_avatar_and_id(doc) %}
{%= doc.customer_name %}
<div class="col-xs-8">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
<span class="filterable"
data-filter="customer,=,{%= doc.customer %}">
{%= doc.customer_name %}</span></span>
{% if(doc.per_delivered < 100 && doc.status!=="Stopped") { %}
{% if(frappe.datetime.get_diff(doc.delivery_date) < 0) { %}
<span class="label label-danger filterable"
title="{%= doc.get_formatted("delivery_date")%}"
data-filter="per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"
>
{%= __("Overdue") %}
</span>
{% } else { %}
<span class="label label-warning filterable"
data-filter="per_delivered,<,100|status,!=,Stopped"
title="{%= __("Pending") %}">
{%= doc.get_formatted("delivery_date")%}</span>
{% } %}
{% } %}
{% if(doc.status==="Stopped") { %}
<span class="label label-danger filterable"
data-filter="status,=,Stopped">{%= __("Stopped") %}</span>
{% } %}
</div>
</div>
<div class="col-xs-3 text-right">
{%= row.get_formatted("grand_total") %}
<div class="col-xs-1 text-right">
{% var completed = doc.per_delivered, title = __("Delivered") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
<div class="col-xs-1 text-right">
{% var completed = doc.per_billed, title = __("Billed") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
<div class="col-xs-2 text-right">
{%= doc.get_formatted("grand_total") %}
</div>
</div>

View File

@ -1,3 +1,4 @@
frappe.listview_settings['Sales Order'] = {
add_fields: ["grand_total", "company", "currency", "customer_name"]
add_fields: ["grand_total", "company", "currency", "customer",
"customer_name", "per_delivered", "per_billed", "delivery_date"]
};

View File

@ -0,0 +1,53 @@
<div class="row">
<div class="col-xs-11">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
{% if(doc.item_name != doc.name) { %}
<span style="margin-right: 8px;">{%= doc.item_name %}</span>
{% } %}
{% if(doc.is_stock_item==="Yes") { %}
<span style="margin-right: 8px;"
title="{%= __("Stock Item") %}" class="filterable"
data-filter="is_stock_item,=,Yes">
<i class="icon-inbox text-muted"></i>
</span>
{% } %}
{% if(doc.is_sales_item==="Yes") { %}
<span style="margin-right: 8px;"
title="{%= __("Sales Item") %}" class="filterable"
data-filter="is_sales_item,=,Yes">
<i class="icon-tag text-muted"></i>
</span>
{% } %}
{% if(doc.is_purchase_item==="Yes") { %}
<span style="margin-right: 8px;"
title="{%= __("Purchase Item") %}" class="filterable"
data-filter="is_purchase_item,=,Yes">
<i class="icon-shopping-cart text-muted"></i>
</span>
{% } %}
{% if(doc.is_manufactured_item==="Yes") { %}
<span style="margin-right: 8px;"
title="{%= __("Manufactured Item") %}" class="filterable"
data-filter="is_manufactured_item,=,Yes">
<i class="icon-wrench text-muted"></i>
</span>
{% } %}
{% if(doc.show_in_website) { %}
<span style="margin-right: 8px;"
title="{%= __("Shown in Website") %}" class="filterable"
data-filter="show_in_website,=,Yes">
<i class="icon-globe text-muted"></i>
</span>
{% } %}
<span class="label label-info filterable"
data-filter="item_group,=,{%= doc.item_group %}">
{%= doc.item_group %}</span>
</div>
</div>
<div class="col-xs-1">
{% if(doc.image) { %}
<img src="{%= doc.image %}" class="img-responsive" style="margin-bottom: 4px;">
{% } %}
</div>
</div>

View File

@ -0,0 +1,5 @@
frappe.listview_settings['Item'] = {
add_fields: ["item_name", "stock_uom", "item_group", "image",
"is_stock_item", "is_sales_item", "is_purchase_item",
"is_manufactured_item", "show_in_website"]
};

View File

@ -0,0 +1,28 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-10">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block"
title="{%= doc.material_request_type %}" class="filterable"
data-filter="material_request_type,=,{%= doc.material_request_type %}">
{% if(doc.material_request_type==="Purchase") { %}
<i class="icon-shopping-cart"></i>
{% } else { %}
<i class="icon-truck"></i>
{% } %}
</span>
{% if(doc.status=="Draft") { %}
<span class="label label-danger"
data-filter="status,=,{%= doc.status %}">{%= doc.status %}</span>
{% } %}
{% if(doc.status=="Submitted" && doc.per_ordered < 100) { %}
<span class="label label-warning filterable"
data-filter="per_ordered,<,100">{%= __("Pending") %}</span>
{% } %}
</div>
</div>
<div class="col-xs-2">
{% var completed = doc.per_ordered, title = __("Ordered") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Material Request'] = {
add_fields: ["material_request_type", "status", "per_ordered"]
};

View File

@ -0,0 +1,48 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
{% var icon = {
"Material Issue": "icon-arrow-right",
"Material Receipt": "icon-arrow-left",
"Material Transfer": "icon-resize-horizontal",
"Manufacture/Repack": "icon-wrench",
"Sales Return": "icon-warning-sign",
"Purchase Return": "icon-warning-sign",
"Subcontract": "icon-truck"
}[doc.purpose]; %}
<span class="label label-success filterable"
data-filter="purpose,=,{%= doc.purpose %}"
title="{%= doc.purpose %}">
<i class="{%= icon %}"></i>
</span>
{% if(doc.from_warehouse) { %}
<span class="label label-default filterable"
data-filter="from_warehouse,=,{%= doc.from_warehouse %}">
{%= doc.from_warehouse %}
</span>
{% } %}
<i class="icon-arrow-right text-muted"></i>
{% if(doc.to_warehouse) { %}
<span class="label label-primary filterable"
data-filter="to_warehouse,=,{%= doc.to_warehouse %}">
{%= doc.to_warehouse %}
</span>
{% } %}
{% if(doc.production_order) { %}
<span class="label label-info filterable"
data-filter="production_order,=,{%= doc.production_order %}"
title="{%= doc.production_order %}">
<i class="icon-wrench"></i>
</span>
{% } %}
{% if(doc.bom_no) { %}
<span class="label label-info filterable"
data-filter="bom_no,=,{%= doc.bom_no %}"
title="{%= doc.bom_no %}">
<i class="icon-sitemap"></i>
</span>
{% } %}
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
frappe.listview_settings['Stock Entry'] = {
add_fields: ["from_warehouse", "to_warehouse", "purpose", "production_order", "bom_no"]
};

View File

@ -0,0 +1,8 @@
<div class="progress" title="{%= title %}"
style="margin-bottom: 4px;">
<div class="progress-bar" role="progressbar"
aria-valuenow="{%= completed %}"
aria-valuemin="0" aria-valuemax="100"
style="width: {%= completed %}%">
</div>
</div>

View File

@ -1,12 +1,12 @@
{% $.each(visible_columns || [], function(i, df) { %}
{% var val = row.get_formatted(df.fieldname);
{% var val = doc.get_formatted(df.fieldname);
if(val) { %}
<div class="row">
<div class="col-xs-3">
<strong>{%= __(df.label) %}:</strong>
</div>
<div class="col-xs-9">
{%= row.get_formatted(df.fieldname) %}
{%= doc.get_formatted(df.fieldname) %}
</div>
</div>
{% } %}

View File

@ -27,30 +27,23 @@
(frappe.datetime.get_diff(doc.schedule_date) < 1
&& doc.received_qty < doc.qty)
? "label-danger" : "label-default" %}">
{%= row.get_formatted("schedule_date") %}</span>
{%= doc.get_formatted("schedule_date") %}</span>
{% } %}
</div>
<!-- qty -->
<div class="col-sm-2 text-right">
{%= row.get_formatted("qty") %}
{%= doc.get_formatted("qty") %}
<br><small>{%= doc.uom || doc.stock_uom %}</small>
{% if(in_list(["Sales Order Item", "Purchase Order Item"],
doc.doctype) && frm.doc.docstatus===1) {
var delivered = doc.doctype==="Sales Order Item" ?
doc.delivered_qty : doc.received_qty,
percent_delivered =
100 - cint((doc.qty - delivered) * 100 / doc.qty);
completed =
100 - cint((doc.qty - delivered) * 100 / doc.qty),
title = __("Delivered");
%}
<div class="progress" title="% {%= __("Delivered") %}"
style="margin-bottom: 4px;">
<div class="progress-bar" role="progressbar"
aria-valuenow="{%= percent_delivered %}"
aria-valuemin="0" aria-valuemax="100"
style="width: {%= percent_delivered %}%">
{%= percent_delivered %}%
</div>
</div>
{% include "templates/form_grid/includes/progress.html" %}
{% } %}
{% if(doc.warehouse) {
var label_class = "label-default",
@ -78,7 +71,7 @@
<!-- rate -->
<div class="col-sm-2 text-right">
{%= row.get_formatted("rate") %}
{%= doc.get_formatted("rate") %}
{% if(doc.discount_percentage) { %}
<br><span class="label label-default pull-right"
title="{%= __("Discount") %}">
@ -88,21 +81,15 @@
<!-- amount -->
<div class="col-sm-2 text-right">
{%= row.get_formatted("amount") %}
{%= doc.get_formatted("amount") %}
{% if(in_list(["Sales Order Item", "Purchase Order Item"],
doc.doctype) && frm.doc.docstatus===1 && doc.amount) {
var percent_billed =
100 - cint((doc.amount - doc.billed_amt) * 100 / doc.amount);
var completed =
100 - cint((doc.amount - doc.billed_amt) * 100 / doc.amount),
title = __("Billed");
%}
<br><small>&nbsp;</small>
<div class="progress" title="% {%= __("Billed") %}">
<div class="progress-bar" role="progressbar"
aria-valuenow="{%= percent_billed %}"
aria-valuemin="0" aria-valuemax="100"
style="width: {%= percent_billed %}%">
{%= percent_billed %}%
</div>
</div>
{% include "templates/form_grid/includes/progress.html" %}
{% } %}
</div>
</div>

View File

@ -1,4 +1,4 @@
{% var visible_columns = row.get_visible_columns(["item_code",
{% var visible_columns = row.get_visible_columns(["item_code", "warehouse",
"item_name", "description", "amount", "stock_uom", "uom", "qty"]); %}
{% if(!doc) { %}
@ -16,28 +16,21 @@
{% include "templates/form_grid/includes/visible_cols.html" %}
{% if(doc.schedule_date) { %}
<br><span title="{%= __("Reqd By Date") %}" class="label {%=
(frappe.datetime.get_diff(doc.schedule_date) < 1
(frappe.datetime.get_diff(doc.schedule_date) < 0
&& doc.ordered_qty < doc.qty)
? "label-danger" : "label-default" %}">
{%= row.get_formatted("schedule_date") %}</span>
{%= doc.get_formatted("schedule_date") %}</span>
{% } %}
</div>
<!-- qty -->
<div class="col-sm-3 text-right">
{%= row.get_formatted("qty") %}
{%= doc.get_formatted("qty") %}
<small>{%= doc.uom || doc.stock_uom %}</small>
{% var percent_delivered =
100 - cint((doc.qty - cint(doc.ordered_qty)) * 100 / doc.qty); %}
<div class="progress" title="% {%= __("Ordered") %}"
style="margin-bottom: 4px;">
<div class="progress-bar" role="progressbar"
aria-valuenow="{%= percent_delivered %}"
aria-valuemin="0" aria-valuemax="100"
style="width: {%= percent_delivered %}%">
{%= percent_delivered %}%
</div>
</div>
{% var completed =
100 - cint((doc.qty - cint(doc.ordered_qty)) * 100 / doc.qty),
title = __("Ordered"); %}
{% include "templates/form_grid/includes/progress.html" %}
{% if(doc.warehouse) { %}
<div style="overflow:hidden; min-height: 25px;
white-space:nowrap; text-overflow: ellipsis;"

View File

@ -28,15 +28,15 @@
<!-- qty -->
<div class="col-sm-2 text-right">
{%= row.get_formatted("qty") %}
{%= doc.get_formatted("qty") %}
<br><small>{%= doc.uom || doc.stock_uom %}</small>
</div>
<!-- amount -->
<div class="col-sm-2 text-right">
{%= row.get_formatted("amount") %}
{%= doc.get_formatted("amount") %}
<div class="small text-muted">
{%= row.get_formatted("incoming_rate") %}</div>
{%= doc.get_formatted("incoming_rate") %}</div>
</div>
</div>
{% } %}

View File

@ -16,6 +16,7 @@
{
"fieldname": "first_name",
"fieldtype": "Data",
"in_list_view": 0,
"label": "First Name",
"oldfieldname": "first_name",
"oldfieldtype": "Data",
@ -25,6 +26,7 @@
{
"fieldname": "last_name",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Last Name",
"oldfieldname": "last_name",
"oldfieldtype": "Data",
@ -39,6 +41,7 @@
"default": "Passive",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Status",
"options": "Passive\nOpen\nReplied",
"permlevel": 0
@ -46,7 +49,7 @@
{
"fieldname": "email_id",
"fieldtype": "Data",
"in_list_view": 1,
"in_list_view": 0,
"label": "Email Id",
"oldfieldname": "email_id",
"oldfieldtype": "Data",
@ -100,7 +103,7 @@
"depends_on": "eval:!doc.supplier && !doc.sales_partner",
"fieldname": "customer_name",
"fieldtype": "Data",
"in_list_view": 1,
"in_list_view": 0,
"label": "Customer Name",
"permlevel": 0,
"read_only": 1
@ -125,7 +128,7 @@
"depends_on": "eval:!doc.customer && !doc.sales_partner",
"fieldname": "supplier_name",
"fieldtype": "Data",
"in_list_view": 1,
"in_list_view": 0,
"label": "Supplier Name",
"permlevel": 0,
"read_only": 1
@ -199,7 +202,7 @@
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"modified": "2014-05-27 03:49:08.789451",
"modified": "2014-07-30 05:44:25.767076",
"modified_by": "Administrator",
"module": "Utilities",
"name": "Contact",

View File

@ -9,7 +9,7 @@
{
"fieldname": "title",
"fieldtype": "Data",
"in_list_view": 1,
"in_list_view": 0,
"label": "Title",
"permlevel": 0,
"print_hide": 1,
@ -19,7 +19,7 @@
"description": "Help: To link to another record in the system, use \"#Form/Note/[Note Name]\" as the Link URL. (don't use \"http://\")",
"fieldname": "content",
"fieldtype": "Text Editor",
"in_list_view": 1,
"in_list_view": 0,
"label": "Content",
"permlevel": 0
},
@ -49,7 +49,7 @@
],
"icon": "icon-file-text",
"idx": 1,
"modified": "2014-07-09 12:54:11.897597",
"modified": "2014-07-30 03:24:38.302928",
"modified_by": "Administrator",
"module": "Utilities",
"name": "Note",

View File

@ -0,0 +1,10 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
test_records = frappe.get_test_records('Note')
class TestNote(unittest.TestCase):
pass

View File

@ -0,0 +1,6 @@
[
{
"doctype": "Note",
"name": "_Test Note 1"
}
]