mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
Files added with all functions
This commit is contained in:
@@ -84,6 +84,14 @@ class Opportunity(TransactionBase):
|
||||
self.delete_events()
|
||||
|
||||
def has_active_quotation(self):
|
||||
if not self.with_items:
|
||||
return frappe.get_all('Quotation',
|
||||
{
|
||||
'opportunity': self.name,
|
||||
'status': ("not in", ['Lost', 'Closed']),
|
||||
'docstatus': 1
|
||||
}, 'name')
|
||||
else:
|
||||
return frappe.db.sql("""
|
||||
select q.name
|
||||
from `tabQuotation` q, `tabQuotation Item` qi
|
||||
@@ -185,27 +193,6 @@ def get_item_details(item_code):
|
||||
'brand': item and item[0]['brand'] or ''
|
||||
}
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_request_for_quotation(source_name, target_doc=None):
|
||||
doclist = get_mapped_doc("Opportunity", source_name, {
|
||||
"Opportunity": {
|
||||
"doctype": "Request for Quotation",
|
||||
"validation": {
|
||||
"enquiry_type": ["=", "Sales"]
|
||||
}
|
||||
},
|
||||
"Opportunity Item": {
|
||||
"doctype": "Request for Quotation Item",
|
||||
"field_map": [
|
||||
["name", "opportunity_item"],
|
||||
["parent", "opportunity"],
|
||||
["uom", "uom"]
|
||||
]
|
||||
}
|
||||
}, target_doc)
|
||||
|
||||
return doclist
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_quotation(source_name, target_doc=None):
|
||||
def set_missing_values(source, target):
|
||||
@@ -233,6 +220,8 @@ def make_quotation(source_name, target_doc=None):
|
||||
|
||||
quotation.run_method("set_missing_values")
|
||||
quotation.run_method("calculate_taxes_and_totals")
|
||||
if not source.with_items:
|
||||
quotation.opportunity = source.name
|
||||
|
||||
doclist = get_mapped_doc("Opportunity", source_name, {
|
||||
"Opportunity": {
|
||||
@@ -256,6 +245,27 @@ def make_quotation(source_name, target_doc=None):
|
||||
|
||||
return doclist
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_request_for_quotation(source_name, target_doc=None):
|
||||
doclist = get_mapped_doc("Opportunity", source_name, {
|
||||
"Opportunity": {
|
||||
"doctype": "Request for Quotation",
|
||||
"validation": {
|
||||
"enquiry_type": ["=", "Sales"]
|
||||
}
|
||||
},
|
||||
"Opportunity Item": {
|
||||
"doctype": "Request for Quotation Item",
|
||||
"field_map": [
|
||||
["name", "opportunity_item"],
|
||||
["parent", "opportunity"],
|
||||
["uom", "uom"]
|
||||
]
|
||||
}
|
||||
}, target_doc)
|
||||
|
||||
return doclist
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_supplier_quotation(source_name, target_doc=None):
|
||||
doclist = get_mapped_doc("Opportunity", source_name, {
|
||||
@@ -272,6 +282,7 @@ def make_supplier_quotation(source_name, target_doc=None):
|
||||
}
|
||||
}
|
||||
}, target_doc)
|
||||
|
||||
return doclist
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
Reference in New Issue
Block a user