Compare commits

..

2 Commits

Author SHA1 Message Date
rohitwaghchaure
2c63fc3b26 fix: missed to add voucher_type, voucher_no to get GL Entries (#27368)
* fix: missed to add voucher_type, voucher_no to get gl entries

* test: get voucherwise details utilities

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
(cherry picked from commit 058d98342a)

# Conflicts:
#	erpnext/accounts/test/test_utils.py
#	erpnext/accounts/utils.py
2025-02-26 00:14:50 +00:00
mergify[bot]
f5160dc83d fix: use Stock Qty while getting POS Reserved Qty (backport #38962) (#38983)
fix: use `Stock Qty` while getting `POS Reserved Qty`

(cherry picked from commit 7223106417)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
2023-12-28 12:00:04 +05:30
4 changed files with 21 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import frappe
from erpnext.hooks import regional_overrides
__version__ = "13.55.2"
__version__ = "13.54.4"
def get_default_company(user=None):

View File

@@ -704,7 +704,7 @@ def get_pos_reserved_qty(item_code, warehouse):
reserved_qty = (
frappe.qb.from_(p_inv)
.from_(p_item)
.select(Sum(p_item.qty).as_("qty"))
.select(Sum(p_item.stock_qty).as_("stock_qty"))
.where(
(p_inv.name == p_item.parent)
& (IfNull(p_inv.consolidated_invoice, "") == "")
@@ -715,7 +715,7 @@ def get_pos_reserved_qty(item_code, warehouse):
)
).run(as_dict=True)
return reserved_qty[0].qty or 0 if reserved_qty else 0
return flt(reserved_qty[0].stock_qty) if reserved_qty else 0
@frappe.whitelist()

View File

@@ -4,6 +4,7 @@ import frappe
from frappe.test_runner import make_test_objects
from erpnext.accounts.party import get_party_shipping_address
<<<<<<< HEAD
from erpnext.accounts.utils import (
get_future_stock_vouchers,
get_voucherwise_gl_entries,
@@ -12,6 +13,10 @@ from erpnext.accounts.utils import (
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
=======
from erpnext.accounts.utils import get_future_stock_vouchers, get_voucherwise_gl_entries
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
>>>>>>> 058d98342a (fix: missed to add voucher_type, voucher_no to get GL Entries (#27368))
class TestUtils(unittest.TestCase):
@@ -50,6 +55,7 @@ class TestUtils(unittest.TestCase):
posting_date = "2021-01-01"
gl_entries = get_voucherwise_gl_entries(future_vouchers, posting_date)
self.assertTrue(
<<<<<<< HEAD
voucher_type_and_no in gl_entries,
msg="get_voucherwise_gl_entries not returning expected GLes",
)
@@ -72,6 +78,10 @@ class TestUtils(unittest.TestCase):
sorted_vouchers = sort_stock_vouchers_by_posting_date(list(reversed(vouchers)))
self.assertEqual(sorted_vouchers, vouchers)
=======
voucher_type_and_no in gl_entries, msg="get_voucherwise_gl_entries not returning expected GLes",
)
>>>>>>> 058d98342a (fix: missed to add voucher_type, voucher_no to get GL Entries (#27368))
ADDRESS_RECORDS = [

View File

@@ -1302,7 +1302,11 @@ def get_voucherwise_gl_entries(future_stock_vouchers, posting_date):
Check compare_existing_and_expected_gle function below.
returns:
<<<<<<< HEAD
Dict[Tuple[voucher_type, voucher_no], List[GL Entries]]
=======
Dict[Tuple[voucher_type, voucher_no], List[GL Entries]]
>>>>>>> 058d98342a (fix: missed to add voucher_type, voucher_no to get GL Entries (#27368))
"""
gl_entries = {}
if not future_stock_vouchers:
@@ -1310,8 +1314,12 @@ def get_voucherwise_gl_entries(future_stock_vouchers, posting_date):
voucher_nos = [d[1] for d in future_stock_vouchers]
<<<<<<< HEAD
gles = frappe.db.sql(
"""
=======
gles = frappe.db.sql("""
>>>>>>> 058d98342a (fix: missed to add voucher_type, voucher_no to get GL Entries (#27368))
select name, account, credit, debit, cost_center, project, voucher_type, voucher_no
from `tabGL Entry`
where