Added a job creation method from Sales Invoice
This commit is contained in:
parent
48431db7ee
commit
b8fea2c9ca
1 changed files with 21 additions and 0 deletions
|
|
@ -5,6 +5,27 @@ from custom_ui.db_utils import process_query_conditions, build_datatable_dict, g
|
||||||
# JOB MANAGEMENT API METHODS
|
# JOB MANAGEMENT API METHODS
|
||||||
# ===============================================================================
|
# ===============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def create_job_from_sales_order(sales_order_name):
|
||||||
|
"""Create a Job (Project) from a given Sales Order"""
|
||||||
|
try:
|
||||||
|
sales_order = frappe.get_doc("Sales Order", sales_order_name)
|
||||||
|
project_template = frappe.get_doc("Project Template", "SNW Install")
|
||||||
|
new_job = frappe.get_doc({
|
||||||
|
"doctype": "Project",
|
||||||
|
"custom_installation_address": sales_order.custom_installation_address,
|
||||||
|
"project_name": sales_order.custom_installation_address,
|
||||||
|
"project_template": project_template,
|
||||||
|
"custom_warranty_duration_days": 90,
|
||||||
|
"sales_order": sales_order
|
||||||
|
})
|
||||||
|
new_job.insert()
|
||||||
|
return build_success_response(new_job.as_dict())
|
||||||
|
except Exception as e:
|
||||||
|
return build_error_response(str(e), 500)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_job(job_id=""):
|
def get_job(job_id=""):
|
||||||
"""Get particular Job from DB"""
|
"""Get particular Job from DB"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue