From 45805622e4bc68f1e35f2c8e578c63a5218444c7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Feb 2016 11:06:02 +0530 Subject: [PATCH 1/2] [fix] Serial no query in Quality Inspection --- .../quality_inspection/quality_inspection.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js index 1f7134dfcd..628337b2c3 100644 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.js +++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.js @@ -46,18 +46,23 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { // Serial No based on item_code cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) { - var filter = {}; + var filters = {}; if (doc.item_code) { - filter = { - 'item_code': doc.item_code, - 'status': "Available" + filters = { + 'item_code': doc.item_code } - } else - filter = { 'status': "Available" } - - return { filters: filter } + } + return { filters: filters } } +cur_frm.set_query("batch_no", function(doc) { + return { + filters: { + "item": doc.item_code + } + } +}) + cur_frm.add_fetch('item_code', 'item_name', 'item_name'); cur_frm.add_fetch('item_code', 'description', 'description'); From 289ffb788c46c5a63d423feac12d054166436201 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Feb 2016 11:06:55 +0530 Subject: [PATCH 2/2] [fix] Advance adjustment in invoice cannot be greater than grand total --- erpnext/controllers/taxes_and_totals.py | 10 ++++++++++ erpnext/crm/doctype/newsletter/newsletter.json | 18 +++++++++++++++--- .../selling/doctype/sales_order/sales_order.py | 3 +++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index f4fb8a9c4f..d4d4de0edf 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -397,6 +397,16 @@ class calculate_taxes_and_totals(object): 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 348b12b22e..d93f88efbd 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 aafb0df278..e692d6bb0e 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -432,6 +432,9 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): doclist = get_mapped_doc("Sales Order", source_name, { "Sales Order": { "doctype": "Sales Invoice", + "field_map": { + "party_account_currency": "party_account_currency" + }, "validation": { "docstatus": ["=", 1] }