Skip to content

Commit

Permalink
Merge pull request #43706 from frappe/mergify/bp/version-15/pr-43692
Browse files Browse the repository at this point in the history
fix: list view and form status not same for purchase order (backport #43690) (backport #43692)
  • Loading branch information
rohitwaghchaure authored Oct 17, 2024
2 parents 99ead94 + 752d175 commit 6f98fe1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
}
if (doc.status != "Closed") {
if (doc.status != "On Hold") {
if (flt(doc.per_received, 2) < 100 && allow_receipt) {
if (flt(doc.per_received) < 100 && allow_receipt) {
cur_frm.add_custom_button(
__("Purchase Receipt"),
this.make_purchase_receipt,
Expand All @@ -408,7 +408,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
}
}
}
if (flt(doc.per_billed, 2) < 100)
if (flt(doc.per_billed) < 100)
cur_frm.add_custom_button(
__("Purchase Invoice"),
this.make_purchase_invoice,
Expand Down
17 changes: 5 additions & 12 deletions erpnext/buying/doctype/purchase_order/purchase_order_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ frappe.listview_settings["Purchase Order"] = {
"status",
],
get_indicator: function (doc) {
// Please do not add precision in the flt function
if (doc.status === "Closed") {
return [__("Closed"), "green", "status,=,Closed"];
} else if (doc.status === "On Hold") {
return [__("On Hold"), "orange", "status,=,On Hold"];
} else if (doc.status === "Delivered") {
return [__("Delivered"), "green", "status,=,Closed"];
} else if (flt(doc.per_received, 2) < 100 && doc.status !== "Closed") {
if (flt(doc.per_billed, 2) < 100) {
} else if (flt(doc.per_received) < 100 && doc.status !== "Closed") {
if (flt(doc.per_billed) < 100) {
return [
__("To Receive and Bill"),
"orange",
Expand All @@ -26,17 +27,9 @@ frappe.listview_settings["Purchase Order"] = {
} else {
return [__("To Receive"), "orange", "per_received,<,100|per_billed,=,100|status,!=,Closed"];
}
} else if (
flt(doc.per_received, 2) >= 100 &&
flt(doc.per_billed, 2) < 100 &&
doc.status !== "Closed"
) {
} else if (flt(doc.per_received) >= 100 && flt(doc.per_billed) < 100 && doc.status !== "Closed") {
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Closed"];
} else if (
flt(doc.per_received, 2) >= 100 &&
flt(doc.per_billed, 2) == 100 &&
doc.status !== "Closed"
) {
} else if (flt(doc.per_received) >= 100 && flt(doc.per_billed) == 100 && doc.status !== "Closed") {
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Closed"];
}
},
Expand Down

0 comments on commit 6f98fe1

Please sign in to comment.