Fix: The batch integrity report was not taking into account the closing stock entries and resetting stock to wrong levels. Fixed
This commit is contained in:
parent
9f2e28a035
commit
68390a1eb6
@ -17,7 +17,6 @@ from ..models.journal import Journal
|
|||||||
from ..models.product import Product
|
from ..models.product import Product
|
||||||
from ..models.stock_keeping_unit import StockKeepingUnit
|
from ..models.stock_keeping_unit import StockKeepingUnit
|
||||||
from ..models.voucher import Voucher
|
from ..models.voucher import Voucher
|
||||||
from ..models.voucher_type import VoucherType
|
|
||||||
from ..schemas.user import UserToken
|
from ..schemas.user import UserToken
|
||||||
from .issue import refresh_voucher
|
from .issue import refresh_voucher
|
||||||
|
|
||||||
@ -47,14 +46,6 @@ def negative_batches(db: Session) -> List[schemas.BatchIntegrity]:
|
|||||||
.join(Inventory.voucher)
|
.join(Inventory.voucher)
|
||||||
.join(Voucher.journals)
|
.join(Voucher.journals)
|
||||||
.where(
|
.where(
|
||||||
Voucher.voucher_type.in_(
|
|
||||||
[
|
|
||||||
VoucherType.PURCHASE,
|
|
||||||
VoucherType.PURCHASE_RETURN,
|
|
||||||
VoucherType.ISSUE,
|
|
||||||
VoucherType.OPENING_BATCHES,
|
|
||||||
]
|
|
||||||
),
|
|
||||||
Journal.cost_centre_id == CostCentre.cost_centre_purchase(),
|
Journal.cost_centre_id == CostCentre.cost_centre_purchase(),
|
||||||
)
|
)
|
||||||
.group_by(Batch, Product.name)
|
.group_by(Batch, Product.name)
|
||||||
@ -87,14 +78,6 @@ def batch_details(batch_id: uuid.UUID, db: Session) -> List[schemas.BatchIntegri
|
|||||||
.join(Voucher.journals)
|
.join(Voucher.journals)
|
||||||
.where(
|
.where(
|
||||||
Inventory.batch_id == batch_id,
|
Inventory.batch_id == batch_id,
|
||||||
Voucher.voucher_type.in_(
|
|
||||||
[
|
|
||||||
VoucherType.PURCHASE,
|
|
||||||
VoucherType.PURCHASE_RETURN,
|
|
||||||
VoucherType.ISSUE,
|
|
||||||
VoucherType.OPENING_BATCHES,
|
|
||||||
]
|
|
||||||
),
|
|
||||||
Journal.cost_centre_id == CostCentre.cost_centre_purchase(),
|
Journal.cost_centre_id == CostCentre.cost_centre_purchase(),
|
||||||
)
|
)
|
||||||
).all()
|
).all()
|
||||||
|
Loading…
Reference in New Issue
Block a user