diff --git a/erpnext/__init__.py b/erpnext/__init__.py index ae6fc49cea2..1d5e77b73e3 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__ = '11.1.50' +__version__ = '11.1.51' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index 4899e6ecf0f..a40e99a8d93 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -45,7 +45,7 @@ class BankTransaction(StatusUpdater): def clear_linked_payment_entries(self): for payment_entry in self.payment_entries: allocated_amount = get_total_allocated_amount(payment_entry) - paid_amount = get_paid_amount(payment_entry) + paid_amount = get_paid_amount(payment_entry, self.currency) if paid_amount and allocated_amount: if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount): @@ -80,9 +80,17 @@ def get_total_allocated_amount(payment_entry): AND bt.docstatus = 1""", (payment_entry.payment_document, payment_entry.payment_entry), as_dict=True) -def get_paid_amount(payment_entry): +def get_paid_amount(payment_entry, currency): if payment_entry.payment_document in ["Payment Entry", "Sales Invoice", "Purchase Invoice"]: - return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "paid_amount") + + paid_amount_field = "paid_amount" + if payment_entry.payment_document == 'Payment Entry': + doc = frappe.get_doc("Payment Entry", payment_entry.payment_entry) + paid_amount_field = ("base_paid_amount" + if doc.paid_to_account_currency == currency else "paid_amount") + + return frappe.db.get_value(payment_entry.payment_document, + payment_entry.payment_entry, paid_amount_field) elif payment_entry.payment_document == "Journal Entry": return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "total_credit") diff --git a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py index 36c939996fe..bd4b4d7e0b1 100644 --- a/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py +++ b/erpnext/accounts/page/bank_reconciliation/bank_reconciliation.py @@ -124,8 +124,6 @@ def check_matching_amount(bank_account, company, transaction): 'txt': '%%%s%%' % amount }, as_dict=True) - frappe.errprint(journal_entries) - if transaction.credit > 0: sales_invoices = frappe.db.sql(""" SELECT diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py index daf1532ce4c..dab63c4c46a 100644 --- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py +++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py @@ -12,6 +12,16 @@ from erpnext.accounts.utils import get_fiscal_year from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee class PayrollEntry(Document): + def onload(self): + if not self.docstatus==1: + return + + # check if salary slips were manually submitted + entries = frappe.db.count("Salary Slip", {'payroll_entry': self.name, 'docstatus': 1}, ['name']) + if cint(entries) == len(self.employees) and not self.salary_slips_submitted: + self.db_set("salary_slips_submitted", 1) + self.reload() + def on_submit(self): self.create_salary_slips()