Fix: Raw Material Cost needed order

This commit is contained in:
Amritanshu Agrawal 2021-11-10 12:11:50 +05:30
parent bfdf70cdc4
commit cdc988c015
2 changed files with 5 additions and 7 deletions

View File

@ -285,12 +285,9 @@ def update_inventory(voucher: Voucher, vendor_id: uuid.UUID, inventories: List[I
db.flush()
fix_single_batch_prices(item.batch_id, db)
else:
has_been_issued: int = (
db.execute(
select(func.count(Inventory.id)).where(Inventory.batch_id == item.batch.id, Inventory.id != item.id)
)
.scalar_one()
)
has_been_issued: int = db.execute(
select(func.count(Inventory.id)).where(Inventory.batch_id == item.batch.id, Inventory.id != item.id)
).scalar_one()
if has_been_issued > 0:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,

View File

@ -117,11 +117,12 @@ def build_report(
sale=sale,
rmc=rmc,
url=["/", "raw-material-cost", str(cost_centre.id)],
order=0,
)
)
rmc = 0 if sales == 0 else issues / sales
return body, schemas.RawMaterialCostItem(name="Total", issue=issues, sale=sales, rmc=rmc)
return body, schemas.RawMaterialCostItem(name="Total", issue=issues, sale=sales, rmc=rmc, order=0)
def build_report_id(