fix: get stock balance filtered by company for validating stock value in jv (#45549)

* fix: get stock balance filtered by company for validating stock value in jv

* test: error is raised  on validate
This commit is contained in:
Lakshit Jain
2025-01-29 12:16:11 +05:30
committed by GitHub
parent a64a4f9b20
commit 9f20854bd9
3 changed files with 9 additions and 4 deletions

View File

@@ -58,7 +58,10 @@ def get_stock_value_from_bin(warehouse=None, item_code=None):
def get_stock_value_on(
warehouses: list | str | None = None, posting_date: str | None = None, item_code: str | None = None
warehouses: list | str | None = None,
posting_date: str | None = None,
item_code: str | None = None,
company: str | None = None,
) -> float:
if not posting_date:
posting_date = nowdate()
@@ -84,6 +87,9 @@ def get_stock_value_on(
if item_code:
query = query.where(sle.item_code == item_code)
if company:
query = query.where(sle.company == company)
return query.run(as_list=True)[0][0]