Merge pull request #7385 from bhupennewalkar1337/quot
Fix#6590 Now you can make quotation from supplier quotation
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index 0323c2f..fc9cc3b 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -11,6 +11,9 @@
cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order,
__("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
+ cur_frm.add_custom_button(__("Quotation"), this.make_quotation,
+ __("Make"));
+
}
else if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Material Request'),
@@ -35,6 +38,13 @@
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
frm: cur_frm
})
+ },
+ make_quotation: function() {
+ frappe.model.open_mapped_doc({
+ method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_quotation",
+ frm: cur_frm
+ })
+
}
});
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index 144e982..30899c8 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -97,8 +97,26 @@
},
"Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",
- "add_if_empty": True
},
}, target_doc, set_missing_values)
return doclist
+
+@frappe.whitelist()
+def make_quotation(source_name, target_doc=None):
+ doclist = get_mapped_doc("Supplier Quotation", source_name, {
+ "Supplier Quotation": {
+ "doctype": "Quotation",
+ "field_map": {
+ "name": "supplier_quotation",
+ }
+ },
+ "Supplier Quotation Item": {
+ "doctype": "Quotation Item",
+ "condition": lambda doc: frappe.db.get_value("Item", doc.item_code, "is_sales_item")==1,
+ "add_if_empty": True
+ }
+ }, target_doc)
+
+ return doclist
+
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
index 80f946e..df69063 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
@@ -11,11 +11,12 @@
'transactions': [
{
'label': _('Related'),
- 'items': ['Purchase Order']
+ 'items': ['Purchase Order', 'Quotation']
},
{
'label': _('Reference'),
'items': ['Material Request', 'Request for Quotation', 'Project']
},
]
+
}
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 4fc536e..a543ecd 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -2336,6 +2336,35 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "supplier_quotation",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Supplier Quotation",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Supplier Quotation",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"hide_heading": 0,
@@ -2350,7 +2379,7 @@
"istable": 0,
"max_attachments": 1,
"menu_index": 0,
- "modified": "2016-11-07 05:58:07.587479",
+ "modified": "2017-01-04 06:28:07.269867",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
@@ -2537,5 +2566,6 @@
"sort_order": "DESC",
"timeline_field": "customer",
"title_field": "title",
+ "track_changes": 0,
"track_seen": 0
}
\ No newline at end of file