chore: convert sales common to utils

This commit is contained in:
Deepesh Garg
2023-07-23 12:07:21 +05:30
parent 4077254b01
commit 7205fb9b97
9 changed files with 455 additions and 452 deletions

View File

@@ -1,10 +1,13 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
{% include 'erpnext/selling/sales_common.js' %}
frappe.provide("erpnext.crm");
cur_frm.email_field = "contact_email";
erpnext.pre_sales.set_as_lost("Quotation");
erpnext.sales_common.setup_selling_controller();
frappe.ui.form.on("Opportunity", {
setup: function(frm) {
frm.custom_make_buttons = {
@@ -46,10 +49,6 @@ frappe.ui.form.on("Opportunity", {
}
},
onload_post_render: function(frm) {
frm.get_field("items").grid.set_multiple_add("item_code", "qty");
},
status:function(frm){
if (frm.doc.status == "Lost"){
frm.trigger('set_as_lost_dialog');
@@ -252,13 +251,13 @@ erpnext.crm.Opportunity = class Opportunity extends frappe.ui.form.Controller {
onload() {
if(!this.frm.doc.status) {
frm.set_value('status', 'Open');
this.frm.set_value('status', 'Open');
}
if(!this.frm.doc.company && frappe.defaults.get_user_default("Company")) {
frm.set_value('company', frappe.defaults.get_user_default("Company"));
this.frm.set_value('company', frappe.defaults.get_user_default("Company"));
}
if(!this.frm.doc.currency) {
frm.set_value('currency', frappe.defaults.get_user_default("Currency"));
this.frm.set_value('currency', frappe.defaults.get_user_default("Currency"));
}
this.setup_queries();