mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
Merge branch 'version-11-hotfix' into version-11
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '11.1.50'
|
__version__ = '11.1.51'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class BankTransaction(StatusUpdater):
|
|||||||
def clear_linked_payment_entries(self):
|
def clear_linked_payment_entries(self):
|
||||||
for payment_entry in self.payment_entries:
|
for payment_entry in self.payment_entries:
|
||||||
allocated_amount = get_total_allocated_amount(payment_entry)
|
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 paid_amount and allocated_amount:
|
||||||
if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount):
|
if flt(allocated_amount[0]["allocated_amount"]) > flt(paid_amount):
|
||||||
@@ -80,9 +80,17 @@ def get_total_allocated_amount(payment_entry):
|
|||||||
AND
|
AND
|
||||||
bt.docstatus = 1""", (payment_entry.payment_document, payment_entry.payment_entry), as_dict=True)
|
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"]:
|
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":
|
elif payment_entry.payment_document == "Journal Entry":
|
||||||
return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "total_credit")
|
return frappe.db.get_value(payment_entry.payment_document, payment_entry.payment_entry, "total_credit")
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ def check_matching_amount(bank_account, company, transaction):
|
|||||||
'txt': '%%%s%%' % amount
|
'txt': '%%%s%%' % amount
|
||||||
}, as_dict=True)
|
}, as_dict=True)
|
||||||
|
|
||||||
frappe.errprint(journal_entries)
|
|
||||||
|
|
||||||
if transaction.credit > 0:
|
if transaction.credit > 0:
|
||||||
sales_invoices = frappe.db.sql("""
|
sales_invoices = frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ from erpnext.accounts.utils import get_fiscal_year
|
|||||||
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
|
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
|
||||||
|
|
||||||
class PayrollEntry(Document):
|
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):
|
def on_submit(self):
|
||||||
self.create_salary_slips()
|
self.create_salary_slips()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user