Merge pull request #2734 from neilLasrado/kill-html-desc

Kill html desc -WIP
diff --git a/erpnext/projects/doctype/activity_type/activity_type.json b/erpnext/projects/doctype/activity_type/activity_type.json
index 9d1e15a..7be34dc 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.json
+++ b/erpnext/projects/doctype/activity_type/activity_type.json
@@ -19,7 +19,7 @@
  "icon": "icon-flag", 
  "idx": 1, 
  "in_dialog": 0, 
- "modified": "2015-02-05 05:11:34.201187", 
+ "modified": "2015-02-18 13:05:23.608066", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Activity Type", 
@@ -27,7 +27,10 @@
  "permissions": [
   {
    "create": 1, 
+   "delete": 1, 
    "email": 1, 
+   "export": 1, 
+   "import": 1, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -39,6 +42,7 @@
   {
    "apply_user_permissions": 1, 
    "create": 1, 
+   "delete": 0, 
    "email": 1, 
    "permlevel": 0, 
    "print": 1, 
diff --git a/erpnext/projects/doctype/activity_type/activity_type.py b/erpnext/projects/doctype/activity_type/activity_type.py
index 7e316b5..cc43e82 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.py
+++ b/erpnext/projects/doctype/activity_type/activity_type.py
@@ -3,14 +3,17 @@
 
 from __future__ import unicode_literals
 import frappe
-
+from frappe import _
 from frappe.model.document import Document
 
 class ActivityType(Document):
 	
 	def on_trash(self):
 		self.validate_manufacturing_type()
-		
+
+	def before_rename(self, olddn, newdn, merge=False):
+		self.validate_manufacturing_type()
+
 	def validate_manufacturing_type(self):
 		if self.activity_type == 'Manufacturing':
-			frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted."))
\ No newline at end of file
+			frappe.throw(_("Activity Type 'Manufacturing' cannot be deleted/renamed."))
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 527cbf3..f738c4a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -145,6 +145,11 @@
 		var d = locals[cdt][cdn];
 		d.transfer_qty = flt(d.qty) * flt(d.conversion_factor);
 		refresh_field('items');
+		calculate_total(doc, cdt, cdn);
+	},
+	
+	incoming_rate: function(doc, cdt, cdn) {
+		calculate_total(doc, cdt, cdn);
 	},
 
 	production_order: function() {
@@ -487,3 +492,16 @@
 cur_frm.cscript.posting_date = function(doc, cdt, cdn){
 	erpnext.get_fiscal_year(doc.company, doc.posting_date);
 }
+
+var calculate_total = function(doc, cdt, cdn){
+	var d = locals[cdt][cdn];
+	amount = flt(d.incoming_rate) * flt(d.transfer_qty)
+	frappe.model.set_value(cdt, cdn, 'amount', amount);
+	var total_amount = 0.0;
+	var items = doc.items || [];
+	for(var i=0;i<items.length;i++) {
+		total_amount += flt(items[i].amount);
+	}
+	doc.total_amount = total_amount;
+	refresh_field("total_amount");
+}