you can make quotation from supplier quotation

This commit is contained in:
bhupen
2017-01-04 17:01:16 +05:30
parent d08c248642
commit 107099aac9
4 changed files with 65 additions and 3 deletions

View File

@@ -11,6 +11,9 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order,
__("Make")); __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("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) { else if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Material Request'), cur_frm.add_custom_button(__('Material Request'),
@@ -35,6 +38,13 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order", method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
frm: cur_frm frm: cur_frm
}) })
},
make_quotation: function() {
frappe.model.open_mapped_doc({
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_quotation",
frm: cur_frm
})
} }
}); });

View File

@@ -97,8 +97,29 @@ def make_purchase_order(source_name, target_doc=None):
}, },
"Purchase Taxes and Charges": { "Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"add_if_empty": True
}, },
}, target_doc, set_missing_values) }, target_doc, set_missing_values)
return doclist return doclist
@frappe.whitelist()
def make_quotation(source_name, target_doc=None):
def set_missing_values(source, target):
quotation = frappe.get_doc(target)
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, set_missing_values)
return doclist

View File

@@ -11,11 +11,12 @@ def get_data():
'transactions': [ 'transactions': [
{ {
'label': _('Related'), 'label': _('Related'),
'items': ['Purchase Order'] 'items': ['Purchase Order', 'Quotation']
}, },
{ {
'label': _('Reference'), 'label': _('Reference'),
'items': ['Material Request', 'Request for Quotation', 'Project'] 'items': ['Material Request', 'Request for Quotation', 'Project']
}, },
] ]
} }

View File

@@ -2336,6 +2336,35 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 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, "hide_heading": 0,
@@ -2350,7 +2379,7 @@
"istable": 0, "istable": 0,
"max_attachments": 1, "max_attachments": 1,
"menu_index": 0, "menu_index": 0,
"modified": "2016-11-07 05:58:07.587479", "modified": "2017-01-04 06:28:07.269867",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Quotation", "name": "Quotation",
@@ -2537,5 +2566,6 @@
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "customer", "timeline_field": "customer",
"title_field": "title", "title_field": "title",
"track_changes": 0,
"track_seen": 0 "track_seen": 0
} }