mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 02:01:21 +00:00
fix: Handle Get Items From in Sales Order
- Map all non alternatives from Quotation to SO if no selected items - Show disclaimer mentioning that Qtns with alternatives must be mapped to SO from the Qtn form
This commit is contained in:
@@ -303,16 +303,20 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
|
|||||||
def can_map_row(item) -> bool:
|
def can_map_row(item) -> bool:
|
||||||
"""
|
"""
|
||||||
Row mapping from Quotation to Sales order:
|
Row mapping from Quotation to Sales order:
|
||||||
1. Simple row: Map if adequate qty
|
1. If no selections, map all non-alternative rows (that sum up to the grand total)
|
||||||
2. Has Alternative Item: Map if no alternative was selected against original item and #1
|
2. If selections: Is Alternative Item/Has Alternative Item: Map if selected and adequate qty
|
||||||
3. Is Alternative Item: Map if alternative was selected against original item and #1
|
3. If selections: Simple row: Map if adequate qty
|
||||||
"""
|
"""
|
||||||
has_qty = item.qty > 0
|
has_qty = item.qty > 0
|
||||||
if not (item.is_alternative or item.has_alternative_item):
|
|
||||||
# No alternative items in doc or current row is a simple item (without alternatives)
|
|
||||||
return has_qty
|
|
||||||
|
|
||||||
return (item.name in selected_rows) and has_qty
|
if not selected_rows:
|
||||||
|
return not item.is_alternative
|
||||||
|
|
||||||
|
if selected_rows and (item.is_alternative or item.has_alternative_item):
|
||||||
|
return (item.name in selected_rows) and has_qty
|
||||||
|
|
||||||
|
# Simple row
|
||||||
|
return has_qty
|
||||||
|
|
||||||
doclist = get_mapped_doc(
|
doclist = get_mapped_doc(
|
||||||
"Quotation",
|
"Quotation",
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
|||||||
if (this.frm.doc.docstatus===0) {
|
if (this.frm.doc.docstatus===0) {
|
||||||
this.frm.add_custom_button(__('Quotation'),
|
this.frm.add_custom_button(__('Quotation'),
|
||||||
function() {
|
function() {
|
||||||
erpnext.utils.map_current_doc({
|
let d = erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
|
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
|
||||||
source_doctype: "Quotation",
|
source_doctype: "Quotation",
|
||||||
target: me.frm,
|
target: me.frm,
|
||||||
@@ -293,7 +293,16 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
|||||||
docstatus: 1,
|
docstatus: 1,
|
||||||
status: ["!=", "Lost"]
|
status: ["!=", "Lost"]
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
d.$parent.append(`
|
||||||
|
<span class='small text-muted'>
|
||||||
|
${__("Note: Please create Sales Orders from individual Quotations to select from among Alternative Items.")}
|
||||||
|
</span>
|
||||||
|
`);
|
||||||
|
}, 200);
|
||||||
|
|
||||||
}, __("Get Items From"));
|
}, __("Get Items From"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user