Fix: Raw Material Cost needed order
This commit is contained in:
parent
bfdf70cdc4
commit
cdc988c015
@ -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(
|
||||
has_been_issued: int = db.execute(
|
||||
select(func.count(Inventory.id)).where(Inventory.batch_id == item.batch.id, Inventory.id != item.id)
|
||||
)
|
||||
.scalar_one()
|
||||
)
|
||||
).scalar_one()
|
||||
if has_been_issued > 0:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user