1
0
forked from test/crm

Merge branch 'frappe:develop' into splashscreen-size

This commit is contained in:
Safwan Erooth 2024-09-13 10:17:54 +04:00 committed by GitHub
commit 6771410dec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 58 additions and 12 deletions

View File

@ -8,7 +8,29 @@ frappe.ui.form.on("CRM Form Script", {
istable: 0,
},
});
if (frm.doc.is_standard && !frappe.boot.developer_mode) {
frm.disable_form();
frappe.show_alert(
__(
"Standard Form Scripts can not be modified, duplicate the Form Script instead."
)
);
}
frm.trigger("add_enable_button");
},
add_enable_button(frm) {
frm.add_custom_button(
frm.doc.enabled ? __("Disable") : __("Enable"),
() => {
frm.set_value("enabled", !frm.doc.enabled);
frm.save();
}
);
},
view(frm) {
let has_form_boilerplate = frm.doc.script.includes(
"function setupForm("

View File

@ -10,6 +10,7 @@
"view",
"column_break_gboh",
"enabled",
"is_standard",
"section_break_xeox",
"script"
],
@ -52,11 +53,18 @@
"label": "Apply To",
"options": "Form\nList",
"set_only_once": 1
},
{
"default": "0",
"fieldname": "is_standard",
"fieldtype": "Check",
"label": "Is Standard",
"no_copy": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-04-10 18:27:17.617602",
"modified": "2024-09-11 12:56:09.288849",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM Form Script",

View File

@ -2,11 +2,26 @@
# For license information, please see license.txt
import frappe
from frappe import _
from frappe.model.document import Document
class CRMFormScript(Document):
pass
def validate(self):
in_user_env = not (
frappe.flags.in_install
or frappe.flags.in_patch
or frappe.flags.in_test
or frappe.flags.in_fixtures
)
if in_user_env and self.is_standard and not frappe.conf.developer_mode:
# only enabled can be changed for standard form scripts
if self.has_value_changed("enabled"):
enabled_value = self.enabled
self.reload()
self.enabled = enabled_value
else:
frappe.throw(_("You need to be in developer mode to edit a Standard Form Script"))
def get_form_script(dt, view="Form"):
"""Returns the form script for the given doctype"""

View File

@ -1,5 +1,14 @@
import './index.css'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createDialog } from './utils/dialogs'
import { initSocket } from './socket'
import router from './router'
import translationPlugin from './translation'
import { posthogPlugin } from './telemetry'
import App from './App.vue'
import {
FrappeUI,
Button,
@ -14,14 +23,6 @@ import {
frappeRequest,
FeatherIcon,
} from 'frappe-ui'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createDialog } from './utils/dialogs'
import { initSocket } from './socket'
import router from './router'
import translationPlugin from './translation'
import { posthogPlugin } from './telemetry'
import App from './App.vue'
let globalComponents = {
Button,

View File

@ -431,7 +431,7 @@ function parseRows(rows) {
...(deal.deal_owner && getUser(deal.deal_owner)),
}
} else if (row == '_assign') {
let assignees = JSON.parse(deal._assign) || []
let assignees = JSON.parse(deal._assign || '[]')
if (!assignees.length && deal.deal_owner) {
assignees = [deal.deal_owner]
}

View File

@ -448,7 +448,7 @@ function parseRows(rows) {
...(lead.lead_owner && getUser(lead.lead_owner)),
}
} else if (row == '_assign') {
let assignees = JSON.parse(lead._assign) || []
let assignees = JSON.parse(lead._assign || '[]')
if (!assignees.length && lead.lead_owner) {
assignees = [lead.lead_owner]
}