try get document with python

This commit is contained in:
Luiz Costa 2024-06-03 12:28:44 +01:00
parent 894335f2c5
commit 88fbad4fcd
2 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,7 @@ function connect_remote(frm, type) {
frappe.call({ frappe.call({
method: "msp_remoteadmin.tools.create_session", method: "msp_remoteadmin.tools.create_session",
args: { args: {
doc: frm.doc, name: frm.doc.name,
protocol: type protocol: type
}, },
callback: function (r) { callback: function (r) {

View File

@ -11,7 +11,7 @@ PROTOCOL_PORT = {
} }
@frappe.whitelist() @frappe.whitelist()
def create_session(doc, protocol): def create_session(name, protocol):
guaca_config = frappe.get_single('Remote Connections Settings') guaca_config = frappe.get_single('Remote Connections Settings')
guacamole_url = f'{guaca_config.guacamole_server}/api/tokens' guacamole_url = f'{guaca_config.guacamole_server}/api/tokens'
auth = { auth = {
@ -30,6 +30,8 @@ def create_session(doc, protocol):
token = None token = None
if token: if token:
print(f"Token: {token}") print(f"Token: {token}")
# Get values from IT Object
doc = frappe.get_doc('IT Object', name)
# Get credentials from IT User Account # Get credentials from IT User Account
print(f"Values from form: {doc}") print(f"Values from form: {doc}")
print(f"Type: {type(doc.get('link'))}") print(f"Type: {type(doc.get('link'))}")