From ff231b5e62202384986ae209c5e190644a8bc2a6 Mon Sep 17 00:00:00 2001 From: ankitjavalkarwork Date: Fri, 10 Oct 2014 13:13:39 +0530 Subject: [PATCH 1/4] Allow advance JV payments in Accounts Receivable/Payable --- erpnext/accounts/report/accounts_payable/accounts_payable.py | 3 ++- .../accounts/report/accounts_receivable/accounts_receivable.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.py b/erpnext/accounts/report/accounts_payable/accounts_payable.py index 3ae741e772..5ce2c562a3 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.py +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.py @@ -30,7 +30,8 @@ def execute(filters=None): data = [] for gle in entries: if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \ - or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date: + or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date \ + or (gle.against_voucher_type == "Purchase Order"): voucher_details = voucher_detail_map.get(gle.voucher_type, {}).get(gle.voucher_no, {}) invoiced_amount = gle.credit > 0 and gle.credit or 0 diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 3a0fb31dea..3dc81d1341 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -79,6 +79,9 @@ class AccountsReceivableReport(object): return ( # advance (not gle.against_voucher) or + + # against sales order + (gle.against_voucher_type == "Sales Order") or # sales invoice (gle.against_voucher==gle.voucher_no and gle.debit > 0) or From 6d83454237d77fe9c484fa6f1e03dfad1af5cdee Mon Sep 17 00:00:00 2001 From: ankitjavalkarwork Date: Fri, 10 Oct 2014 13:30:10 +0530 Subject: [PATCH 2/4] Disallow Stopped Orders in Against Voucher table --- erpnext/accounts/doctype/payment_tool/payment_tool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.py b/erpnext/accounts/doctype/payment_tool/payment_tool.py index d8d6df3da2..578a3168ea 100644 --- a/erpnext/accounts/doctype/payment_tool/payment_tool.py +++ b/erpnext/accounts/doctype/payment_tool/payment_tool.py @@ -91,6 +91,7 @@ def get_orders_to_be_billed(party_type, party_name): where %s = %s and docstatus = 1 + and ifnull(status, "") != "Stopped" and ifnull(grand_total, 0) > ifnull(advance_paid, 0) and ifnull(per_billed, 0) < 100.0 """ % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'), From 9a4b173b88cf73868131640777ba27a824d2746b Mon Sep 17 00:00:00 2001 From: ankitjavalkarwork Date: Fri, 10 Oct 2014 16:28:41 +0530 Subject: [PATCH 3/4] Add validation for stopped orders, advance payment in journal voucher --- .../doctype/journal_voucher/journal_voucher.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py index 7bf6fcc54e..719a7057cc 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py @@ -76,13 +76,14 @@ class JournalVoucher(AccountsController): def validate_entries_for_advance(self): for d in self.get('entries'): - if not d.is_advance and not d.against_voucher and \ - not d.against_invoice and not d.against_jv: + if not (d.against_voucher and d.against_invoice and d.against_jv) and d.is_advance in ["", "No"]: master_type = frappe.db.get_value("Account", d.account, "master_type") if (master_type == 'Customer' and flt(d.credit) > 0) or \ (master_type == 'Supplier' and flt(d.debit) > 0): msgprint(_("Row {0}: Please check 'Is Advance' against Account {1} if this \ is an advance entry.").format(d.idx, d.account)) + if d.against_sales_order or d.against_purchase_order: + raise frappe.ValidationError def validate_against_jv(self): for d in self.get('entries'): @@ -177,7 +178,7 @@ class JournalVoucher(AccountsController): def validate_against_order_fields(self, doctype, payment_against_voucher): for voucher_no, payment_list in payment_against_voucher.items(): voucher_properties = frappe.db.get_value(doctype, voucher_no, - ["docstatus", "per_billed", "advance_paid", "grand_total"]) + ["docstatus", "per_billed", "status", "advance_paid", "grand_total"]) if voucher_properties[0] != 1: frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no)) @@ -185,7 +186,10 @@ class JournalVoucher(AccountsController): if flt(voucher_properties[1]) >= 100: frappe.throw(_("{0} {1} is fully billed").format(doctype, voucher_no)) - if flt(voucher_properties[3]) < flt(voucher_properties[2]) + flt(sum(payment_list)): + if cstr(voucher_properties[2]) == "Stopped": + frappe.throw(_("{0} {1} is stopped").format(doctype, voucher_no)) + + if flt(voucher_properties[4]) < flt(voucher_properties[3]) + flt(sum(payment_list)): frappe.throw(_("Advance paid against {0} {1} cannot be greater \ than Grand Total {2}").format(doctype, voucher_no, voucher_properties[3])) From 0cf4cc283c7722c516806b573dca9accf511c861 Mon Sep 17 00:00:00 2001 From: ankitjavalkarwork Date: Fri, 10 Oct 2014 16:55:03 +0530 Subject: [PATCH 4/4] Add Shipping Addr to Sales Invoice --- .../doctype/sales_invoice/sales_invoice.json | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index e9bb996f76..3dcf136d45 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -168,6 +168,27 @@ "reqd": 1, "search_index": 0 }, + { + "fieldname": "shipping_address_name", + "fieldtype": "Link", + "hidden": 1, + "in_filter": 1, + "label": "Shipping Address Name", + "options": "Address", + "permlevel": 0, + "precision": "", + "print_hide": 1 + }, + { + "fieldname": "shipping_address", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Shipping Address", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "read_only": 1 + }, { "fieldname": "currency_section", "fieldtype": "Section Break", @@ -1192,7 +1213,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2014-10-08 14:23:05.034326", + "modified": "2014-10-10 16:54:22.284284", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice",