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()
|
db.flush()
|
||||||
fix_single_batch_prices(item.batch_id, db)
|
fix_single_batch_prices(item.batch_id, db)
|
||||||
else:
|
else:
|
||||||
has_been_issued: int = (
|
has_been_issued: int = db.execute(
|
||||||
db.execute(
|
|
||||||
select(func.count(Inventory.id)).where(Inventory.batch_id == item.batch.id, Inventory.id != item.id)
|
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:
|
if has_been_issued > 0:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||||
|
@ -117,11 +117,12 @@ def build_report(
|
|||||||
sale=sale,
|
sale=sale,
|
||||||
rmc=rmc,
|
rmc=rmc,
|
||||||
url=["/", "raw-material-cost", str(cost_centre.id)],
|
url=["/", "raw-material-cost", str(cost_centre.id)],
|
||||||
|
order=0,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
rmc = 0 if sales == 0 else issues / sales
|
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(
|
def build_report_id(
|
||||||
|
Loading…
Reference in New Issue
Block a user