Merge branch 'develop' into manufacturing-work-order-closed
diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
index 002e312..5cbf00b 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
+++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
@@ -342,7 +342,15 @@
def get_je_matching_query(amount_condition, transaction):
# get matching journal entry query
- cr_or_dr = "credit" if transaction.withdrawal > 0 else "debit"
+
+ company_account = frappe.get_value("Bank Account", transaction.bank_account, "account")
+ root_type = frappe.get_value("Account", company_account, "root_type")
+
+ if root_type == "Liability":
+ cr_or_dr = "debit" if transaction.withdrawal > 0 else "credit"
+ else:
+ cr_or_dr = "credit" if transaction.withdrawal > 0 else "debit"
+
return f"""
SELECT
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index cd270f5..59d46fc 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -2029,7 +2029,7 @@
mpa.parent = mp.name and
mpa.company = %s and
mp.enabled = 1 and
- mp.name in (%s)
+ mp.name in %s
group by
mp.name
""", (company, mode_of_payments), as_dict=1)
diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
index 86b4b86..170aa7f 100644
--- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
@@ -31,6 +31,9 @@
self.voucher_type = None
self.voucher_no = None
+ self.allow_negative_stock = self.allow_negative_stock or \
+ cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock"))
+
def set_company(self):
if self.voucher_type and self.voucher_no:
self.company = frappe.get_cached_value(self.voucher_type, self.voucher_no, "company")
diff --git a/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py b/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
index a381820..6aa12ac 100644
--- a/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
+++ b/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
@@ -46,7 +46,7 @@
return row
def get_stock_ledger_entries(report_filters):
- filters = {}
+ filters = {"is_cancelled": 0}
fields = ['name', 'voucher_type', 'voucher_no', 'item_code', 'actual_qty',
'posting_date', 'posting_time', 'company', 'warehouse', 'qty_after_transaction', 'batch_no']