Merge pull request #30217 from nextchamp-saqib/fix-so-to-po

fix: cannot create purchase order from sales order
This commit is contained in:
Saqib Ansari 2022-03-14 12:35:32 +05:30 committed by GitHub
commit f5f6650779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -693,12 +693,12 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
get_ordered_qty(item, so) {
let ordered_qty = item.ordered_qty;
if (so.packed_items) {
if (so.packed_items && so.packed_items.length) {
// calculate ordered qty based on packed items in case of product bundle
let packed_items = so.packed_items.filter(
(pi) => pi.parent_detail_docname == item.name
);
if (packed_items) {
if (packed_items && packed_items.length) {
ordered_qty = packed_items.reduce(
(sum, pi) => sum + flt(pi.ordered_qty),
0