Merge branch 'staging-fixes' into staging
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index f9df4ac..a482dac 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
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'''
diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py
index 08f8248..b13259b 100644
--- a/erpnext/accounts/doctype/bank_account/bank_account.py
+++ b/erpnext/accounts/doctype/bank_account/bank_account.py
@@ -31,3 +31,13 @@
doc.is_default = 1
return doc
+
+@frappe.whitelist()
+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 afb44e8..30ae54b 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -284,7 +284,12 @@
() => 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);
+ }
+ }
]);
}
}
@@ -833,6 +838,25 @@
}
})
}
+ },
+
+ 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_details",
+ args: {
+ bank_account: frm.doc.bank_account
+ },
+ callback: function(r) {
+ if (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.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json
index bc9062b..9354c61 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,
@@ -514,6 +515,40 @@
"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,
+ "allow_on_submit": 0,
+ "bold": 0,
"collapsible": 1,
"columns": 0,
"fieldname": "payment_accounts_section",
@@ -1874,6 +1909,72 @@
"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,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "payment_order",
"fieldtype": "Link",
"hidden": 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",
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index f213ffa..7f1f550 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.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 @@
.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 @@
@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 @@
_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 @@
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/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
index b211b50..cfb24c3 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 7cd951a..094ece9 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -25,7 +25,7 @@
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 @@
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 @@
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 @@
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/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index d28dc93..f2d5006 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
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index a69a172..1e1f8b5 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -14,7 +14,7 @@
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
@@ -562,3 +562,12 @@
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 - 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/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index 842ecdb..cc21d34 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 @@
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 @@
credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt"
columns += [{
+ "label": _("Advance Amount"),
+ "fieldname": "advance_amount",
+ "fieldtype": "Currency",
+ "options": "currency",
+ "width": 100
+ },{
"label": _("Total Invoiced Amt"),
"fieldname": "total_invoiced_amt",
"fieldtype": "Currency",
@@ -129,12 +136,15 @@
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,
@@ -185,6 +195,9 @@
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":
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 d81a8f3..b19f630 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 @@
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 @@
# 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 @@
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 @@
return total_invoiced_amount, tds_deducted
-def get_columns():
+def get_columns(filters):
columns = [
{
"label": _("PAN"),
@@ -100,7 +108,17 @@
"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 @@
"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 843b58f..e55c022 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 @@
validate_filters(filters)
set_filters(filters)
- columns = get_columns()
+ columns = get_columns(filters)
if not filters["invoices"]:
return columns, []
@@ -43,6 +43,7 @@
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 @@
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 @@
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 @@
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 @@
"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 @@
"options": "transaction_type",
"width": 90
}
- ]
+ ])
return columns
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js
index c09fa71..cdc7745 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.js
+++ b/erpnext/accounts/report/trial_balance/trial_balance.js
@@ -13,21 +13,6 @@
"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"),
"fieldtype": "Link",
@@ -61,6 +46,27 @@
"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"),
"fieldtype": "Check",
@@ -75,6 +81,11 @@
"fieldname": "show_unclosed_fy_pl_balances",
"label": __("Show unclosed fiscal year's P&L balances"),
"fieldtype": "Check"
+ },
+ {
+ "fieldname": "include_default_book_entries",
+ "label": __("Include Default 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 07dcd4e..6b18c5d 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -67,11 +67,10 @@
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 @@
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_default_book_entries:
+ fb_conditions = " and (finance_book in (%(finance_book)s, %(company_fb)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,9 @@
"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,
+ "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 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/report/trial_balance_simple/__init__.py
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 ea5a97b..fab3a76 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",
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 6fbe97d..e145a35 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -615,7 +615,7 @@
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 @@
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 @@
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/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 3b1f4e0..4586c64 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -156,6 +156,39 @@
"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,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "tax_id",
"fieldtype": "Data",
"hidden": 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/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index cd373b8..197b955 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -248,7 +248,6 @@
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 @@
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 *
@@ -953,11 +953,12 @@
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 @@
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 @@
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)
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 24726ad..646f238 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -260,8 +260,6 @@
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 684a2cd..a988301 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -8,7 +8,7 @@
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 0b19b7a..0a3cd34 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/crm/doctype/lead/.py b/erpnext/crm/doctype/lead/.py
deleted file mode 100644
index 70a6b22..0000000
--- 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/hooks.py b/erpnext/hooks.py
index cd352de..3c3750a 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -12,7 +12,7 @@
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"
diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py
index c236822..0c94df3 100644
--- a/erpnext/hub_node/api.py
+++ b/erpnext/hub_node/api.py
@@ -2,10 +2,6 @@
import frappe
import json
-import io
-import base64
-import os
-import requests
from frappe import _
from frappe.frappeclient import FrappeClient
diff --git a/erpnext/manufacturing/doctype/work_order/.py b/erpnext/manufacturing/doctype/work_order/.py
deleted file mode 100644
index 4476b16..0000000
--- 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
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index 9654ca3..dcf485a 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -162,7 +162,7 @@
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):
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index a1fba07..43ed868 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -8,7 +8,7 @@
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
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() if doc.gstin else ""
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index 608c0e9..a82042f 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -224,6 +224,39 @@
"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,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "lead_name",
"fieldtype": "Link",
"hidden": 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",
diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py
index b5f129b..3af5afa 100644
--- a/erpnext/shopping_cart/product_info.py
+++ b/erpnext/shopping_cart/product_info.py
@@ -6,7 +6,7 @@
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 b65fc0f..deef4ba 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/stock/stock_balance.py b/erpnext/stock/stock_balance.py
index 09d4e43..045bee5 100644
--- a/erpnext/stock/stock_balance.py
+++ b/erpnext/stock/stock_balance.py
@@ -257,7 +257,7 @@
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()
diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py
index eb84bcc..0306020 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 0347e95..a48d48c 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 185c220..c65cddb 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