From df7215dcb210dc506d433a1a46dfa41101768c5c Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jan 2019 14:48:06 +0530 Subject: [PATCH 01/22] Added supplier name in the tds report --- .../tds_computation_summary.py | 32 +++++++++++++++---- .../tds_payable_monthly.py | 32 ++++++++++++++----- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py index d81a8f3c9f..b19f6306b7 100644 --- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py +++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py @@ -8,7 +8,9 @@ from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category def execute(filters=None): validate_filters(filters) - columns = get_columns() + filters.naming_series = frappe.db.get_single_value('Buying Settings', 'supp_master_name') + + columns = get_columns(filters) res = get_result(filters) return columns, res @@ -29,7 +31,8 @@ def get_result(filters): # if no supplier selected, fetch data for all tds applicable supplier # else fetch relevant data for selected supplier pan = "pan" if frappe.db.has_column("Supplier", "pan") else "tax_id" - fields = ["name", pan+" as pan", "tax_withholding_category", "supplier_type"] + fields = ["name", pan+" as pan", "tax_withholding_category", "supplier_type", "supplier_name"] + if filters.supplier: filters.supplier = frappe.db.get_list('Supplier', {"name": filters.supplier}, fields) @@ -49,8 +52,13 @@ def get_result(filters): filters.company, filters.from_date, filters.to_date) if total_invoiced_amount or tds_deducted: - out.append([supplier.pan, supplier.name, tds.name, supplier.supplier_type, - rate, total_invoiced_amount, tds_deducted]) + row = [supplier.pan, supplier.name] + + if filters.naming_series == 'Naming Series': + row.append(supplier.supplier_name) + + row.extend([tds.name, supplier.supplier_type, rate, total_invoiced_amount, tds_deducted]) + out.append(row) return out @@ -86,7 +94,7 @@ def get_invoice_and_tds_amount(supplier, account, company, from_date, to_date): return total_invoiced_amount, tds_deducted -def get_columns(): +def get_columns(filters): columns = [ { "label": _("PAN"), @@ -100,7 +108,17 @@ def get_columns(): "fieldname": "supplier", "fieldtype": "Link", "width": 180 - }, + }] + + if filters.naming_series == 'Naming Series': + columns.append({ + "label": _("Supplier Name"), + "fieldname": "supplier_name", + "fieldtype": "Data", + "width": 180 + }) + + columns.extend([ { "label": _("Section Code"), "options": "Tax Withholding Category", @@ -132,6 +150,6 @@ def get_columns(): "fieldtype": "Float", "width": 90 } - ] + ]) return columns diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py index 843b58f448..e55c022452 100644 --- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py +++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py @@ -11,7 +11,7 @@ def execute(filters=None): validate_filters(filters) set_filters(filters) - columns = get_columns() + columns = get_columns(filters) if not filters["invoices"]: return columns, [] @@ -43,6 +43,7 @@ def set_filters(filters): invoices.append(d) filters["invoices"] = invoices if invoices else filters["invoices"] + filters.naming_series = frappe.db.get_single_value('Buying Settings', 'supp_master_name') def get_result(filters): supplier_map, tds_docs = get_supplier_map(filters) @@ -71,9 +72,14 @@ def get_result(filters): if getdate(filters.from_date) <= gle_map[d][0].posting_date \ and getdate(filters.to_date) >= gle_map[d][0].posting_date: - out.append([supplier.pan, supplier.name, tds_doc.name, - supplier.supplier_type, rate, total_amount_credited, tds_deducted, - gle_map[d][0].posting_date, "Purchase Invoice", d]) + row = [supplier.pan, supplier.name] + + if filters.naming_series == 'Naming Series': + row.append(supplier.supplier_name) + + row.extend([tds_doc.name, supplier.supplier_type, rate, total_amount_credited, + tds_deducted, gle_map[d][0].posting_date, "Purchase Invoice", d]) + out.append(row) return out @@ -84,7 +90,7 @@ def get_supplier_map(filters): pan = "pan" if frappe.db.has_column("Supplier", "pan") else "tax_id" supplier_detail = frappe.db.get_all('Supplier', {"name": ["in", [d.supplier for d in filters["invoices"]]]}, - ["tax_withholding_category", "name", pan+" as pan", "supplier_type"]) + ["tax_withholding_category", "name", pan+" as pan", "supplier_type", "supplier_name"]) for d in filters["invoices"]: supplier_map[d.get("name")] = [k for k in supplier_detail @@ -113,7 +119,7 @@ def get_gle_map(filters): return gle_map -def get_columns(): +def get_columns(filters): pan = "pan" if frappe.db.has_column("Supplier", "pan") else "tax_id" columns = [ { @@ -128,7 +134,17 @@ def get_columns(): "fieldname": "supplier", "fieldtype": "Link", "width": 180 - }, + }] + + if filters.naming_series == 'Naming Series': + columns.append({ + "label": _("Supplier Name"), + "fieldname": "supplier_name", + "fieldtype": "Data", + "width": 180 + }) + + columns.extend([ { "label": _("Section Code"), "options": "Tax Withholding Category", @@ -178,7 +194,7 @@ def get_columns(): "options": "transaction_type", "width": 90 } - ] + ]) return columns From bdee57ca8d30a8f078785da7ec15ac0c0982fb53 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jan 2019 15:52:52 +0530 Subject: [PATCH 02/22] Added finance book in trial balance and fixed cost center not working issue in trial balance --- .../report/trial_balance/trial_balance.js | 41 ++++++++++++------- .../report/trial_balance/trial_balance.py | 18 ++++++-- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js index c09fa71575..194f1bd497 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.js +++ b/erpnext/accounts/report/trial_balance/trial_balance.js @@ -12,21 +12,6 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "default": frappe.defaults.get_user_default("Company"), "reqd": 1 }, - { - "fieldname":"cost_center", - "label": __("Cost Center"), - "fieldtype": "Link", - "options": "Cost Center", - "get_query": function() { - var company = frappe.query_report.get_filter_value('company'); - return { - "doctype": "Cost Center", - "filters": { - "company": company, - } - } - } - }, { "fieldname": "fiscal_year", "label": __("Fiscal Year"), @@ -60,6 +45,27 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "fieldtype": "Date", "default": frappe.defaults.get_user_default("year_end_date"), }, + { + "fieldname":"cost_center", + "label": __("Cost Center"), + "fieldtype": "Link", + "options": "Cost Center", + "get_query": function() { + var company = frappe.query_report.get_filter_value('company'); + return { + "doctype": "Cost Center", + "filters": { + "company": company, + } + } + } + }, + { + "fieldname":"finance_book", + "label": __("Finance Book"), + "fieldtype": "Link", + "options": "Finance Book", + }, { "fieldname": "with_period_closing_entry", "label": __("Period Closing Entry"), @@ -75,6 +81,11 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "fieldname": "show_unclosed_fy_pl_balances", "label": __("Show unclosed fiscal year's P&L balances"), "fieldtype": "Check" + }, + { + "fieldname": "include_non_finance_book_entries", + "label": __("Include Non Finance Book Entries"), + "fieldtype": "Check" } ], "formatter": erpnext.financial_statements.formatter, diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 07dcd4e7a9..696e63bb2c 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -67,11 +67,10 @@ def get_data(filters): gl_entries_by_account = {} + opening_balances = get_opening_balances(filters) set_gl_entries_by_account(filters.company, filters.from_date, filters.to_date, min_lft, max_rgt, filters, gl_entries_by_account, ignore_closing_entries=not flt(filters.with_period_closing_entry)) - opening_balances = get_opening_balances(filters) - total_row = calculate_values(accounts, gl_entries_by_account, opening_balances, filters, company_currency) accumulate_values_into_parents(accounts, accounts_by_name) @@ -98,6 +97,18 @@ def get_rootwise_opening_balances(filters, report_type): if not flt(filters.with_period_closing_entry): additional_conditions += " and ifnull(voucher_type, '')!='Period Closing Voucher'" + if filters.cost_center: + lft, rgt = frappe.db.get_value('Cost Center', filters.cost_center, ['lft', 'rgt']) + additional_conditions += """ and cost_center in (select name from `tabCost Center` + where lft >= %s and rgt <= %s)""" % (lft, rgt) + + if filters.finance_book: + fb_conditions = " and finance_book = %(finance_book)s" + if filters.include_non_finance_book_entries: + fb_conditions = " and (finance_book = %(finance_book)s or finance_book is null)" + + additional_conditions += fb_conditions + gle = frappe.db.sql(""" select account, sum(debit) as opening_debit, sum(credit) as opening_credit @@ -112,7 +123,8 @@ def get_rootwise_opening_balances(filters, report_type): "company": filters.company, "from_date": filters.from_date, "report_type": report_type, - "year_start_date": filters.year_start_date + "year_start_date": filters.year_start_date, + "finance_book": filters.finance_book }, as_dict=True) From b2d08a498b76cbe9c1f491ed42072453002af85d Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jan 2019 16:11:29 +0530 Subject: [PATCH 03/22] Added bank account field in the payment entry --- .../doctype/bank_account/bank_account.py | 7 + .../doctype/payment_entry/payment_entry.js | 24 ++++ .../doctype/payment_entry/payment_entry.json | 131 ++++++++++++++++-- 3 files changed, 147 insertions(+), 15 deletions(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 08f8248f3d..7a3f22b10c 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -31,3 +31,10 @@ def make_bank_account(doctype, docname): doc.is_default = 1 return doc + + +@frappe.whitelist() +def get_bank_account(bank_account): + if bank_account: + return frappe.db.get_value('Bank Account', + bank_account, 'account') \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index afb44e8f92..3663ffe053 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -30,6 +30,13 @@ frappe.ui.form.on('Payment Entry', { } } }); + frm.set_query("bank_account", function() { + return{ + "filters": { + "party": frm.doc.party, + } + } + }); frm.set_query("contact_person", function() { if (frm.doc.party) { return { @@ -833,6 +840,23 @@ frappe.ui.form.on('Payment Entry', { } }) } + }, + + bank_account: function(frm) { + const field = frm.doc.payment_type == "Pay" ? "paid_from":"paid_to"; + if (frm.doc.bank_account && in_list(['Pay', 'Receive'], frm.doc.payment_type)) { + frappe.call({ + method: "erpnext.accounts.doctype.bank_account.bank_account.get_bank_account", + args: { + bank_account: frm.doc.bank_account + }, + callback: function(r) { + if (r.message) { + frm.set_value(field, r.message); + } + } + }); + } } }); diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json index bc9062b96c..9354c61add 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.json +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, @@ -379,24 +380,24 @@ { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, - "allow_on_submit": 0, + "allow_on_submit": 1, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "party", - "fieldname": "contact_person", - "fieldtype": "Link", + "depends_on": "eval:in_list([\"Receive\", \"Pay\"], doc.payment_type) && doc.party_type", + "description": "", + "fieldname": "party_name", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 0, + "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 0, - "label": "Contact", + "label": "Party Name", "length": 0, "no_copy": 0, - "options": "Contact", "permlevel": 0, "precision": "", "print_hide": 0, @@ -444,24 +445,24 @@ { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, - "allow_on_submit": 1, + "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:in_list([\"Receive\", \"Pay\"], doc.payment_type) && doc.party_type", - "description": "", - "fieldname": "party_name", - "fieldtype": "Data", + "depends_on": "party", + "fieldname": "bank_account", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 1, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Party Name", + "label": "Bank Account", "length": 0, "no_copy": 0, + "options": "Bank Account", "permlevel": 0, "precision": "", "print_hide": 0, @@ -509,6 +510,40 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "party", + "fieldname": "contact_person", + "fieldtype": "Link", + "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": "Contact", + "length": 0, + "no_copy": 0, + "options": "Contact", + "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, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -1867,6 +1902,72 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "bank_account.bank", + "fieldname": "bank", + "fieldtype": "Read Only", + "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": "Bank", + "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, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "bank_account.bank_account_no", + "fieldname": "bank_account_no", + "fieldtype": "Read Only", + "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": "Bank Account No", + "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, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -2040,7 +2141,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-09-25 14:38:48.312629", + "modified": "2019-01-15 15:58:40.742601", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Entry", From 1a4c1e11cb770ba4369a68c527b0c189e6cd75c6 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jan 2019 17:01:34 +0530 Subject: [PATCH 04/22] Fix: total invoiced amount in Accounts Receivable Summary report showing blank --- .../accounts_receivable_summary/accounts_receivable_summary.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 190031abb8..0a955a7912 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -185,6 +185,9 @@ class AccountsReceivableSummary(ReceivablePayableReport): if party_naming_by == "Naming Series": cols += ["party_name"] + if args.get("party_type") == 'Customer': + cols += ["contact"] + cols += ["voucher_type", "voucher_no", "due_date"] if args.get("party_type") == "Supplier": From affeb3dfecfc6d3515f950f41a427e5abb189442 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jan 2019 17:38:31 +0530 Subject: [PATCH 05/22] Added on account amount field in Accounts Payable/Receivable Summary --- erpnext/accounts/party.py | 9 +++++++++ .../accounts_receivable_summary.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index a69a172284..d25e6de5e6 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -562,3 +562,12 @@ def get_party_shipping_address(doctype, name): return out[0][0] else: return '' + +def get_partywise_advanced_payment_amount(party_type="Customer"): + data = frappe.db.sql(""" SELECT party, sum({0}) as amount + FROM `tabGL Entry` + WHERE party_type = %s and against_voucher is null GROUP BY party""" + .format("credit" if party_type == "Customer" else "debit") , party_type, debug=1) + + if data: + return frappe._dict(data) \ No newline at end of file diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 0a955a7912..a272bfeb47 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _, scrub from frappe.utils import flt +from erpnext.accounts.party import get_partywise_advanced_payment_amount from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport from six import iteritems @@ -24,6 +25,12 @@ class AccountsReceivableSummary(ReceivablePayableReport): credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt" columns += [{ + "label": _("On Account Amount"), + "fieldname": "on_account_amt", + "fieldtype": "Currency", + "options": "currency", + "width": 100 + },{ "label": _("Total Invoiced Amt"), "fieldname": "total_invoiced_amt", "fieldtype": "Currency", @@ -129,12 +136,15 @@ class AccountsReceivableSummary(ReceivablePayableReport): partywise_total = self.get_partywise_total(party_naming_by, args) + partywise_advance_amount = get_partywise_advanced_payment_amount(args.get("party_type")) or {} for party, party_dict in iteritems(partywise_total): row = [party] if party_naming_by == "Naming Series": row += [self.get_party_name(args.get("party_type"), party)] + row += [partywise_advance_amount.get(party, 0)] + row += [ party_dict.invoiced_amt, party_dict.paid_amt, party_dict.credit_amt, party_dict.outstanding_amt, party_dict.range1, party_dict.range2, party_dict.range3, party_dict.range4, From f7258168095a90cd6d4f9e5d4b2374027c6a9685 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jan 2019 18:12:04 +0530 Subject: [PATCH 06/22] Enhance: Added field limit in the Payment Reconciliation to handle large entries --- .../doctype/bank_account/bank_account.py | 8 +- .../doctype/payment_entry/payment_entry.js | 2 +- .../payment_reconciliation.json | 186 +++++++++++++++++- .../payment_reconciliation.py | 9 +- erpnext/accounts/utils.py | 8 +- erpnext/controllers/accounts_controller.py | 13 +- 6 files changed, 200 insertions(+), 26 deletions(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 7a3f22b10c..7a79de56b8 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -32,9 +32,7 @@ def make_bank_account(doctype, docname): return doc - @frappe.whitelist() -def get_bank_account(bank_account): - if bank_account: - return frappe.db.get_value('Bank Account', - bank_account, 'account') \ No newline at end of file +def get_account_from_bank_acc(name): + return frappe.db.get_value('Bank Account', + name, 'account') \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 3663ffe053..58a380c968 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -846,7 +846,7 @@ frappe.ui.form.on('Payment Entry', { const field = frm.doc.payment_type == "Pay" ? "paid_from":"paid_to"; if (frm.doc.bank_account && in_list(['Pay', 'Receive'], frm.doc.payment_type)) { frappe.call({ - method: "erpnext.accounts.doctype.bank_account.bank_account.get_bank_account", + method: "erpnext.accounts.doctype.bank_account.bank_account.get_account_from_bank_acc", args: { bank_account: frm.doc.bank_account }, diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json index b211b500a1..cfb24c3954 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json @@ -1,23 +1,34 @@ { "allow_copy": 1, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, + "beta": 0, "creation": "2014-07-09 12:04:51.681583", "custom": 0, "docstatus": 0, "doctype": "DocType", "document_type": "", + "editable_grid": 0, + "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "company", "fieldtype": "Link", "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": "Company", "length": 0, "no_copy": 0, @@ -26,22 +37,30 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "party_type", "fieldtype": "Link", "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": "Party Type", "length": 0, "no_copy": 0, @@ -50,23 +69,31 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "depends_on": "", "fieldname": "party", "fieldtype": "Dynamic Link", "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": "Party", "length": 0, "no_copy": 0, @@ -75,22 +102,30 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "receivable_payable_account", "fieldtype": "Link", "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": "Receivable / Payable Account", "length": 0, "no_copy": 0, @@ -100,22 +135,30 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "bank_cash_account", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Bank / Cash Account", "length": 0, "no_copy": 0, @@ -124,22 +167,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "col_break1", "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, "label": "", "length": 0, "no_copy": 0, @@ -147,22 +198,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "from_date", "fieldtype": "Date", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "From Invoice Date", "length": 0, "no_copy": 0, @@ -170,22 +229,30 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, - "search_index": 1, + "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "to_date", "fieldtype": "Date", "hidden": 0, "ignore_user_permissions": 0, + "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "To Invoice Date", "length": 0, "no_copy": 0, @@ -193,22 +260,30 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, - "search_index": 1, + "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "minimum_amount", "fieldtype": "Currency", "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": "Minimum Invoice Amount", "length": 0, "no_copy": 0, @@ -216,22 +291,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "maximum_amount", "fieldtype": "Currency", "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": "Maximum Invoice Amount", "length": 0, "no_copy": 0, @@ -239,22 +322,63 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, + "description": "System will fetch all the entries if limit value is zero.", + "fieldname": "limit", + "fieldtype": "Int", + "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": "Limit", + "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, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, "fieldname": "get_unreconciled_entries", "fieldtype": "Button", "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": "Get Unreconciled Entries", "length": 0, "no_copy": 0, @@ -262,22 +386,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "sec_break1", "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": "Unreconciled Payment Details", "length": 0, "no_copy": 0, @@ -285,22 +417,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "payments", "fieldtype": "Table", "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": "Payments", "length": 0, "no_copy": 0, @@ -309,22 +449,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "reconcile", "fieldtype": "Button", "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": "Reconcile", "length": 0, "no_copy": 0, @@ -332,22 +480,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "sec_break2", "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": "Invoice/Journal Entry Details", "length": 0, "no_copy": 0, @@ -355,22 +511,30 @@ "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, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "invoices", "fieldtype": "Table", "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": "Invoices", "length": 0, "no_copy": 0, @@ -379,25 +543,28 @@ "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, + "translatable": 0, "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 1, - "icon": "fa fa-resize-horizontal", + "icon": "icon-resize-horizontal", "idx": 0, + "image_view": 0, "in_create": 0, - "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-01-04 02:26:58.807921", + "modified": "2019-01-15 17:42:21.135214", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation", @@ -406,7 +573,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -426,7 +592,6 @@ }, { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, @@ -445,8 +610,13 @@ "write": 1 } ], + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, + "show_name_in_global_search": 0, "sort_field": "modified", - "sort_order": "DESC" + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 7cd951aba4..094ece95e8 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -25,7 +25,7 @@ class PaymentReconciliation(Document): def get_payment_entries(self): order_doctype = "Sales Order" if self.party_type=="Customer" else "Purchase Order" payment_entries = get_advance_payment_entries(self.party_type, self.party, - self.receivable_payable_account, order_doctype, against_all_orders=True) + self.receivable_payable_account, order_doctype, against_all_orders=True, limit=self.limit) return payment_entries @@ -36,6 +36,8 @@ class PaymentReconciliation(Document): bank_account_condition = "t2.against_account like %(bank_cash_account)s" \ if self.bank_cash_account else "1=1" + limit_cond = "limit %s" % (self.limit or 1000) + journal_entries = frappe.db.sql(""" select "Journal Entry" as reference_type, t1.name as reference_name, @@ -55,10 +57,11 @@ class PaymentReconciliation(Document): THEN 1=1 ELSE {bank_account_condition} END) - order by t1.posting_date + order by t1.posting_date {limit_cond} """.format(**{ "dr_or_cr": dr_or_cr, "bank_account_condition": bank_account_condition, + "limit_cond": limit_cond }), { "party_type": self.party_type, "party": self.party, @@ -80,7 +83,7 @@ class PaymentReconciliation(Document): condition = self.check_condition() non_reconciled_invoices = get_outstanding_invoices(self.party_type, self.party, - self.receivable_payable_account, condition=condition) + self.receivable_payable_account, condition=condition, limit=self.limit) self.add_invoice_entries(non_reconciled_invoices) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 6fbe97de3e..e145a35b17 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -615,7 +615,7 @@ def get_held_invoices(party_type, party): return held_invoices -def get_outstanding_invoices(party_type, party, account, condition=None): +def get_outstanding_invoices(party_type, party, account, condition=None, limit=1000): outstanding_invoices = [] precision = frappe.get_precision("Sales Invoice", "outstanding_amount") @@ -628,6 +628,7 @@ def get_outstanding_invoices(party_type, party, account, condition=None): invoice = 'Sales Invoice' if erpnext.get_party_account_type(party_type) == 'Receivable' else 'Purchase Invoice' held_invoices = get_held_invoices(party_type, party) + limit_cond = "limit %s" % (limit or 1000) invoice_list = frappe.db.sql(""" select @@ -655,11 +656,12 @@ def get_outstanding_invoices(party_type, party, account, condition=None): or (voucher_type not in ('Journal Entry', 'Payment Entry'))) group by voucher_type, voucher_no having (invoice_amount - payment_amount) > 0.005 - order by posting_date, name""".format( + order by posting_date, name {limit_cond}""".format( dr_or_cr=dr_or_cr, invoice = invoice, payment_dr_or_cr=payment_dr_or_cr, - condition=condition or "" + condition=condition or "", + limit_cond = limit_cond ), { "party_type": party_type, "party": party, diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index cd373b84d7..c0643f2e6e 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -953,11 +953,12 @@ def get_advance_journal_entries(party_type, party, party_account, amount_field, return list(journal_entries) -def get_advance_payment_entries(party_type, party, party_account, - order_doctype, order_list=None, include_unallocated=True, against_all_orders=False): +def get_advance_payment_entries(party_type, party, party_account, order_doctype, + order_list=None, include_unallocated=True, against_all_orders=False, limit=1000): party_account_field = "paid_from" if party_type == "Customer" else "paid_to" payment_type = "Receive" if party_type == "Customer" else "Pay" payment_entries_against_order, unallocated_payment_entries = [], [] + limit_cond = "limit %s" % (limit or 1000) if order_list or against_all_orders: if order_list: @@ -977,8 +978,8 @@ def get_advance_payment_entries(party_type, party, party_account, t1.name = t2.parent and t1.{0} = %s and t1.payment_type = %s and t1.party_type = %s and t1.party = %s and t1.docstatus = 1 and t2.reference_doctype = %s {1} - order by t1.posting_date - """.format(party_account_field, reference_condition), + order by t1.posting_date {2} + """.format(party_account_field, reference_condition, limit_cond), [party_account, payment_type, party_type, party, order_doctype] + order_list, as_dict=1) @@ -990,8 +991,8 @@ def get_advance_payment_entries(party_type, party, party_account, where {0} = %s and party_type = %s and party = %s and payment_type = %s and docstatus = 1 and unallocated_amount > 0 - order by posting_date - """.format(party_account_field), (party_account, party_type, party, payment_type), as_dict=1) + order by posting_date {1} + """.format(party_account_field, limit_cond), (party_account, party_type, party, payment_type), as_dict=1) return list(payment_entries_against_order) + list(unallocated_payment_entries) From fa7ee0b3b67a04de136ce2673185cddc4f217cd3 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 17 Jan 2019 15:30:44 +0530 Subject: [PATCH 07/22] Added dafult bank account in the customer/supplier --- .../doctype/bank_account/bank_account.py | 11 ++++-- .../doctype/payment_entry/payment_entry.js | 13 +++++-- .../doctype/payment_entry/payment_entry.py | 22 +++++++++++- erpnext/accounts/party.py | 2 +- .../accounts_receivable_summary.py | 4 +-- erpnext/buying/doctype/supplier/supplier.json | 35 ++++++++++++++++++- .../selling/doctype/customer/customer.json | 35 ++++++++++++++++++- 7 files changed, 110 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py index 7a79de56b8..b13259b55d 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account.py +++ b/erpnext/accounts/doctype/bank_account/bank_account.py @@ -33,6 +33,11 @@ def make_bank_account(doctype, docname): return doc @frappe.whitelist() -def get_account_from_bank_acc(name): - return frappe.db.get_value('Bank Account', - name, 'account') \ No newline at end of file +def get_party_bank_account(party_type, party): + return frappe.db.get_value(party_type, + party, 'default_bank_account') + +@frappe.whitelist() +def get_bank_account_details(bank_account): + return frappe.db.get_value("Bank Account", + bank_account, ['account', 'bank', 'bank_account_no'], as_dict=1) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 58a380c968..15cc3fdbb9 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -291,7 +291,12 @@ frappe.ui.form.on('Payment Entry', { () => frm.events.get_outstanding_documents(frm), () => frm.events.hide_unhide_fields(frm), () => frm.events.set_dynamic_labels(frm), - () => { frm.set_party_account_based_on_party = false; } + () => { + frm.set_party_account_based_on_party = false; + if (r.message.bank_account) { + frm.set_value("bank_account", r.message.bank_account); + } + } ]); } } @@ -846,13 +851,15 @@ frappe.ui.form.on('Payment Entry', { const field = frm.doc.payment_type == "Pay" ? "paid_from":"paid_to"; if (frm.doc.bank_account && in_list(['Pay', 'Receive'], frm.doc.payment_type)) { frappe.call({ - method: "erpnext.accounts.doctype.bank_account.bank_account.get_account_from_bank_acc", + method: "erpnext.accounts.doctype.bank_account.bank_account.get_bank_account_details", args: { bank_account: frm.doc.bank_account }, callback: function(r) { if (r.message) { - frm.set_value(field, r.message); + frm.set_value(field, r.message.account); + frm.set_value('bank', r.message.bank); + frm.set_value('bank_account_no', r.message.bank_account_no); } } }); diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index f213ffa658..7f1f55005c 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -12,6 +12,7 @@ from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_ban from erpnext.setup.utils import get_exchange_rate from erpnext.accounts.general_ledger import make_gl_entries from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount +from erpnext.accounts.doctype.bank_account.bank_account import get_party_bank_account, get_bank_account_details from erpnext.controllers.accounts_controller import AccountsController, get_supplier_block_status from six import string_types, iteritems @@ -88,6 +89,16 @@ class PaymentEntry(AccountsController): .format(d.idx, d.reference_doctype, d.reference_name)) reference_names.append((d.reference_doctype, d.reference_name)) + def set_bank_account_data(self): + if self.bank_account: + bank_data = get_bank_account_details(self.bank_account) + + field = "paid_from" if self.payment_type == "Pay" else "paid_to" + + self.bank = bank_data.bank + self.bank_account_no = bank_data.bank_account_no + self.set(field, bank_data.account) + def validate_allocated_amount(self): for d in self.get("references"): if (flt(d.allocated_amount))> 0: @@ -670,6 +681,7 @@ def get_negative_outstanding_invoices(party_type, party, party_account, party_ac @frappe.whitelist() def get_party_details(company, party_type, party, date, cost_center=None): + bank_account = '' if not frappe.db.exists(party_type, party): frappe.throw(_("Invalid {0}: {1}").format(party_type, party)) @@ -680,13 +692,16 @@ def get_party_details(company, party_type, party, date, cost_center=None): _party_name = "title" if party_type == "Student" else party_type.lower() + "_name" party_name = frappe.db.get_value(party_type, party, _party_name) party_balance = get_balance_on(party_type=party_type, party=party, cost_center=cost_center) + if party_type in ["Customer", "Supplier"]: + bank_account = get_party_bank_account(party_type, party) return { "party_account": party_account, "party_name": party_name, "party_account_currency": account_currency, "party_balance": party_balance, - "account_balance": account_balance + "account_balance": account_balance, + "bank_account": bank_account } @@ -890,6 +905,11 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount= pe.allocate_payment_amount = 1 pe.letter_head = doc.get("letter_head") + if pe.party_type in ["Customer", "Supplier"]: + bank_account = get_party_bank_account(pe.party_type, pe.party) + pe.set("bank_account", bank_account) + pe.set_bank_account_data() + # only Purchase Invoice can be blocked individually if doc.doctype == "Purchase Invoice" and doc.invoice_is_blocked(): frappe.msgprint(_('{0} is on hold till {1}'.format(doc.name, doc.release_date))) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index d25e6de5e6..eb1146ba1a 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -567,7 +567,7 @@ def get_partywise_advanced_payment_amount(party_type="Customer"): data = frappe.db.sql(""" SELECT party, sum({0}) as amount FROM `tabGL Entry` WHERE party_type = %s and against_voucher is null GROUP BY party""" - .format("credit" if party_type == "Customer" else "debit") , party_type, debug=1) + .format(("credit - debit") if party_type == "Customer" else "debit") , party_type, debug=1) if data: return frappe._dict(data) \ No newline at end of file diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index a272bfeb47..73ca8b48ef 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -25,8 +25,8 @@ class AccountsReceivableSummary(ReceivablePayableReport): credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt" columns += [{ - "label": _("On Account Amount"), - "fieldname": "on_account_amt", + "label": _("Advance Amount"), + "fieldname": "advance_amount", "fieldtype": "Currency", "options": "currency", "width": 100 diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index 3b1f4e0dfc..4586c64715 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -149,6 +149,39 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_bank_account", + "fieldtype": "Link", + "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": "Default Bank Account", + "length": 0, + "no_copy": 0, + "options": "Bank Account", + "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, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -1463,7 +1496,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-01-07 16:52:04.660271", + "modified": "2019-01-17 13:58:08.597792", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 608c0e950e..a82042f4a1 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -217,6 +217,39 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_bank_account", + "fieldtype": "Link", + "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": "Default Bank Account", + "length": 0, + "no_copy": 0, + "options": "Bank Account", + "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, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -1873,7 +1906,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-10-01 10:07:34.510264", + "modified": "2019-01-17 13:10:24.360875", "modified_by": "Administrator", "module": "Selling", "name": "Customer", From ddd9136d10c006ad8b596128bbe5844864ecd613 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 17 Jan 2019 17:53:58 +0530 Subject: [PATCH 08/22] Renamed field and added finance book column in the trial balance simple report --- erpnext/accounts/doctype/payment_entry/payment_entry.js | 7 ------- erpnext/accounts/party.py | 2 +- erpnext/accounts/report/trial_balance/trial_balance.js | 4 ++-- erpnext/accounts/report/trial_balance/trial_balance.py | 7 ++++--- erpnext/accounts/report/trial_balance_simple/__init__.py | 0 .../report/trial_balance_simple/trial_balance_simple.json | 4 ++-- 6 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 erpnext/accounts/report/trial_balance_simple/__init__.py diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 15cc3fdbb9..30ae54b18b 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -30,13 +30,6 @@ frappe.ui.form.on('Payment Entry', { } } }); - frm.set_query("bank_account", function() { - return{ - "filters": { - "party": frm.doc.party, - } - } - }); frm.set_query("contact_person", function() { if (frm.doc.party) { return { diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index eb1146ba1a..acb5dd1c09 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -567,7 +567,7 @@ def get_partywise_advanced_payment_amount(party_type="Customer"): data = frappe.db.sql(""" SELECT party, sum({0}) as amount FROM `tabGL Entry` WHERE party_type = %s and against_voucher is null GROUP BY party""" - .format(("credit - debit") if party_type == "Customer" else "debit") , party_type, debug=1) + .format(("credit - debit") if party_type == "Customer" else "debit") , party_type) if data: return frappe._dict(data) \ No newline at end of file diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js index 194f1bd497..cdc77456d0 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.js +++ b/erpnext/accounts/report/trial_balance/trial_balance.js @@ -83,8 +83,8 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "fieldtype": "Check" }, { - "fieldname": "include_non_finance_book_entries", - "label": __("Include Non Finance Book Entries"), + "fieldname": "include_default_book_entries", + "label": __("Include Default Book Entries"), "fieldtype": "Check" } ], diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 696e63bb2c..6b18c5d873 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -104,8 +104,8 @@ def get_rootwise_opening_balances(filters, report_type): if filters.finance_book: fb_conditions = " and finance_book = %(finance_book)s" - if filters.include_non_finance_book_entries: - fb_conditions = " and (finance_book = %(finance_book)s or finance_book is null)" + if filters.include_default_book_entries: + fb_conditions = " and (finance_book in (%(finance_book)s, %(company_fb)s) or finance_book is null)" additional_conditions += fb_conditions @@ -124,7 +124,8 @@ def get_rootwise_opening_balances(filters, report_type): "from_date": filters.from_date, "report_type": report_type, "year_start_date": filters.year_start_date, - "finance_book": filters.finance_book + "finance_book": filters.finance_book, + "company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book') }, as_dict=True) diff --git a/erpnext/accounts/report/trial_balance_simple/__init__.py b/erpnext/accounts/report/trial_balance_simple/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json index ea5a97b106..fab3a76a0c 100644 --- a/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json +++ b/erpnext/accounts/report/trial_balance_simple/trial_balance_simple.json @@ -6,13 +6,13 @@ "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2018-11-22 17:40:11.317567", + "modified": "2019-01-17 17:20:42.374958", "modified_by": "Administrator", "module": "Accounts", "name": "Trial Balance (Simple)", "owner": "Administrator", "prepared_report": 0, - "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account\norder by fiscal_year, company, posting_date, account", + "query": "select fiscal_year as \"Fiscal Year:Data:80\",\n\tcompany as \"Company:Data:220\",\n\tposting_date as \"Posting Date:Date:100\",\n\taccount as \"Account:Data:380\",\n\tsum(debit) as \"Debit:Currency:140\",\n\tsum(credit) as \"Credit:Currency:140\",\n\tfinance_book as \"Finance Book:Link/Finance Book:140\"\nfrom `tabGL Entry`\ngroup by fiscal_year, company, posting_date, account\norder by fiscal_year, company, posting_date, account", "ref_doctype": "GL Entry", "report_name": "Trial Balance (Simple)", "report_type": "Query Report", From a5270e561fd28a176eb9941ae4b9ed6bf6b97e18 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 22 Jan 2019 15:43:04 +0530 Subject: [PATCH 09/22] fix: Unicode issue in purchase invoice --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index d28dc936bb..f2d5006cd0 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -1,7 +1,8 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt +# -*- coding: utf-8 -*- - +from __future__ import unicode_literals import frappe, erpnext from frappe.utils import cint, cstr, formatdate, flt, getdate, nowdate from frappe import _, throw From ecf64677991ace56b29bd1002b47b7476b704ce3 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Tue, 22 Jan 2019 17:41:56 +0530 Subject: [PATCH 10/22] fix(travis): Redis must be working for caching, so reverting (#16455) --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index e21d59511a..9e63c0e6b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,16 +30,16 @@ before_script: - cd ~/frappe-bench - bench get-app erpnext $TRAVIS_BUILD_DIR - bench use test_site + - bench reinstall --yes + - bench scheduler disable + - sed -i 's/9000/9001/g' sites/common_site_config.json + - bench start & + - sleep 10 jobs: include: - stage: test script: - - bench reinstall --yes - - bench scheduler disable - - sed -i 's/9000/9001/g' sites/common_site_config.json - - bench start & - - sleep 10 - set -e - bench run-tests env: Server Side Test From 2a9a867f053624fc35032dfd0d45196c155f4a59 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Tue, 22 Jan 2019 18:35:44 +0550 Subject: [PATCH 11/22] bumped to version 10.1.79 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index db9ca3309e..ff8ca74790 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.1.78' +__version__ = '10.1.79' def get_default_company(user=None): '''Get default company for user''' From 5555b2802f6d3e91f03cce562c9457604528c0d7 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Tue, 22 Jan 2019 18:37:09 +0550 Subject: [PATCH 12/22] bumped to version 11.0.3-beta.36 --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index bbadd7f150..cd352de394 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" develop_version = '12.x.x-develop' -staging_version = '11.0.3-beta.35' +staging_version = '11.0.3-beta.36' error_report_email = "support@erpnext.com" From da32916396721c3592044ef6ddef5c6316667a38 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 22 Jan 2019 19:06:06 +0530 Subject: [PATCH 13/22] fix: Enforce pricing rule based on rate on server side --- erpnext/controllers/accounts_controller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index cd373b84d7..f4cea4ad96 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -248,7 +248,6 @@ class AccountsController(TransactionBase): if self.get("is_subcontracted"): args["is_subcontracted"] = self.is_subcontracted ret = get_item_details(args) - for fieldname, value in ret.items(): if item.meta.get_field(fieldname) and value is not None: if (item.get(fieldname) is None or fieldname in force_item_fields): @@ -267,9 +266,10 @@ class AccountsController(TransactionBase): if ret.get("pricing_rule"): # if user changed the discount percentage then set user's discount percentage ? + item.set("pricing_rule", ret.get("pricing_rule")) item.set("discount_percentage", ret.get("discount_percentage")) - if ret.get("pricing_rule_for") == "Price": - item.set("pricing_list_rate", ret.get("pricing_list_rate")) + if ret.get("pricing_rule_for") == "Rate": + item.set("price_list_rate", ret.get("price_list_rate")) if item.price_list_rate: item.rate = flt(item.price_list_rate * From 237a871f17787b6a8842a3f3ac1e3efb3072d89a Mon Sep 17 00:00:00 2001 From: "FinByz Tech Pvt. Ltd" Date: Tue, 22 Jan 2019 20:49:06 +0530 Subject: [PATCH 14/22] fix: NoneType object has no attribute "gstin" (#16458) * fix: NoneType object has no attribute "gstin" * fix: handle NoneType values --- erpnext/regional/india/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py index fd0eb34abc..d7a025805c 100644 --- a/erpnext/regional/india/utils.py +++ b/erpnext/regional/india/utils.py @@ -5,7 +5,7 @@ from erpnext.regional.india import states, state_numbers from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount def validate_gstin_for_india(doc, method): - if not hasattr(doc, 'gstin'): + if not hasattr(doc, 'gstin') or not doc.gstin: return doc.gstin = doc.gstin.upper().strip() From 4b4265f8a7521a55d0c250c660412f3b8afe03b0 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 22 Jan 2019 20:54:21 +0530 Subject: [PATCH 15/22] fix(dead-code): Remove .py files (#16457) --- erpnext/crm/doctype/lead/.py | 9 --------- erpnext/manufacturing/doctype/work_order/.py | 8 -------- 2 files changed, 17 deletions(-) delete mode 100644 erpnext/crm/doctype/lead/.py delete mode 100644 erpnext/manufacturing/doctype/work_order/.py diff --git a/erpnext/crm/doctype/lead/.py b/erpnext/crm/doctype/lead/.py deleted file mode 100644 index 70a6b22a99..0000000000 --- a/erpnext/crm/doctype/lead/.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class Lead(Document): - pass diff --git a/erpnext/manufacturing/doctype/work_order/.py b/erpnext/manufacturing/doctype/work_order/.py deleted file mode 100644 index 4476b16dbc..0000000000 --- a/erpnext/manufacturing/doctype/work_order/.py +++ /dev/null @@ -1,8 +0,0 @@ -import frappe - -def set_required_items(production_order): - pass - -def reserve_for_production(production_order): - '''Reserve pending raw materials for production''' - pass \ No newline at end of file From 55a08dee785da2ba6239d20e2a2d7a1f8634530e Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 23 Jan 2019 00:28:02 +0530 Subject: [PATCH 16/22] style: Remove unusued local variable --- erpnext/stock/stock_balance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py index 09d4e43840..045bee52d9 100644 --- a/erpnext/stock/stock_balance.py +++ b/erpnext/stock/stock_balance.py @@ -257,7 +257,7 @@ def repost_all_stock_vouchers(): doc.update_stock_ledger() doc.make_gl_entries(repost_future_gle=False) frappe.db.commit() - except Exception as e: + except Exception: print(frappe.get_traceback()) rejected.append([voucher_type, voucher_no]) frappe.db.rollback() From f79937d64b7ae9a61fd138440e1b33585118398f Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 23 Jan 2019 00:28:37 +0530 Subject: [PATCH 17/22] style: Remove unused imports --- erpnext/accounts/party.py | 2 +- erpnext/controllers/item_variant.py | 2 -- erpnext/controllers/selling_controller.py | 2 +- erpnext/controllers/stock_controller.py | 2 +- erpnext/hub_node/api.py | 4 ---- erpnext/shopping_cart/product_info.py | 2 +- erpnext/startup/__init__.py | 1 - erpnext/templates/utils.py | 5 ++--- erpnext/tests/test_woocommerce.py | 2 +- erpnext/www/payment_setup_certification.py | 1 - 10 files changed, 7 insertions(+), 16 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index a69a172284..1d1eb21eac 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -14,7 +14,7 @@ from frappe.contacts.doctype.address.address import (get_address_display, from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency from erpnext.accounts.utils import get_fiscal_year -from erpnext import get_default_currency, get_company_currency +from erpnext import get_company_currency from six import iteritems diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 24726ad03b..646f23879a 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -260,8 +260,6 @@ def generate_keyed_value_combinations(args): return results def copy_attributes_to_variant(item, variant): - from frappe.model import no_value_fields - # copy non no-copy fields exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website", diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 684a2cdbcb..a9883017cf 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -8,7 +8,7 @@ from frappe import _, throw from erpnext.stock.get_item_details import get_bin_details from erpnext.stock.utils import get_incoming_rate from erpnext.stock.get_item_details import get_conversion_factor -from erpnext.stock.doctype.item.item import get_item_defaults, set_item_default +from erpnext.stock.doctype.item.item import set_item_default from frappe.contacts.doctype.address.address import get_address_display from erpnext.controllers.stock_controller import StockController diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 0b19b7aaf9..0a3cd3499b 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals import frappe, erpnext from frappe.utils import cint, flt, cstr -from frappe import msgprint, _ +from frappe import _ import frappe.defaults from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py index c236822490..0c94df3159 100644 --- a/erpnext/hub_node/api.py +++ b/erpnext/hub_node/api.py @@ -2,10 +2,6 @@ from __future__ import unicode_literals import frappe import json -import io -import base64 -import os -import requests from frappe import _ from frappe.frappeclient import FrappeClient diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py index b5f129b4aa..3af5afa044 100644 --- a/erpnext/shopping_cart/product_info.py +++ b/erpnext/shopping_cart/product_info.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe from erpnext.shopping_cart.cart import _get_cart_quotation from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \ - import is_cart_enabled, get_shopping_cart_settings, show_quantity_in_website + import get_shopping_cart_settings, show_quantity_in_website from erpnext.utilities.product import get_price, get_qty_in_stock @frappe.whitelist(allow_guest=True) diff --git a/erpnext/startup/__init__.py b/erpnext/startup/__init__.py index b65fc0f10e..deef4ba4d6 100644 --- a/erpnext/startup/__init__.py +++ b/erpnext/startup/__init__.py @@ -19,7 +19,6 @@ # default settings that can be made for a user. from __future__ import unicode_literals -import frappe product_name = "ERPNext" user_defaults = { diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py index eb84bcc8d8..03060201bb 100644 --- a/erpnext/templates/utils.py +++ b/erpnext/templates/utils.py @@ -3,9 +3,8 @@ from __future__ import unicode_literals -import frappe, json -from frappe import _ -from frappe.utils import cint, formatdate +import frappe + @frappe.whitelist(allow_guest=True) def send_message(subject="Website Query", message="", sender="", status="Open"): diff --git a/erpnext/tests/test_woocommerce.py b/erpnext/tests/test_woocommerce.py index 0347e953f4..a48d48cde1 100644 --- a/erpnext/tests/test_woocommerce.py +++ b/erpnext/tests/test_woocommerce.py @@ -1,4 +1,4 @@ -import unittest, frappe, requests, os, time, erpnext +import unittest, frappe, requests, os, time from erpnext.erpnext_integrations.connectors.woocommerce_connection import order class TestWoocommerce(unittest.TestCase): diff --git a/erpnext/www/payment_setup_certification.py b/erpnext/www/payment_setup_certification.py index 185c220942..c65cddb5ca 100644 --- a/erpnext/www/payment_setup_certification.py +++ b/erpnext/www/payment_setup_certification.py @@ -1,5 +1,4 @@ import frappe -import foundation no_cache = 1 From 819a16d0f56a011e216c869ebf9107f8cb0e7571 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 23 Jan 2019 07:57:08 +0530 Subject: [PATCH 18/22] fix(dead-code): Remove .py files (#16462) --- erpnext/crm/doctype/lead/.py | 9 --------- erpnext/manufacturing/doctype/production_order/.py | 8 -------- 2 files changed, 17 deletions(-) delete mode 100644 erpnext/crm/doctype/lead/.py delete mode 100644 erpnext/manufacturing/doctype/production_order/.py diff --git a/erpnext/crm/doctype/lead/.py b/erpnext/crm/doctype/lead/.py deleted file mode 100644 index 70a6b22a99..0000000000 --- a/erpnext/crm/doctype/lead/.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class Lead(Document): - pass diff --git a/erpnext/manufacturing/doctype/production_order/.py b/erpnext/manufacturing/doctype/production_order/.py deleted file mode 100644 index 4476b16dbc..0000000000 --- a/erpnext/manufacturing/doctype/production_order/.py +++ /dev/null @@ -1,8 +0,0 @@ -import frappe - -def set_required_items(production_order): - pass - -def reserve_for_production(production_order): - '''Reserve pending raw materials for production''' - pass \ No newline at end of file From 49e09624d675c13538cc571169766569f5d95bd9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 23 Jan 2019 10:43:00 +0530 Subject: [PATCH 19/22] fix(projects): None type handling while updating tasks --- erpnext/projects/doctype/project/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 9654ca345e..dcf485a803 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -162,7 +162,7 @@ class Project(Document): def is_row_updated(self, row, existing_task_data, fields): if self.get("__islocal") or not existing_task_data: return True - d = existing_task_data.get(row.task_id) + d = existing_task_data.get(row.task_id, {}) for field in fields: if row.get(field) != d.get(field): From 342854f6f2388599f0ccaf1b8ea4ba72bee08880 Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Wed, 23 Jan 2019 08:08:53 +0000 Subject: [PATCH 20/22] bumped to version 10.1.80 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ff8ca74790..847618232c 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.1.79' +__version__ = '10.1.80' def get_default_company(user=None): '''Get default company for user''' From 2d5bf69dc445a26f59b9cd4516b5b31f3be2c17f Mon Sep 17 00:00:00 2001 From: Frappe Bot Date: Wed, 23 Jan 2019 08:12:19 +0000 Subject: [PATCH 21/22] bumped to version 11.0.3-beta.37 --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index cd352de394..3c3750a4fb 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" develop_version = '12.x.x-develop' -staging_version = '11.0.3-beta.36' +staging_version = '11.0.3-beta.37' error_report_email = "support@erpnext.com" From 41b3756df5eac4fa9a46e2448a17db13f718dc85 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Thu, 24 Jan 2019 10:57:05 +0530 Subject: [PATCH 22/22] fix: patch to replace Project icon with Projects icon (#16374) * Delete duplicate projects icon from desktop.py * Fix patch (to replace project to projects) --- erpnext/config/desktop.py | 7 ----- erpnext/patches.txt | 3 +- ..._icon_with_projects_module_desktop_icon.py | 31 +++++++++---------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index cc7ee02f2a..762f48a52e 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -135,13 +135,6 @@ def get_data(): "link": "leaderboard", "label": _("Leaderboard") }, - { - "module_name": "Projects", - "color": "#8e44ad", - "icon": "octicon octicon-rocket", - "type": "module", - "hidden": 1 - }, { "module_name": "Support", "color": "#2c3e50", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index d4e4243d87..35dfd892f7 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -585,4 +585,5 @@ erpnext.patches.v11_0.renamed_from_to_fields_in_project erpnext.patches.v12_0.change_qms_icon erpnext.patches.v12_0.rename_learn_to_help erpnext.patches.v12_0.rename_accounts_desktop_icon_to_accounting -erpnext.patches.v12_0.replace_project_list_desktop_icon_with_projects_module_desktop_icon +erpnext.patches.v12_0.replace_project_list_desktop_icon_with_projects_module_desktop_icon # 09-01-2019 +erpnext.patches.v11_0.rename_additional_salary_component_additional_salary \ No newline at end of file diff --git a/erpnext/patches/v12_0/replace_project_list_desktop_icon_with_projects_module_desktop_icon.py b/erpnext/patches/v12_0/replace_project_list_desktop_icon_with_projects_module_desktop_icon.py index daa6725f4d..dc848f4788 100644 --- a/erpnext/patches/v12_0/replace_project_list_desktop_icon_with_projects_module_desktop_icon.py +++ b/erpnext/patches/v12_0/replace_project_list_desktop_icon_with_projects_module_desktop_icon.py @@ -1,24 +1,23 @@ import frappe def execute(): - frappe.db.sql("""DELETE - FROM `tabDesktop Icon` - WHERE - `module_name` in ('Project', 'Projects') AND - `standard`=1 AND - `app`='erpnext' - """) + projects_icons = frappe.get_all('Desktop Icon', filters={ + 'module_name': ['in', ('Project', 'Projects')], + }) - desktop_icon = frappe.get_doc({ - 'doctype': 'Desktop Icon', - 'idx': 5, - 'standard': 1, - 'app': 'erpnext', - 'owner': 'Administrator', + fields_to_update = { 'module_name': 'Projects', 'color': '#8e44ad', 'icon': 'octicon octicon-rocket', - 'type': 'module' - }) + 'type': 'module', + 'link': '' + } - desktop_icon.save() + for icon in projects_icons: + icon_doc = frappe.get_doc('Desktop Icon', icon.name) + icon_doc.update(fields_to_update) + try: + icon_doc.save() + except frappe.exceptions.UniqueValidationError: + # delete duplicate icon + icon_doc.delete()