Merge pull request #16058 from KanchanChauhan/reflinks-in-related-docs
Added href links for nextdoc on cancelling the Sales order, makes it easier to navigate
This commit is contained in:
commit
0090b1aa16
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
import json
|
||||
import frappe.utils
|
||||
from frappe.utils import cstr, flt, getdate, comma_and, cint, nowdate, add_days
|
||||
from frappe.utils import cstr, flt, getdate, cint, nowdate, add_days, get_link_to_form
|
||||
from frappe import _
|
||||
from six import string_types
|
||||
from frappe.model.utils import get_fetch_values
|
||||
@ -221,8 +221,9 @@ class SalesOrder(SellingController):
|
||||
where t1.name = t2.parent and t2.against_sales_order = %s and t1.docstatus = 1""", self.name)
|
||||
|
||||
if submit_dn:
|
||||
submit_dn = [get_link_to_form("Delivery Note", dn) for dn in submit_dn]
|
||||
frappe.throw(_("Delivery Notes {0} must be cancelled before cancelling this Sales Order")
|
||||
.format(comma_and(submit_dn)))
|
||||
.format(", ".join(submit_dn)))
|
||||
|
||||
# Checks Sales Invoice
|
||||
submit_rv = frappe.db.sql_list("""select t1.name
|
||||
@ -231,8 +232,9 @@ class SalesOrder(SellingController):
|
||||
self.name)
|
||||
|
||||
if submit_rv:
|
||||
submit_rv = [get_link_to_form("Sales Invoice", si) for si in submit_rv]
|
||||
frappe.throw(_("Sales Invoice {0} must be cancelled before cancelling this Sales Order")
|
||||
.format(comma_and(submit_rv)))
|
||||
.format(", ".join(submit_rv)))
|
||||
|
||||
#check maintenance schedule
|
||||
submit_ms = frappe.db.sql_list("""
|
||||
@ -241,8 +243,9 @@ class SalesOrder(SellingController):
|
||||
where t2.parent=t1.name and t2.sales_order = %s and t1.docstatus = 1""", self.name)
|
||||
|
||||
if submit_ms:
|
||||
submit_ms = [get_link_to_form("Maintenance Schedule", ms) for ms in submit_ms]
|
||||
frappe.throw(_("Maintenance Schedule {0} must be cancelled before cancelling this Sales Order")
|
||||
.format(comma_and(submit_ms)))
|
||||
.format(", ".join(submit_ms)))
|
||||
|
||||
# check maintenance visit
|
||||
submit_mv = frappe.db.sql_list("""
|
||||
@ -251,8 +254,9 @@ class SalesOrder(SellingController):
|
||||
where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1""",self.name)
|
||||
|
||||
if submit_mv:
|
||||
submit_mv = [get_link_to_form("Maintenance Visit", mv) for mv in submit_mv]
|
||||
frappe.throw(_("Maintenance Visit {0} must be cancelled before cancelling this Sales Order")
|
||||
.format(comma_and(submit_mv)))
|
||||
.format(", ".join(submit_mv)))
|
||||
|
||||
# check work order
|
||||
pro_order = frappe.db.sql_list("""
|
||||
@ -261,8 +265,9 @@ class SalesOrder(SellingController):
|
||||
where sales_order = %s and docstatus = 1""", self.name)
|
||||
|
||||
if pro_order:
|
||||
pro_order = [get_link_to_form("Work Order", po) for po in pro_order]
|
||||
frappe.throw(_("Work Order {0} must be cancelled before cancelling this Sales Order")
|
||||
.format(comma_and(pro_order)))
|
||||
.format(", ".join(pro_order)))
|
||||
|
||||
def check_modified_date(self):
|
||||
mod_db = frappe.db.get_value("Sales Order", self.name, "modified")
|
||||
|
Loading…
x
Reference in New Issue
Block a user