Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index c4ed73c..af9de92 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -421,8 +421,8 @@
 				raise Exception
 
 	def validate_pos(self):
-		if not self.doc.cash_bank_account:
-			msgprint("Cash/Bank Account is mandatory for POS entry")
+		if not self.doc.cash_bank_account and flt(self.doc.paid_amount):
+			msgprint("Cash/Bank Account is mandatory for POS, for making payment entry")
 			raise Exception
 		if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001:
 			msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
@@ -676,8 +676,14 @@
 					if not d.warehouse:
 						d.warehouse = cstr(w)
 
-			if flt(self.doc.paid_amount) == 0: 
-				webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
+			if flt(self.doc.paid_amount) == 0:
+				if self.doc.cash_bank_account: 
+					webnotes.conn.set(self.doc, 'paid_amount', 
+						(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
+				else:
+					# show message that the amount is not paid
+					webnotes.conn.set(self.doc,'paid_amount',0)
+					webnotes.msgprint("Note: Payment Entry not created since 'Cash/Bank Account' was not specified.")
 
 		else:
 			webnotes.conn.set(self.doc,'paid_amount',0)
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 5157f7c..e230e0f 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -407,9 +407,21 @@
 		if not default_currency:
 			msgprint('Message: Please enter default currency in Company Master')
 			raise Exception
-		if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
-			msgprint("Message: Please Enter Appropriate Conversion Rate.")
-			raise Exception
+			
+		if obj.doc.conversion_rate == 0:
+			msgprint('Conversion Rate cannot be 0', raise_exception=1)
+		elif not obj.doc.conversion_rate:
+			msgprint('Please specify Conversion Rate', raise_exception=1)
+		elif obj.doc.currency == default_currency and \
+				flt(obj.doc.conversion_rate) != 1.00:
+			msgprint("""Conversion Rate should be equal to 1.00, \
+						since the specified Currency and the company's currency \
+						are same""", raise_exception=1)
+		elif obj.doc.currency != default_currency and \
+				flt(obj.doc.conversion_rate) == 1.00:
+			msgprint("""Conversion Rate should not be equal to 1.00, \
+						since the specified Currency and the company's currency \
+						are different""", raise_exception=1)
 
 	def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname):
 		if prevdoc_docname :
diff --git a/erpnext/patches/may_2012/remove_euro_currency.py b/erpnext/patches/may_2012/remove_euro_currency.py
new file mode 100644
index 0000000..775532f
--- /dev/null
+++ b/erpnext/patches/may_2012/remove_euro_currency.py
@@ -0,0 +1,16 @@
+def execute():
+	"""
+		* Replace EURO with EUR
+		* Delete EURO from tabCurrency
+	"""
+	import webnotes
+	tables = webnotes.conn.sql("show tables")
+	for (tab,) in tables:
+		desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1)
+		for d in desc:
+			if "currency" in d.get('Field'):
+				field = d.get('Field')
+				webnotes.conn.sql("""\
+					update `%s` set `%s`='EUR'
+					where `%s`='EURO'""" % (tab, field, field))
+	webnotes.conn.sql("delete from `tabCurrency` where name='EURO'")
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index f8738e5..71c9436 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -402,4 +402,9 @@
 		'patch_file': 'profile_perm_patch',
 		'description': 'Make profile readonly for role All'
 	},
+	{
+		'patch_module': 'patches.may_2012',
+		'patch_file': 'remove_euro_currency',
+		'description': 'Remove EURO currency and replace with EUR'
+	},
 ]
\ No newline at end of file
diff --git a/erpnext/production/doctype/production_order/production_order.txt b/erpnext/production/doctype/production_order/production_order.txt
index 62aa610..c244399 100644
--- a/erpnext/production/doctype/production_order/production_order.txt
+++ b/erpnext/production/doctype/production_order/production_order.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:36:05',
+		'creation': '2012-05-15 12:14:48',
 		'docstatus': 0,
-		'modified': '2012-03-27 14:45:50',
+		'modified': '2012-05-28 19:03:56',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -23,7 +23,7 @@
 		'section_style': u'Tabbed',
 		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'version': 190
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -323,6 +323,7 @@
 		'fieldname': u'produced_qty',
 		'fieldtype': u'Currency',
 		'label': u'Produced Qty',
+		'no_copy': 1,
 		'oldfieldname': u'produced_qty',
 		'oldfieldtype': u'Currency',
 		'permlevel': 1
diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py
index 5975e32..7c5bfad 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.py
+++ b/erpnext/selling/doctype/sales_common/sales_common.py
@@ -207,21 +207,32 @@
 			if default: add_cond = 'ifnull(t2.is_default,0) = 1'
 			else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
 			idx = 0
-			other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabSales Taxes and Charges` t1, `tabSales Taxes and Charges Master` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
+			other_charge = webnotes.conn.sql("""\
+				select t1.*
+				from
+					`tabSales Taxes and Charges` t1,
+					`tabSales Taxes and Charges Master` t2
+				where
+					t1.parent = t2.name and
+					t2.company = '%s' and
+					%s
+				order by t1.idx""" % (obj.doc.company, add_cond), as_dict=1)
+			from webnotes.model import default_fields
 			for other in other_charge:
-				d =	addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, obj.doclist)
-				d.charge_type = other['charge_type']
-				d.row_id = other['row_id']
-				d.description = other['description']
-				d.account_head = other['account_head']
-				d.cost_center_other_charges = other['cost_center_other_charges']
-				d.rate = flt(other['rate'])
-				d.tax_amount = flt(other['tax_amount'])
-				d.included_in_print_rate = cint(other['included_in_print_rate'])
+				# remove default fields like parent, parenttype etc.
+				# from query results
+				for field in default_fields:
+					if field in other: del other[field]
+
+				d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1,
+						obj.doclist)
+				d.fields.update(other)
+				d.rate = flt(d.rate)
+				d.tax_amount = flt(d.tax_rate)
+				d.included_in_print_rate = cint(d.included_in_print_rate)
 				d.idx = idx
 				idx += 1
 			
-			
 	# Get TERMS AND CONDITIONS
 	# =======================================================================================
 	def get_tc_details(self,obj):
diff --git a/erpnext/utilities/doctype/address/address.js b/erpnext/utilities/doctype/address/address.js
index 8949c5a..c4631f8 100644
--- a/erpnext/utilities/doctype/address/address.js
+++ b/erpnext/utilities/doctype/address/address.js
@@ -20,17 +20,17 @@
 	
 	var route = wn.get_route();
 	if(route[1]=='Supplier') {
-		var supplier = locals.Supplier[route[2]]
+		var supplier = wn.container.page.frm.doc;
 		doc.supplier = supplier.name;
 		doc.supplier_name = supplier.supplier_name;
 		doc.address_type = 'Office';
 	} else if(route[1]=='Customer') {
-		var customer = locals.Customer[route[2]]
+		var customer = wn.container.page.frm.doc;
 		doc.customer = customer.name;
 		doc.customer_name = customer.customer_name;
 		doc.address_type = 'Office';
 	} else if(route[1]=='Sales Partner') {
-		var sp = locals['Sales Partner'][route[2]];
+		var sp = wn.container.page.frm.doc;
 		doc.sales_partner = sp.name;
 		doc.address_type = 'Office';				
 	}
diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js
index ae06ed4..1b0894e 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -21,18 +21,18 @@
 
 	var route = wn.get_route();
 	if(route[1]=='Supplier') {
-		var supplier = locals.Supplier[route[2]]
+		var supplier = wn.container.page.frm.doc;
 		doc.supplier = supplier.name;
 		doc.supplier_name = supplier.supplier_name;
 	} else if(route[1]=='Customer') {
-		var customer = locals.Customer[route[2]];
+		var customer = wn.container.page.frm.doc;
 		doc.customer = customer.name;
 		doc.customer_name = customer.customer_name;
 		if(customer.customer_type == 'Individual') {
 			doc.first_name = customer.customer_name;
 		}		
 	} else if(route[1]=='Sales Partner') {
-		var sp = locals['Sales Partner'][route[2]];
+		var sp = wn.container.page.frm.doc;
 		doc.sales_partner = sp.name;
 	}
 }
diff --git a/public/css/fonts/marckscript.woff b/public/css/fonts/marckscript.woff
new file mode 100644
index 0000000..e5f1f0b
--- /dev/null
+++ b/public/css/fonts/marckscript.woff
Binary files differ