[fix] Advance adjustment in invoice cannot be greater than grand total
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index f4fb8a9..d4d4de0 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -397,6 +397,16 @@
for adv in self.doc.get("advances")])
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
+
+ if self.doc.party_account_currency == self.doc.currency:
+ invoice_total = self.doc.grand_total
+ else:
+ invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
+ self.doc.precision("grand_total"))
+
+ if self.doc.total_advance > invoice_total:
+ frappe.throw(_("Advance amount cannot be greater than {0} {1}")
+ .format(self.doc.party_account_currency, invoice_total))
if self.doc.docstatus == 0:
self.calculate_outstanding_amount()
diff --git a/erpnext/crm/doctype/newsletter/newsletter.json b/erpnext/crm/doctype/newsletter/newsletter.json
index 348b12b..d93f88e 100644
--- a/erpnext/crm/doctype/newsletter/newsletter.json
+++ b/erpnext/crm/doctype/newsletter/newsletter.json
@@ -1,7 +1,7 @@
{
"allow_copy": 0,
"allow_import": 0,
- "allow_rename": 0,
+ "allow_rename": 1,
"autoname": "field:subject",
"creation": "2013-01-10 16:34:31",
"custom": 0,
@@ -27,6 +27,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -49,6 +50,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -72,6 +74,7 @@
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -94,6 +97,7 @@
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -116,6 +120,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -138,6 +143,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -161,6 +167,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -184,6 +191,7 @@
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -207,6 +215,7 @@
"options": "test_send",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -225,7 +234,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2015-11-16 06:29:50.506090",
+ "menu_index": 0,
+ "modified": "2016-02-05 11:48:43.081204",
"modified_by": "Administrator",
"module": "CRM",
"name": "Newsletter",
@@ -254,5 +264,7 @@
],
"read_only": 0,
"read_only_onload": 0,
- "title_field": "subject"
+ "sort_order": "ASC",
+ "title_field": "subject",
+ "version": 0
}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index aafb0df..e692d6b 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -432,6 +432,9 @@
doclist = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
"doctype": "Sales Invoice",
+ "field_map": {
+ "party_account_currency": "party_account_currency"
+ },
"validation": {
"docstatus": ["=", 1]
}