fix: Quotation lost reason options fix (#22814)

* adding patch and lost reason child tables

* fix: conflict resolved
This commit is contained in:
Anupam Kumar 2020-08-13 09:20:36 +05:30 committed by GitHub
parent c7614174d0
commit e447c79f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 116 additions and 11 deletions

View File

@ -411,7 +411,7 @@
"fieldname": "lost_reasons", "fieldname": "lost_reasons",
"fieldtype": "Table MultiSelect", "fieldtype": "Table MultiSelect",
"label": "Lost Reasons", "label": "Lost Reasons",
"options": "Lost Reason Detail", "options": "Opportunity Lost Reason Detail",
"read_only": 1 "read_only": 1
}, },
{ {

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2020-07-16 16:11:39.830389",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"lost_reason"
],
"fields": [
{
"fieldname": "lost_reason",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Opportunity Lost Reason",
"options": "Opportunity Lost Reason"
}
],
"istable": 1,
"links": [],
"modified": "2020-07-26 17:58:26.313242",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity Lost Reason Detail",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class OpportunityLostReasonDetail(Document):
pass

View File

@ -720,3 +720,4 @@ erpnext.patches.v13_0.move_branch_code_to_bank_account
erpnext.patches.v13_0.healthcare_lab_module_rename_doctypes erpnext.patches.v13_0.healthcare_lab_module_rename_doctypes
erpnext.patches.v13_0.stock_entry_enhancements erpnext.patches.v13_0.stock_entry_enhancements
erpnext.patches.v12_0.update_state_code_for_daman_and_diu erpnext.patches.v12_0.update_state_code_for_daman_and_diu
erpnext.patches.v12_0.rename_lost_reason_detail

View File

@ -0,0 +1,17 @@
from __future__ import unicode_literals
import frappe
def execute():
if frappe.db.exists("DocType", "Lost Reason Detail"):
frappe.reload_doc("crm", "doctype", "opportunity_lost_reason_detail")
frappe.reload_doc("setup", "doctype", "quotation_lost_reason_detail")
frappe.db.sql("""INSERT INTO `tabOpportunity Lost Reason Detail` SELECT * FROM `tabLost Reason Detail` WHERE `parenttype` = 'Opportunity'""")
frappe.db.sql("""INSERT INTO `tabQuotation Lost Reason Detail` SELECT * FROM `tabLost Reason Detail` WHERE `parenttype` = 'Quotation'""")
frappe.db.sql("""INSERT INTO `tabQuotation Lost Reason` (`name`, `creation`, `modified`, `modified_by`, `owner`, `docstatus`, `parent`, `parentfield`, `parenttype`, `idx`, `_comments`, `_assign`, `_user_tags`, `_liked_by`, `order_lost_reason`)
SELECT o.`name`, o.`creation`, o.`modified`, o.`modified_by`, o.`owner`, o.`docstatus`, o.`parent`, o.`parentfield`, o.`parenttype`, o.`idx`, o.`_comments`, o.`_assign`, o.`_user_tags`, o.`_liked_by`, o.`lost_reason`
FROM `tabOpportunity Lost Reason` o LEFT JOIN `tabQuotation Lost Reason` q ON q.name = o.name WHERE q.name IS NULL""")
frappe.delete_doc("DocType", "Lost Reason Detail")

View File

@ -923,7 +923,7 @@
"fieldname": "lost_reasons", "fieldname": "lost_reasons",
"fieldtype": "Table MultiSelect", "fieldtype": "Table MultiSelect",
"label": "Lost Reasons", "label": "Lost Reasons",
"options": "Lost Reason Detail", "options": "Quotation Lost Reason Detail",
"read_only": 1 "read_only": 1
} }
], ],
@ -932,7 +932,7 @@
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"max_attachments": 1, "max_attachments": 1,
"modified": "2020-07-18 04:59:09.960118", "modified": "2020-07-26 17:46:19.951223",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Quotation", "name": "Quotation",

View File

@ -68,7 +68,7 @@ class Quotation(SellingController):
def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None): def declare_enquiry_lost(self, lost_reasons_list, detailed_reason=None):
if not self.has_sales_order(): if not self.has_sales_order():
get_lost_reasons = frappe.get_list('Opportunity Lost Reason', get_lost_reasons = frappe.get_list('Quotation Lost Reason',
fields = ["name"]) fields = ["name"])
lost_reasons_lst = [reason.get('name') for reason in get_lost_reasons] lost_reasons_lst = [reason.get('name') for reason in get_lost_reasons]
frappe.db.set(self, 'status', 'Lost') frappe.db.set(self, 'status', 'Lost')

View File

@ -494,13 +494,18 @@ frappe.ui.form.on(cur_frm.doctype, {
var dialog = new frappe.ui.Dialog({ var dialog = new frappe.ui.Dialog({
title: __("Set as Lost"), title: __("Set as Lost"),
fields: [ fields: [
{"fieldtype": "Table MultiSelect", {
"label": __("Lost Reasons"), "fieldtype": "Table MultiSelect",
"fieldname": "lost_reason", "label": __("Lost Reasons"),
"options": "Lost Reason Detail", "fieldname": "lost_reason",
"reqd": 1}, "options": frm.doctype === 'Opportunity' ? 'Opportunity Lost Reason Detail': 'Quotation Lost Reason Detail',
"reqd": 1
{"fieldtype": "Text", "label": __("Detailed Reason"), "fieldname": "detailed_reason"}, },
{
"fieldtype": "Text",
"label": __("Detailed Reason"),
"fieldname": "detailed_reason"
},
], ],
primary_action: function() { primary_action: function() {
var values = dialog.get_values(); var values = dialog.get_values();

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2020-07-14 09:21:44.057724",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"lost_reason"
],
"fields": [
{
"fieldname": "lost_reason",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Quotation Lost Reason",
"options": "Quotation Lost Reason"
}
],
"istable": 1,
"links": [],
"modified": "2020-07-26 17:58:56.373775",
"modified_by": "Administrator",
"module": "Setup",
"name": "Quotation Lost Reason Detail",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class QuotationLostReasonDetail(Document):
pass