From 36bb3f55f2a90c6748775d78c0a0e1dd0ff6ea9d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Apr 2019 14:47:44 +0530 Subject: [PATCH 01/26] fix: Added invoice discounting dashboard --- .../invoice_discounting_dashboard.py | 20 +++++++++++++++++++ erpnext/config/accounting.py | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py new file mode 100644 index 0000000000..6523cd3cdb --- /dev/null +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py @@ -0,0 +1,20 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return { + 'fieldname': 'reference_name', + 'internal_links': { + 'Sales Invoice': ['invoices', 'sales_invoice'] + }, + 'transactions': [ + { + 'label': _('Reference'), + 'items': ['Sales Invoice'] + }, + { + 'label': _('Payment'), + 'items': ['Payment Entry', 'Journal Entry'] + } + ] + } \ No newline at end of file diff --git a/erpnext/config/accounting.py b/erpnext/config/accounting.py index afe35f8078..1b8bf2717b 100644 --- a/erpnext/config/accounting.py +++ b/erpnext/config/accounting.py @@ -232,6 +232,11 @@ def get_data(): "label": _("Bank Account"), "name": "Bank Account", }, + { + "type": "doctype", + "label": _("Invoice Discounting"), + "name": "Invoice Discounting", + }, { "type": "doctype", "label": _("Bank Statement Transaction Entry List"), From 8170585faf3204b815d2a7770892509aaaac6052 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Apr 2019 15:13:18 +0530 Subject: [PATCH 02/26] fix: Don't fetch already discounted invoice --- .../doctype/invoice_discounting/invoice_discounting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py index 64aa4e4af6..d1ede67ed4 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py @@ -190,9 +190,11 @@ def get_invoices(filters): customer, posting_date, outstanding_amount - from `tabSales Invoice` + from `tabSales Invoice` si where docstatus = 1 and outstanding_amount > 0 %s + and not exists(select di.name from `tabDiscounted Invoice` di + where di.docstatus=1 and di.sales_invoice=si.name) """ % where_condition, filters, as_dict=1) \ No newline at end of file From c99c712913add6c8fb1864c2e63cfbe3792855bd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Apr 2019 15:52:50 +0530 Subject: [PATCH 03/26] fix: Validate and update invoice discounting status on JE submit/cancel --- .../doctype/journal_entry/journal_entry.py | 57 ++++++++++++------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 28869d86d9..08d707385c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe, erpnext, json -from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint +from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint, get_link_to_form from frappe import msgprint, _, scrub from erpnext.controllers.accounts_controller import AccountsController from erpnext.accounts.utils import get_balance_on, get_account_currency @@ -53,6 +53,20 @@ class JournalEntry(AccountsController): self.update_inter_company_jv() self.update_invoice_discounting() + def on_cancel(self): + from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries + from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip + unlink_ref_doc_from_payment_entries(self) + unlink_ref_doc_from_salary_slip(self.name) + self.make_gl_entries(1) + self.update_advance_paid() + self.update_expense_claim() + self.update_loan() + self.unlink_advance_entry_reference() + self.unlink_asset_reference() + self.unlink_inter_company_jv() + self.unlink_asset_adjustment_entry() + self.update_invoice_discounting() def get_title(self): return self.pay_to_recd_from or self.accounts[0].account @@ -83,31 +97,32 @@ class JournalEntry(AccountsController): "inter_company_journal_entry_reference", self.name) def update_invoice_discounting(self): - invoice_discounting_list = [d.reference_name for d in self.accounts if d.reference_type=="Invoice Discounting"] + def _validate_invoice_discounting_status(inv_disc, id_status, expected_status, row_id): + id_link = get_link_to_form("Invoice Discounting", inv_disc) + if id_status != expected_status: + frappe.throw(_("Row #{0}: Status must be {1} for Invoice Discounting {2}").format(d.idx, expected_status, id_link)) + + invoice_discounting_list = list(set([d.reference_name for d in self.accounts if d.reference_type=="Invoice Discounting"])) for inv_disc in invoice_discounting_list: - short_term_loan_account = frappe.db.get_value("Invoice Discounting", inv_disc, "short_term_loan") + short_term_loan_account, id_status = frappe.db.get_value("Invoice Discounting", inv_disc, ["short_term_loan", "status"]) for d in self.accounts: if d.account == short_term_loan_account and d.reference_name == inv_disc: - if d.credit > 0: - status = "Disbursed" - elif d.debit > 0: - status = "Settled" + if self.docstatus == 1: + if d.credit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Sanctioned", d.idx) + status = "Disbursed" + elif d.debit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Disbursed", d.idx) + status = "Settled" + else: + if d.credit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Disbursed", d.idx) + status = "Sanctioned" + elif d.debit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Settled", d.idx) + status = "Disbursed" frappe.db.set_value("Invoice Discounting", inv_disc, "status", status) - def on_cancel(self): - from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries - from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip - unlink_ref_doc_from_payment_entries(self) - unlink_ref_doc_from_salary_slip(self.name) - self.make_gl_entries(1) - self.update_advance_paid() - self.update_expense_claim() - self.update_loan() - self.unlink_advance_entry_reference() - self.unlink_asset_reference() - self.unlink_inter_company_jv() - self.unlink_asset_adjustment_entry() - def unlink_advance_entry_reference(self): for d in self.get("accounts"): if d.is_advance == "Yes" and d.reference_type in ("Sales Invoice", "Purchase Invoice"): From 376db4f6b79e91f6c0a7934b58663f127304d4fa Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 18 Apr 2019 22:01:33 +0530 Subject: [PATCH 04/26] fix: credit amount in account's currency not be consider if debit amount is present in the general ledger --- erpnext/accounts/report/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py index 8a39744738..8500aea415 100644 --- a/erpnext/accounts/report/utils.py +++ b/erpnext/accounts/report/utils.py @@ -112,13 +112,15 @@ def convert_to_presentation_currency(gl_entries, currency_info): if entry.get('debit'): entry['debit'] = converted_value - else: + + if entry.get('credit'): entry['credit'] = converted_value elif account_currency == presentation_currency: if entry.get('debit'): entry['debit'] = debit_in_account_currency - else: + + if entry.get('credit'): entry['credit'] = credit_in_account_currency converted_gl_list.append(entry) From 94f43ca2e2b99722de684431b84f12dcd485c38e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 18 Apr 2019 22:39:42 +0530 Subject: [PATCH 05/26] fix: task name was not able to search by name in global search --- erpnext/projects/doctype/task/task.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json index 2602aef626..707db0812a 100644 --- a/erpnext/projects/doctype/task/task.json +++ b/erpnext/projects/doctype/task/task.json @@ -1392,7 +1392,7 @@ "istable": 0, "max_attachments": 5, "menu_index": 0, - "modified": "2019-02-19 12:22:02.147606", + "modified": "2019-04-18 12:22:02.147606", "modified_by": "Administrator", "module": "Projects", "name": "Task", @@ -1422,11 +1422,11 @@ "read_only": 0, "read_only_onload": 0, "search_fields": "subject", - "show_name_in_global_search": 0, + "show_name_in_global_search": 1, "sort_order": "DESC", "timeline_field": "project", "title_field": "subject", "track_changes": 0, "track_seen": 1, "track_views": 0 -} \ No newline at end of file +} From e1a6022c8c3e45281db49621f449b1d7e839d26e Mon Sep 17 00:00:00 2001 From: Prasad R Date: Fri, 19 Apr 2019 10:57:21 +0530 Subject: [PATCH 06/26] fix: Allow system manager to access share ledger --- erpnext/accounts/report/share_ledger/share_ledger.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/share_ledger/share_ledger.json b/erpnext/accounts/report/share_ledger/share_ledger.json index d374bb7747..fe158a6f00 100644 --- a/erpnext/accounts/report/share_ledger/share_ledger.json +++ b/erpnext/accounts/report/share_ledger/share_ledger.json @@ -1,23 +1,27 @@ { "add_total_row": 0, - "apply_user_permissions": 1, "creation": "2017-12-27 16:15:52.615453", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2017-12-27 16:46:54.422356", + "modified": "2019-04-19 10:50:36.061588", "modified_by": "Administrator", "module": "Accounts", "name": "Share Ledger", "owner": "Administrator", + "prepared_report": 0, "ref_doctype": "Share Transfer", "report_name": "Share Ledger", "report_type": "Script Report", "roles": [ { "role": "Administrator" + }, + { + "role": "System Manager" } ] } \ No newline at end of file From a55d32236a9bbd2c64d8ac2432fd603b1201e7ee Mon Sep 17 00:00:00 2001 From: scmmishra Date: Fri, 19 Apr 2019 12:22:30 +0530 Subject: [PATCH 07/26] fix: fixed trial details --- erpnext/templates/pages/demo.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/templates/pages/demo.html b/erpnext/templates/pages/demo.html index 8eec800d68..a4b5e0122c 100644 --- a/erpnext/templates/pages/demo.html +++ b/erpnext/templates/pages/demo.html @@ -60,7 +60,7 @@ $(document).ready(function() { -

Start a free 30-day trial +

Start a free 14-day trial