def on_cancel(self):
        super(SalesOrder, self).on_cancel()

        # Cannot cancel closed SO
        if self.status == 'Closed':
            frappe.throw(
                _("Closed order cannot be cancelled. Unclose to cancel."))

        self.check_nextdoc_docstatus()
        self.update_reserved_qty()
        self.update_project()
        self.update_prevdoc_status('cancel')

        frappe.db.set(self, 'status', 'Cancelled')

        self.update_blanket_order()

        unlink_inter_company_doc(self.doctype, self.name,
                                 self.inter_company_order_reference)
        if self.coupon_code:
            from erpnext.accounts.doctype.pricing_rule.utils import update_coupon_code_count
            update_coupon_code_count(self.coupon_code, 'cancelled')
Beispiel #2
0
	def on_cancel(self):
		self.ignore_linked_doctypes = ("GL Entry", "Stock Ledger Entry")
		super(SalesOrder, self).on_cancel()

		# Cannot cancel closed SO
		if self.status == "Closed":
			frappe.throw(_("Closed order cannot be cancelled. Unclose to cancel."))

		self.check_nextdoc_docstatus()
		self.update_reserved_qty()
		self.update_project()
		self.update_prevdoc_status("cancel")

		frappe.db.set(self, "status", "Cancelled")

		self.update_blanket_order()

		unlink_inter_company_doc(self.doctype, self.name, self.inter_company_order_reference)
		if self.coupon_code:
			from erpnext.accounts.doctype.pricing_rule.utils import update_coupon_code_count

			update_coupon_code_count(self.coupon_code, "cancelled")