Merge branch 'foreign_currency_calc' into v5.0

This commit is contained in:
Nabin Hait
2015-02-18 12:25:06 +05:30
14 changed files with 44 additions and 33 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

@@ -1,6 +1,6 @@
{ {
"autoname": "PP/.SO/.#####", "autoname": "PP/.SO/.#####",
"creation": "2013-02-22 01:27:49.000000", "creation": "2013-02-22 01:27:49",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -28,6 +28,12 @@
"read_only": 1, "read_only": 1,
"width": "120px" "width": "120px"
}, },
{
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{ {
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
@@ -53,9 +59,10 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-20 19:23:25.000000", "modified": "2015-02-17 14:29:14.479541",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Plan Sales Order", "name": "Production Plan Sales Order",
"owner": "Administrator" "owner": "Administrator",
"permissions": []
} }

View File

@@ -97,6 +97,8 @@ execute:frappe.db.sql("update `tabItem` i set apply_warehouse_wise_reorder_level
execute:frappe.rename_doc("DocType", "Support Ticket", "Issue", force=True) execute:frappe.rename_doc("DocType", "Support Ticket", "Issue", force=True)
erpnext.patches.v5_0.set_default_company_in_bom erpnext.patches.v5_0.set_default_company_in_bom
erpnext.patches.v5_0.capacity_planning erpnext.patches.v5_0.capacity_planning
execute:frappe.reload_doc('crm', 'doctype', 'lead')
execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
erpnext.patches.v5_0.rename_table_fieldnames erpnext.patches.v5_0.rename_table_fieldnames
execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''") execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
erpnext.patches.v4_2.party_model erpnext.patches.v4_2.party_model
@@ -108,6 +110,9 @@ erpnext.patches.v5_0.remove_shopping_cart_app
erpnext.patches.v5_0.update_companywise_payment_account erpnext.patches.v5_0.update_companywise_payment_account
erpnext.patches.v5_0.remove_birthday_events erpnext.patches.v5_0.remove_birthday_events
erpnext.patches.v5_0.update_item_name_in_bom erpnext.patches.v5_0.update_item_name_in_bom
erpnext.patches.v5_0.rename_customer_issue
erpnext.patches.v5_0.rename_total_fields
erpnext.patches.v5_0.replace_renamed_fields_in_custom_script_and_print_formats
erpnext.patches.v5_0.new_crm_module erpnext.patches.v5_0.new_crm_module
erpnext.patches.v5_0.rename_customer_issue erpnext.patches.v5_0.rename_customer_issue
erpnext.patches.v5_0.update_material_transfer_for_manufacture erpnext.patches.v5_0.update_material_transfer_for_manufacture

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

@@ -2,4 +2,4 @@ import frappe
def execute(): def execute():
if frappe.db.table_exists("tabCustomer Issue"): if frappe.db.table_exists("tabCustomer Issue"):
frappe.rename_doc("DocType", "Customer Issue", "Warrany Claim") frappe.rename_doc("DocType", "Customer Issue", "Warranty Claim")

View File

@@ -105,7 +105,6 @@ rename_map = {
["experience_in_company_details", "internal_work_history"] ["experience_in_company_details", "internal_work_history"]
], ],
"Event": [ "Event": [
["event_individuals", "users"],
["event_roles", "roles"] ["event_roles", "roles"]
], ],
"Expense Claim": [ "Expense Claim": [

View File

@@ -8,7 +8,7 @@ from frappe.modules import scrub, get_doctype_module
selling_doctypes = ("Quotation", "Sales Order", "Delivery Note", "Sales Invoice") selling_doctypes = ("Quotation", "Sales Order", "Delivery Note", "Sales Invoice")
selling_doctypes = ("Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice") buying_doctypes = ("Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice")
selling_renamed_fields = ( selling_renamed_fields = (
("net_total", "base_net_total"), ("net_total", "base_net_total"),
@@ -47,4 +47,5 @@ def execute():
rename_field(dt, f[0], f[1]) rename_field(dt, f[0], f[1])
# Added new field "total_taxes_and_charges" in buying cycle, updating value # Added new field "total_taxes_and_charges" in buying cycle, updating value
frappe.db.sql("update `tab{0}` set total_taxes_and_charges=round(base_total_taxes_and_charges/conversion_rate), 2") frappe.db.sql("""update `tab{0}`
set total_taxes_and_charges = round(base_total_taxes_and_charges/conversion_rate, 2)""".format(dt))

View File

@@ -43,7 +43,7 @@ def get_all_renamed_fields():
) )
for fields in rename_map.values(): for fields in rename_map.values():
renamed_fields += fields renamed_fields += tuple(fields)
return renamed_fields return renamed_fields

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"];
} }
} }