listview indicator fix

This commit is contained in:
Nabin Hait 2015-02-18 12:23:18 +05:30
parent da5f766dd5
commit fe81da2dd1
8 changed files with 24 additions and 25 deletions

View File

@ -6,13 +6,13 @@ frappe.listview_settings['Purchase Invoice'] = {
add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company", add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"], "currency"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.outstanding_amount > 0 && doc.docstatus==1) { if(flt(doc.outstanding_amount) > 0 && doc.docstatus==1) {
if(frappe.datetime.get_diff(doc.due_date) < 0) { if(frappe.datetime.get_diff(doc.due_date) < 0) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<,Today"]; return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<,Today"];
} else { } else {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due,>=,Today"]; return [__("Unpaid"), "orange", "outstanding_amount,>,0|due,>=,Today"];
} }
} else if(doc.outstanding_amount==0 && doc.docstatus==1) { } else if(flt(doc.outstanding_amount)==0 && doc.docstatus==1) {
return [__("Paid"), "green", "outstanding_amount,=,0"]; return [__("Paid"), "green", "outstanding_amount,=,0"];
} }
} }

View File

@ -6,11 +6,11 @@ frappe.listview_settings['Sales Invoice'] = {
add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company", add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company",
"currency"], "currency"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.outstanding_amount==0) { if(flt(doc.outstanding_amount)==0) {
return [__("Paid"), "green", "outstanding_amount,=,0"] return [__("Paid"), "green", "outstanding_amount,=,0"]
} else if (doc.outstanding_amount > 0 && doc.due_date > frappe.datetime.get_today()) { } else if (flt(doc.outstanding_amount) > 0 && doc.due_date > frappe.datetime.get_today()) {
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"] return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"]
} else if (doc.outstanding_amount > 0 && doc.due_date <= frappe.datetime.get_today()) { } else if (flt(doc.outstanding_amount) > 0 && doc.due_date <= frappe.datetime.get_today()) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"] return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
} }
}, },

View File

@ -4,11 +4,11 @@ frappe.listview_settings['Purchase Order'] = {
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"]; return [__("Stopped"), "red", "status,=,Stopped"];
} else if(doc.per_received < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_received) < 100 && doc.status!=="Stopped") {
return [__("Not Received"), "orange", "per_received,<,100|status,!=,Stopped"]; return [__("Not Received"), "orange", "per_received,<,100|status,!=,Stopped"];
} else if(doc.per_received == 100 && doc.per_billed < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_received) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") {
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"]; return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Stopped"];
} else if(doc.per_received == 100 && doc.per_billed == 100 && doc.status!=="Stopped") { } else if(flt(doc.per_received) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"]; return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"];
} }
} }

View File

@ -52,8 +52,8 @@ class AccountsController(TransactionBase):
break break
def calculate_taxes_and_totals(self): def calculate_taxes_and_totals(self):
from erpnext.controllers.taxes_and_totals import taxes_and_totals from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
taxes_and_totals(self).calculate() calculate_taxes_and_totals(self)
if self.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: if self.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
self.calculate_commission() self.calculate_commission()

View File

@ -8,10 +8,12 @@ from frappe.utils import cint, flt, rounded
from erpnext.setup.utils import get_company_currency from erpnext.setup.utils import get_company_currency
from erpnext.controllers.accounts_controller import validate_conversion_rate from erpnext.controllers.accounts_controller import validate_conversion_rate
class taxes_and_totals(object): class calculate_taxes_and_totals(object):
def __init__(self, doc): def __init__(self, doc):
self.doc = doc self.doc = doc
self.calculate()
def calculate(self): def calculate(self):
self.discount_amount_applied = False self.discount_amount_applied = False
self._calculate() self._calculate()

View File

@ -4,10 +4,8 @@
import frappe import frappe
def execute(): def execute():
if not frappe.db.exists('Activity Type','Manufacturing') { if not frappe.db.exists('Activity Type','Manufacturing'):
doc = frappe.new_doc('Activity Type') frappe.get_doc({
doc.update({ "doctype": "Activity Type",
'activity_type' : 'Manufacturing' "activity_type": "Manufacturing"
}) }).insert()
doc.save()
}

View File

@ -4,13 +4,13 @@ frappe.listview_settings['Sales Order'] = {
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"]; return [__("Stopped"), "red", "status,=,Stopped"];
} else if(doc.per_delivered < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) { } else if(flt(doc.per_delivered) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) {
return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"]; return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"];
} else if(doc.per_delivered < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_delivered) < 100 && doc.status!=="Stopped") {
return [__("Not Delivered"), "orange", "per_delivered,<,100|status,!=,Stopped"]; return [__("Not Delivered"), "orange", "per_delivered,<,100|status,!=,Stopped"];
} else if(doc.per_delivered == 100 && doc.per_billed < 100 && doc.status!=="Stopped") { } else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) < 100 && doc.status!=="Stopped") {
return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"]; return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"];
} else if(doc.per_delivered == 100 && doc.per_billed == 100 && doc.status!=="Stopped") { } else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"]; return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"];
} }
} }

View File

@ -1,12 +1,11 @@
frappe.listview_settings['Material Request'] = { frappe.listview_settings['Material Request'] = {
add_fields: ["material_request_type", "status", "per_ordered"], add_fields: ["material_request_type", "status", "per_ordered"],
get_indicator: function(doc) { get_indicator: function(doc) {
console.log()
if(doc.status=="Stopped") { if(doc.status=="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"]; return [__("Stopped"), "red", "status,=,Stopped"];
} else if(doc.docstatus==1 && doc.per_ordered < 100) { } else if(doc.docstatus==1 && flt(doc.per_ordered) < 100) {
return [__("Pending"), "orange", "per_ordered,<,100"]; return [__("Pending"), "orange", "per_ordered,<,100"];
} else if(doc.docstatus==1 && doc.per_ordered == 100) { } else if(doc.docstatus==1 && flt(doc.per_ordered) == 100) {
return [__("Ordered"), "green", "per_ordered,=,100"]; return [__("Ordered"), "green", "per_ordered,=,100"];
} }
} }