Creating custom script in frappe cloud

Hello everyone
How can i access files for the site and apps hosted on frappe cloud. I want to write a custom script outside the site because the server script in erpnext is limited to certain modules.

Hi @Ernest_Ben,

You can write the client script in the client script doctype.

If you want to develop the larger level client script and server script then first you have a make a custom app and then deploy the custom app on then Frappe Cloud Server and then install the app on the site.

I hope this helps.

Thank You!

I want to write a complex custom script in python that links 2 systems for E-invoicing.
i cant use server scripts because they don’t support certain modules yet my script has modules like base64encode,qrcode etc.

Hi @Ernest_Ben,

If you need to write a complex custom script in Python that links two systems for E-invoicing and requires modules like base64encode and qrcode which are not supported by server scripts, you have a couple of options:

  1. Custom App Development: You can create a custom app as mentioned earlier, but instead of relying solely on server scripts, you can develop your Python script within this custom app. This allows you to utilize any Python modules or libraries you require, including base64encode and qrcode. Once your custom app is developed, you can deploy it on the Frappe Cloud Server and install it on your site.

  2. External Script Integration: Alternatively, if you prefer to keep your script outside of erpnext, you can develop it as a standalone Python script or application. This script can interact with erpnext using its REST API or other integration methods. This approach allows you to leverage any Python modules or libraries you need without limitations imposed by server scripts.

I hope this helps.

Thank You!

Thank you,
recently i was working locally using a local server on my machine so i created a script file called events.py under sales-invoice doctype and hooked into the on_submit sales invoice doctype found in the hooks.py file and everything was perfect. but here in frappe cloud i could’nt access the files and folders(frappe-bench) like how i did on my local serever. so am stuck

Hi @Ernest_Ben,

If you’re unable to directly access files and folders like you did on your local server while working with Frappe Cloud, you have a few alternatives. First, you can develop your customizations, including scripts and hooks, within a custom app using the Frappe framework. This app can then be deployed to Frappe Cloud. Alternatively, for more complex server-side scripting needs, you can develop scripts externally and execute them remotely, interacting with your instance through APIs. Lastly, you can leverage Custom Scripts to add custom logic directly within the interface, without needing access to the file system.

I hope this helps.

Thank You!

thanks.
sorry to disturb but i have an inquiry, can i develop my customizations including scripts and hooks within a custom app using frappe framework and then deploy these customizations to frappe cloud.
I thought all sites hosted on frappe cloud should by must be created on frappe cloud but not got elsewhere.

If your site is hosted locally, it’s easy to manage and install apps directly. But if it’s hosted on Frappe Cloud, and you’ve developed a custom app, you need to install/deploy it on the cloud first. Any changes you make to the base app will work, but when you upgrade the version, those changes might get removed, so be cautious. I recommend everyone to add any new features or override base functionality in a custom app for easier management.

Thanks alot,
could you be knowing how to generate a qrcode so that its displayed in the print format

Check the post.

Another reference:

I hope this helps.

Thank You!

the resource is kinda complicated.
I have already the string for the qrcode, i just want it to be displayed in print format.

“qrCode”:“0200000011827C32312714057200000186A00000003B96B47720524158A10215259030~TGS OSILLO CONSULTING LIMITED~OTHIENO BENEDICT AND SONS~TESTS PRESENTATION”


I get this error when i try to generate the Qrcode dynamically from content in my doc.qrcode

{% set qrCode = “0200000011827C32312714057200000186A00000003B96B47720524158A10215259030~TGS OSILLO CONSULTING LIMITED~OTHIENO BENEDICT AND SONS~TESTS PRESENTATION” %}

<img src="https://api.qrserver.com/v1/create-qr-code/?data={{qrCode}}&amp;size=80x80&amp;color=00545c&amp;bgcolor=ffffff" alt="{{doc.name}}" title="{{doc.name}}" style="width: 80px; height: 80px;" />

Edit: for a QR code with that much data you might need atleast 100x100px.