From b553b7a69d3ef907584f8412b9697837e05a5322 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 7 Feb 2018 18:32:51 +0530 Subject: [PATCH 1/6] PDC Enhancements (#12462) --- .../doctype/sales_invoice/sales_invoice.json | 122 ++++++++++- .../accounts_receivable.html | 133 ++++++++++-- .../accounts_receivable.js | 5 + .../accounts_receivable.py | 70 ++++++- .../doctype/sales_order/sales_order.json | 4 +- .../doctype/sales_order/sales_order.py | 11 +- .../doctype/delivery_note/delivery_note.json | 196 ++++++++++++------ 7 files changed, 447 insertions(+), 94 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index d1e64bc520..e00f075f85 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -639,6 +639,126 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "po_no", + "columns": 0, + "fieldname": "customer_po_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer PO Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "po_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer's Purchase Order", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_23", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "po_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer's Purchase Order Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -4563,7 +4683,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-12-20 17:36:05.216046", + "modified": "2018-01-12 15:19:54.711885", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 9d872a49f0..b622ab499e 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -1,3 +1,11 @@ + +

{%= __(report.report_name) %}

{%= filters.customer || filters.supplier %}

@@ -6,17 +14,90 @@ {%= dateutil.str_to_user(filters.report_date) %}

+{% if(filters.show_pdc_in_print) { %} + {% var balance_row = data.slice(-1).pop(); + var range1 = report.columns[11].label; + var range2 = report.columns[12].label; + var range3 = report.columns[13].label; + var range4 = report.columns[14].label; + %} + {% if(balance_row) { %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
(Amount in {%= data[0][__("currency")] || "" %})
{%= __(" ") %}{%= __(range1) %}{%= __(range2) %}{%= __(range3) %}{%= __(range4) %}{%= __("Total") %}
{%= __("Total Outstanding") %}{%= format_currency(balance_row[range1]) %}{%= format_currency(balance_row[range2]) %}{%= format_currency(balance_row[range3]) %}{%= format_currency(balance_row[range4]) %} + {%= format_currency(flt(balance_row[__("Outstanding Amount")]), data[data.length-1]["currency"]) %} +
{%= __("PDC/LC") %} + {%= format_currency(flt(balance_row[__("PDC/LC Amount")]), data[data.length-1]["currency"]) %} +
+ {% } %} +{% } %} {% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %} - - - + + + - - - + {% if(!filters.show_pdc_in_print) { %} + + + {% } %} + + {% if(filters.show_pdc_in_print) { %} + {% if(report.report_name === "Accounts Receivable") { %} + + {% } %} + + + + {% } %} {% } else { %} @@ -48,23 +129,49 @@ - - + + {% if(!filters.show_pdc_in_print) { %} + + + {% } %} + + {% if(filters.show_pdc_in_print) { %} + {% if(report.report_name === "Accounts Receivable") { %} + + {% } %} + + + + {% } %} {% } else { %} - - + + {% if(!filters.show_pdc_in_print) { %} + + + {% } %} + + {% if(filters.show_pdc_in_print) { %} + {% if(report.report_name === "Accounts Receivable") { %} + + {% } %} + + + + {% } %} {% } %} {% } else { %} {% if(data[i][__("Customer")] || data[i][__("Supplier")]|| " ") { %} diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index fd5241b1ff..67483984b9 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -64,6 +64,11 @@ frappe.query_reports["Accounts Receivable"] = { "fieldtype": "Int", "default": "90", "reqd": 1 + }, + { + "fieldname":"show_pdc_in_print", + "label": __("Show PDC in Print"), + "fieldtype": "Check", } ], diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 0732b7dc09..e046755b15 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -72,6 +72,18 @@ class ReceivablePayableReport(object): "options": "Currency", "width": 100 }) + + columns += [ + _("PDC/LC Date") + ":Date:110", + _("PDC/LC Ref") + ":Data:110", + _("PDC/LC Amount") + ":Currency/currency:130", + _("Remaining Balance") + ":Currency/currency:130" + ] + + if args.get('party_type') == 'Customer': + columns += [_("Customer LPO") + ":Data:100"] + columns += [_("Delivery Note") + ":Data:100"] + if args.get("party_type") == "Customer": columns += [ _("Territory") + ":Link/Territory:80", @@ -89,7 +101,8 @@ class ReceivablePayableReport(object): currency_precision = get_currency_precision() or 2 dr_or_cr = "debit" if args.get("party_type") == "Customer" else "credit" - voucher_details = self.get_voucher_details(args.get("party_type")) + dn_details = get_dn_details(args.get("party_type")) + voucher_details = self.get_voucher_details(args.get("party_type"), dn_details) future_vouchers = self.get_entries_after(self.filters.report_date, args.get("party_type")) @@ -101,6 +114,8 @@ class ReceivablePayableReport(object): return_entries = self.get_return_entries(args.get("party_type")) data = [] + pdc_details = get_pdc_details(args.get("party_type")) + for gle in self.get_entries_till(self.filters.report_date, args.get("party_type")): if self.is_receivable_or_payable(gle, dr_or_cr, future_vouchers): outstanding_amount, credit_note_amount = self.get_outstanding_amount(gle, @@ -144,6 +159,18 @@ class ReceivablePayableReport(object): else: row.append(company_currency) + pdc = pdc_details.get(gle.voucher_no, {}) + remaining_balance = outstanding_amount - flt(pdc.get("pdc_amount")) + row += [pdc.get("pdc_date"), pdc.get("pdc_ref"), + flt(pdc.get("pdc_amount")), remaining_balance] + + if args.get('party_type') == 'Customer': + # customer LPO + row += [voucher_details.get(gle.voucher_no, {}).get("po_no")] + + # Delivery Note + row += [voucher_details.get(gle.voucher_no, {}).get("delivery_note")] + # customer territory / supplier type if args.get("party_type") == "Customer": row += [self.get_territory(gle.party), self.get_customer_group(gle.party)] @@ -225,12 +252,13 @@ class ReceivablePayableReport(object): return self.party_map - def get_voucher_details(self, party_type): + def get_voucher_details(self, party_type, dn_details): voucher_details = frappe._dict() if party_type == "Customer": - for si in frappe.db.sql("""select name, due_date + for si in frappe.db.sql("""select name, due_date, po_no from `tabSales Invoice` where docstatus=1""", as_dict=1): + si['delivery_note'] = dn_details.get(si.name) voucher_details.setdefault(si.name, si) if party_type == "Supplier": @@ -347,3 +375,39 @@ def get_ageing_data(first_range, second_range, third_range, age_as_on, entry_dat outstanding_range[index] = outstanding_amount return [age] + outstanding_range + +def get_pdc_details(party_type): + pdc_details = frappe._dict() + + for pdc in frappe.db.sql(""" + select + pref.reference_name as invoice_no, pent.party, pent.party_type, + max(pent.reference_date) as pdc_date, sum(ifnull(pref.allocated_amount,0)) as pdc_amount, + GROUP_CONCAT(pent.reference_no SEPARATOR ', ') as pdc_ref + from + `tabPayment Entry` as pent inner join `tabPayment Entry Reference` as pref + on + (pref.parent = pent.name) + where + pent.docstatus = 0 and pent.reference_date > pent.posting_date + and pent.party_type = %s + group by pref.reference_name""", party_type, as_dict=1): + pdc_details.setdefault(pdc.invoice_no, pdc) + + return pdc_details + +def get_dn_details(party_type): + dn_details = frappe._dict() + + if party_type == "Customer": + for si in frappe.db.sql("""select parent, GROUP_CONCAT(delivery_note SEPARATOR ', ') as dn + from `tabSales Invoice Item` + where docstatus=1 and delivery_note is not null and delivery_note != '' group by parent + Union + select against_sales_invoice as parent, GROUP_CONCAT(parent SEPARATOR ', ') as dn + from `tabDelivery Note Item` + where docstatus=1 and against_sales_invoice is not null + and against_sales_invoice != '' group by against_sales_invoice""", as_dict=1): + dn_details.setdefault(si.parent, si.dn) + + return dn_details diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index 7c23687eef..f302c1cd1c 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -3529,8 +3529,8 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-12-19 14:51:52.710612", - "modified_by": "nabinhait@gmail.com", + "modified": "2018-01-12 15:56:12.483019", + "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", "owner": "Administrator", diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 42cde9f2fd..084a218005 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -476,13 +476,10 @@ def make_project(source_name, target_doc=None): @frappe.whitelist() def make_delivery_note(source_name, target_doc=None): def set_missing_values(source, target): - if source.po_no: - if target.po_no: - target_po_no = target.po_no.split(", ") - target_po_no.append(source.po_no) - target.po_no = ", ".join(list(set(target_po_no))) if len(target_po_no) > 1 else target_po_no[0] - else: - target.po_no = source.po_no + so = [d.against_sales_order for d in target.items] + if so: + po_no_list = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', so)}) + target.po_no = ', '.join(d.po_no for d in po_no_list if d.po_no) target.ignore_pricing_rule = 1 target.run_method("set_missing_values") diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index 1f944e46f4..f126b581d9 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -398,73 +398,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "po_no", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer's Purchase Order No", - "length": 0, - "no_copy": 0, - "oldfieldname": "po_no", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": "100px", - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "100px" - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "eval:doc.po_no", - "fieldname": "po_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Customer's Purchase Order Date", - "length": 0, - "no_copy": 0, - "oldfieldname": "po_date", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": "100px", - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "100px" - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -527,6 +460,133 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "po_no", + "columns": 0, + "fieldname": "customer_po_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer PO Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "po_no", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer's Purchase Order No", + "length": 0, + "no_copy": 0, + "oldfieldname": "po_no", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "100px" + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_17", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval:doc.po_no", + "fieldname": "po_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Customer's Purchase Order Date", + "length": 0, + "no_copy": 0, + "oldfieldname": "po_date", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "100px" + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -3641,7 +3701,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-11-29 14:13:32.770027", + "modified": "2018-01-12 15:27:44.471335", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", From 056c1709c6b60aebd623c293b2b92fceb7aaa709 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 8 Feb 2018 00:22:53 +0530 Subject: [PATCH 2/6] Fixes #12810 --- .../page/point_of_sale/point_of_sale.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index 1d884cc136..9484dc7029 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -768,11 +768,19 @@ class POSCart { return; } - const item_code = this.selected_item.attr('data-item-code'); - const field = this.selected_item.active_field; - const value = this.numpad.get_value(); + if (this.selected_item.active_field == 'discount_percentage' && this.numpad.get_value() > cint(100)) { + frappe.show_alert({ + indicator: 'red', + message: __('Discount amount cannot be greater than 100%') + }); + this.numpad.reset_value(); + } else { + const item_code = this.selected_item.attr('data-item-code'); + const field = this.selected_item.active_field; + const value = this.numpad.get_value(); - this.events.on_field_change(item_code, field, value); + this.events.on_field_change(item_code, field, value); + } } this.events.on_numpad(btn_value); @@ -1588,4 +1596,4 @@ class Payment { this.dialog.set_value("paid_amount", this.frm.doc.paid_amount); this.dialog.set_value("outstanding_amount", this.frm.doc.outstanding_amount); } -} +} \ No newline at end of file From 1a4d77a962dd21b2e977554a873e38855f0ee6fa Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 8 Feb 2018 01:32:48 +0530 Subject: [PATCH 3/6] Fixes #12810 for Offline POS --- erpnext/accounts/page/pos/pos.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index d779de0da0..29f27fb70c 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -1177,8 +1177,17 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ $(this.wrapper).on("change", ".pos-item-disc", function () { var item_code = $(this).parents(".pos-selected-item-action").attr("data-item-code"); var discount = $(this).val(); - me.update_discount(item_code, discount) - me.update_value() + if(discount > 100){ + discount = $(this).val(''); + frappe.show_alert({ + indicator: 'red', + message: __('Discount amount cannot be greater than 100%') + }); + me.update_discount(item_code, discount); + }else{ + me.update_discount(item_code, discount); + me.update_value(); + } }) }, @@ -2006,4 +2015,4 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ frappe.throw(__("LocalStorage is full , did not save")) } } -}) +}) \ No newline at end of file From f7717b9ec2a8cc4339134e7b17ba72293978c52c Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 8 Feb 2018 11:09:54 +0530 Subject: [PATCH 4/6] get_party_account only if company is set --- erpnext/public/js/controllers/transaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index eb333af1ed..c5c9973b7a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -458,7 +458,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } var party = me.frm.doc[frappe.model.scrub(party_type)]; - if(party) { + if(party && me.frm.doc.company) { return frappe.call({ method: "erpnext.accounts.party.get_party_account", args: { From 6041f5cb8cce8005e95886d6d9a8258835914107 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 8 Feb 2018 13:33:52 +0530 Subject: [PATCH 5/6] [hotfix] Advance Total validation --- erpnext/controllers/taxes_and_totals.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 0e35cb89e6..699e1c608f 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -415,13 +415,15 @@ class calculate_taxes_and_totals(object): self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) + grand_total = self.doc.rounded_total or self.doc.grand_total + if self.doc.party_account_currency == self.doc.currency: - invoice_total = flt(self.doc.grand_total - flt(self.doc.write_off_amount), + invoice_total = flt(grand_total - flt(self.doc.write_off_amount), self.doc.precision("grand_total")) else: base_write_off_amount = flt(flt(self.doc.write_off_amount) * self.doc.conversion_rate, self.doc.precision("base_write_off_amount")) - invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate, + invoice_total = flt(grand_total * self.doc.conversion_rate, self.doc.precision("grand_total")) - base_write_off_amount if invoice_total > 0 and self.doc.total_advance > invoice_total: From c1f982a9bbb5b8c4a520501704923a81d2386c5a Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 8 Feb 2018 15:34:25 +0600 Subject: [PATCH 6/6] bumped to version 10.0.21 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ff8701a140..32f1e01fcf 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.0.20' +__version__ = '10.0.21' def get_default_company(user=None): '''Get default company for user'''
{%= __("Date") %}{%= __("Ref") %}{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %}{%= __("Date") %}{%= __("Ref") %}{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %} {%= __("Invoiced Amount") %}{%= __("Paid Amount") %}{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}{%= __("Outstanding Amount") %}{%= __("Paid Amount") %}{%= report.report_name === "Accounts Receivable" ? __('Credit Note') : __('Debit Note') %}{%= __("Outstanding Amount") %}{%= __("Customer LPO No.") %}{%= __("PDC/LC Date") %}{%= __("PDC/LC Ref") %}{%= __("PDC/LC Amount") %}{%= (filters.customer || filters.supplier) ? __("Remarks"): __("Party") %} {%= __("Total Invoiced Amount") %} {%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"]) %} - {%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %} - {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} + {%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %} + {%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} {%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %} + {%= data[i][__("Customer LPO")] %}{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}{%= data[i][__("PDC/LC Ref")] %}{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %} {%= __("Total") %} {%= format_currency(data[i]["Invoiced Amount"], data[i]["currency"] ) %} - {%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} + {%= format_currency(data[i]["Paid Amount"], data[i]["currency"]) %}{%= report.report_name === "Accounts Receivable" ? format_currency(data[i]["Credit Note"], data[i]["currency"]) : format_currency(data[i]["Debit Note"], data[i]["currency"]) %} {%= format_currency(data[i]["Outstanding Amount"], data[i]["currency"]) %} + {%= data[i][__("Customer LPO")] %}{%= frappe.datetime.str_to_user(data[i][__("PDC/LC Date")]) %}{%= data[i][__("PDC/LC Ref")] %}{%= format_currency(data[i][__("PDC/LC Amount")], data[i]["currency"]) %}