I need more clarification on this method:
erpnext.utils.map_current_doc
How to use it and when ?
could give some example please
rohit_w
December 16, 2016, 6:29am
#2
Hi @Mohammed_Redha
This method is used to pull the data from another form to current form for example I am on sales invoice and I want to pull the data from the sales order, see below GIF for more details
Code of the above example
JS code:
if(doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
cur_frm.add_custom_button(__('Return / Credit Note'),
this.make_sales_return, __('Create'));
cur_frm.page.set_inner_btn_group_as_primary(__('Create'));
}
if(cint(doc.update_stock)!=1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false;
from_delivery_note = cur_frm.doc.items
.some(function(item) {
return item.delivery_note ? true : false;
});
if(!from_delivery_note && !is_delivered_by_supplier) {
PY code:
]
for table in [self.items, self.packed_items]:
for i in table:
bom = get_default_bom(i.item_code)
stock_qty = i.qty if i.doctype == "Packed Item" else i.stock_qty
if not for_raw_material_request:
total_work_order_qty = flt(
frappe.db.sql(
"""select sum(qty) from `tabWork Order`
where production_item=%s and sales_order=%s and sales_order_item = %s and docstatus<2""",
(i.item_code, self.name, i.name),
)[0][0]
)
pending_qty = stock_qty - total_work_order_qty
else:
pending_qty = stock_qty
if pending_qty and i.item_code not in product_bundle_parents:
This file has been truncated. show original
4 Likes