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:
parent
3c96791d52
commit
19456127cf
@ -303,16 +303,20 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
|
||||
def can_map_row(item) -> bool:
|
||||
"""
|
||||
Row mapping from Quotation to Sales order:
|
||||
1. Simple row: Map if adequate qty
|
||||
2. Has Alternative Item: Map if no alternative was selected against original item and #1
|
||||
3. Is Alternative Item: Map if alternative was selected against original item and #1
|
||||
1. If no selections, map all non-alternative rows (that sum up to the grand total)
|
||||
2. If selections: Is Alternative Item/Has Alternative Item: Map if selected and adequate qty
|
||||
3. If selections: Simple row: Map if adequate qty
|
||||
"""
|
||||
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(
|
||||
"Quotation",
|
||||
|
@ -275,7 +275,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
||||
if (this.frm.doc.docstatus===0) {
|
||||
this.frm.add_custom_button(__('Quotation'),
|
||||
function() {
|
||||
erpnext.utils.map_current_doc({
|
||||
let d = erpnext.utils.map_current_doc({
|
||||
method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
|
||||
source_doctype: "Quotation",
|
||||
target: me.frm,
|
||||
@ -293,7 +293,16 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
||||
docstatus: 1,
|
||||
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"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user