Merge pull request #35712 from s-aga-r/FIX-ISS-23-24-01470
fix: `Process Loss Report`
This commit is contained in:
commit
6cb31a9770
@ -33,10 +33,9 @@ def get_data(filters: Filters) -> Data:
|
|||||||
wo.name,
|
wo.name,
|
||||||
wo.status,
|
wo.status,
|
||||||
wo.production_item,
|
wo.production_item,
|
||||||
wo.qty,
|
|
||||||
wo.produced_qty,
|
wo.produced_qty,
|
||||||
wo.process_loss_qty,
|
wo.process_loss_qty,
|
||||||
(wo.produced_qty - wo.process_loss_qty).as_("actual_produced_qty"),
|
wo.qty.as_("qty_to_manufacture"),
|
||||||
Sum(se.total_incoming_value).as_("total_fg_value"),
|
Sum(se.total_incoming_value).as_("total_fg_value"),
|
||||||
Sum(se.total_outgoing_value).as_("total_rm_value"),
|
Sum(se.total_outgoing_value).as_("total_rm_value"),
|
||||||
)
|
)
|
||||||
@ -44,6 +43,7 @@ def get_data(filters: Filters) -> Data:
|
|||||||
(wo.process_loss_qty > 0)
|
(wo.process_loss_qty > 0)
|
||||||
& (wo.company == filters.company)
|
& (wo.company == filters.company)
|
||||||
& (se.docstatus == 1)
|
& (se.docstatus == 1)
|
||||||
|
& (se.purpose == "Manufacture")
|
||||||
& (se.posting_date.between(filters.from_date, filters.to_date))
|
& (se.posting_date.between(filters.from_date, filters.to_date))
|
||||||
)
|
)
|
||||||
.groupby(se.work_order)
|
.groupby(se.work_order)
|
||||||
@ -79,20 +79,30 @@ def get_columns() -> Columns:
|
|||||||
"width": "100",
|
"width": "100",
|
||||||
},
|
},
|
||||||
{"label": _("Status"), "fieldname": "status", "fieldtype": "Data", "width": "100"},
|
{"label": _("Status"), "fieldname": "status", "fieldtype": "Data", "width": "100"},
|
||||||
|
{
|
||||||
|
"label": _("Qty To Manufacture"),
|
||||||
|
"fieldname": "qty_to_manufacture",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": "150",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": _("Manufactured Qty"),
|
"label": _("Manufactured Qty"),
|
||||||
"fieldname": "produced_qty",
|
"fieldname": "produced_qty",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": "150",
|
"width": "150",
|
||||||
},
|
},
|
||||||
{"label": _("Loss Qty"), "fieldname": "process_loss_qty", "fieldtype": "Float", "width": "150"},
|
|
||||||
{
|
{
|
||||||
"label": _("Actual Manufactured Qty"),
|
"label": _("Process Loss Qty"),
|
||||||
"fieldname": "actual_produced_qty",
|
"fieldname": "process_loss_qty",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"width": "150",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Process Loss Value"),
|
||||||
|
"fieldname": "total_pl_value",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": "150",
|
"width": "150",
|
||||||
},
|
},
|
||||||
{"label": _("Loss Value"), "fieldname": "total_pl_value", "fieldtype": "Float", "width": "150"},
|
|
||||||
{"label": _("FG Value"), "fieldname": "total_fg_value", "fieldtype": "Float", "width": "150"},
|
{"label": _("FG Value"), "fieldname": "total_fg_value", "fieldtype": "Float", "width": "150"},
|
||||||
{
|
{
|
||||||
"label": _("Raw Material Value"),
|
"label": _("Raw Material Value"),
|
||||||
@ -105,5 +115,5 @@ def get_columns() -> Columns:
|
|||||||
|
|
||||||
def update_data_with_total_pl_value(data: Data) -> None:
|
def update_data_with_total_pl_value(data: Data) -> None:
|
||||||
for row in data:
|
for row in data:
|
||||||
value_per_unit_fg = row["total_fg_value"] / row["actual_produced_qty"]
|
value_per_unit_fg = row["total_fg_value"] / row["qty_to_manufacture"]
|
||||||
row["total_pl_value"] = row["process_loss_qty"] * value_per_unit_fg
|
row["total_pl_value"] = row["process_loss_qty"] * value_per_unit_fg
|
||||||
|
Loading…
Reference in New Issue
Block a user