feat: Supplier Quotation UX fixes

This commit is contained in:
marination 2020-10-01 16:35:09 +05:30
parent db8764a520
commit 4993ef19d6
4 changed files with 75 additions and 36 deletions

View File

@ -179,7 +179,7 @@ frappe.ui.form.on("Request for Quotation",{
dialog.hide(); dialog.hide();
return frappe.call({ return frappe.call({
type: "GET", type: "GET",
method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.make_supplier_quotation", method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.make_supplier_quotation_from_rfq",
args: { args: {
"source_name": doc.name, "source_name": doc.name,
"for_supplier": args.supplier "for_supplier": args.supplier

View File

@ -214,14 +214,14 @@ def get_supplier_contacts(doctype, txt, searchfield, start, page_len, filters):
and `tabDynamic Link`.link_name like %(txt)s) and `tabContact`.name = `tabDynamic Link`.parent and `tabDynamic Link`.link_name like %(txt)s) and `tabContact`.name = `tabDynamic Link`.parent
limit %(start)s, %(page_len)s""", {"start": start, "page_len":page_len, "txt": "%%%s%%" % txt, "name": filters.get('supplier')}) limit %(start)s, %(page_len)s""", {"start": start, "page_len":page_len, "txt": "%%%s%%" % txt, "name": filters.get('supplier')})
# This method is used to make supplier quotation from material request form.
@frappe.whitelist() @frappe.whitelist()
def make_supplier_quotation(source_name, for_supplier, target_doc=None): def make_supplier_quotation_from_rfq(source_name, target_doc=None, for_supplier=None):
def postprocess(source, target_doc): def postprocess(source, target_doc):
target_doc.supplier = for_supplier if for_supplier:
args = get_party_details(for_supplier, party_type="Supplier", ignore_permissions=True) target_doc.supplier = for_supplier
target_doc.currency = args.currency or get_party_account_currency('Supplier', for_supplier, source.company) args = get_party_details(for_supplier, party_type="Supplier", ignore_permissions=True)
target_doc.buying_price_list = args.buying_price_list or frappe.db.get_value('Buying Settings', None, 'buying_price_list') target_doc.currency = args.currency or get_party_account_currency('Supplier', for_supplier, source.company)
target_doc.buying_price_list = args.buying_price_list or frappe.db.get_value('Buying Settings', None, 'buying_price_list')
set_missing_values(source, target_doc) set_missing_values(source, target_doc)
doclist = get_mapped_doc("Request for Quotation", source_name, { doclist = get_mapped_doc("Request for Quotation", source_name, {

View File

@ -8,8 +8,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
setup: function() { setup: function() {
this.frm.custom_make_buttons = { this.frm.custom_make_buttons = {
'Purchase Order': 'Purchase Order', 'Purchase Order': 'Purchase Order',
'Quotation': 'Quotation', 'Quotation': 'Quotation'
'Subscription': 'Subscription'
} }
this._super(); this._super();
@ -28,12 +27,6 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
cur_frm.page.set_inner_btn_group_as_primary(__('Create')); cur_frm.page.set_inner_btn_group_as_primary(__('Create'));
cur_frm.add_custom_button(__("Quotation"), this.make_quotation, cur_frm.add_custom_button(__("Quotation"), this.make_quotation,
__('Create')); __('Create'));
if(!this.frm.doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(me.frm.doc.doctype, me.frm.doc.name)
}, __('Create'))
}
} }
else if (this.frm.doc.docstatus===0) { else if (this.frm.doc.docstatus===0) {
@ -54,6 +47,25 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
} }
}) })
}, __("Get items from")); }, __("Get items from"));
this.frm.add_custom_button(__("Request for Quotation"),
function() {
if (!me.frm.doc.supplier) {
frappe.throw({message:__("Please select a Supplier"), title:__("Mandatory")})
}
erpnext.utils.map_current_doc({
method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.make_supplier_quotation_from_rfq",
source_doctype: "Request for Quotation",
target: me.frm,
setters: {
company: me.frm.doc.company,
transaction_date: null
},
get_query_filters: {
docstatus: 1,
}
})
}, __("Get items from"));
} }
}, },

View File

@ -12,6 +12,8 @@
"item_name", "item_name",
"column_break_3", "column_break_3",
"lead_time_days", "lead_time_days",
"expected_delivery_date",
"is_free_item",
"section_break_5", "section_break_5",
"description", "description",
"item_group", "item_group",
@ -19,20 +21,18 @@
"col_break1", "col_break1",
"image", "image",
"image_view", "image_view",
"manufacture_details",
"manufacturer",
"column_break_15",
"manufacturer_part_no",
"quantity_and_rate", "quantity_and_rate",
"qty", "qty",
"stock_uom", "stock_uom",
"price_list_rate",
"discount_percentage",
"discount_amount",
"col_break2", "col_break2",
"uom", "uom",
"conversion_factor", "conversion_factor",
"stock_qty", "stock_qty",
"sec_break_price_list",
"price_list_rate",
"discount_percentage",
"discount_amount",
"col_break_price_list",
"base_price_list_rate", "base_price_list_rate",
"sec_break1", "sec_break1",
"rate", "rate",
@ -42,7 +42,6 @@
"base_rate", "base_rate",
"base_amount", "base_amount",
"pricing_rules", "pricing_rules",
"is_free_item",
"section_break_24", "section_break_24",
"net_rate", "net_rate",
"net_amount", "net_amount",
@ -56,7 +55,6 @@
"weight_uom", "weight_uom",
"warehouse_and_reference", "warehouse_and_reference",
"warehouse", "warehouse",
"project",
"prevdoc_doctype", "prevdoc_doctype",
"material_request", "material_request",
"sales_order", "sales_order",
@ -65,13 +63,19 @@
"material_request_item", "material_request_item",
"request_for_quotation_item", "request_for_quotation_item",
"item_tax_rate", "item_tax_rate",
"manufacture_details",
"manufacturer",
"column_break_15",
"manufacturer_part_no",
"ad_sec_break",
"project",
"section_break_44", "section_break_44",
"page_break" "page_break"
], ],
"fields": [ "fields": [
{ {
"bold": 1, "bold": 1,
"columns": 4, "columns": 2,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
@ -107,7 +111,7 @@
{ {
"fieldname": "lead_time_days", "fieldname": "lead_time_days",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Lead Time in days" "label": "Supplier Lead Time (days)"
}, },
{ {
"collapsible": 1, "collapsible": 1,
@ -162,7 +166,6 @@
{ {
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1,
"label": "Stock UOM", "label": "Stock UOM",
"options": "UOM", "options": "UOM",
"print_hide": 1, "print_hide": 1,
@ -196,6 +199,7 @@
{ {
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1,
"label": "UOM", "label": "UOM",
"options": "UOM", "options": "UOM",
"print_hide": 1, "print_hide": 1,
@ -289,14 +293,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"default": "0",
"fieldname": "is_free_item",
"fieldtype": "Check",
"label": "Is Free Item",
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "section_break_24", "fieldname": "section_break_24",
"fieldtype": "Section Break" "fieldtype": "Section Break"
@ -528,12 +524,43 @@
{ {
"fieldname": "column_break_15", "fieldname": "column_break_15",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "sec_break_price_list",
"fieldtype": "Section Break"
},
{
"fieldname": "col_break_price_list",
"fieldtype": "Column Break"
},
{
"collapsible": 1,
"fieldname": "ad_sec_break",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"default": "0",
"depends_on": "is_free_item",
"fieldname": "is_free_item",
"fieldtype": "Check",
"label": "Is Free Item",
"print_hide": 1,
"read_only": 1
},
{
"allow_on_submit": 1,
"bold": 1,
"fieldname": "expected_delivery_date",
"fieldtype": "Date",
"label": "Expected Delivery Date"
} }
], ],
"idx": 1, "idx": 1,
"index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-04-07 18:35:51.175947", "modified": "2020-10-01 16:34:39.703033",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation Item", "name": "Supplier Quotation Item",