Thursday 21 October 2021

ERPNext13 installation in Ubuntu 20

 On a clean fresh server on “root” login make sure to add a user for the ERPNext install…

(Obviously replace [USER] with your username everywhere in this posting)

adduser frappe
usermod -aG sudo frappe

Then while still logged in as root, update the system to the latest packages…

apt-get update
apt-get upgrade

Now, logout as the root user and login with the new user you just created. Perform the following steps:

export LC_ALL=C.UTF-8

sudo apt install git libffi-dev python3-minimal build-essential python3-distutils python3-setuptools python3-pip python3-testresources libssl-dev wkhtmltopdf redis

Nest we need to fix a potential problem in the redis config file:

sudo vi /etc/redis/redis.conf

When the editor is open, search for: bind 127.0.0.1 ::1 and edit our the 2 colons and the 1 so it looks like bind 127.0.0.1 then save the file.

wget https://raw.githubusercontent.com/frappe/bench/develop/install.py

sudo python3 install.py --verbose --production --user [USER] --mariadb-version 10.5 --frappe-branch version-13 --erpnext-branch version-13


Tuesday 19 October 2021

Sales Invoice Custom report

<table>
<tr>
<td style="width: 20%;">
&nbsp;<br>
</td>
<td style="width: 35%;">
<br><small>{{doc.branch_address}}</small>
</td>
<td style="width: 45%;">
GSTIN: {{ doc.gstin }}<br>
(Under Composition Scheme)<br>
<h2>Invoice: {{ doc.name }}<br><small>Date: {{ doc.get_formatted("posting_date") }}</small></h2>
</td>
</tr>
</table>
<hr>
<table style="width: 100%;">
<tr>
<td >
<strong>Customer Name: {{doc.customer_name}}</strong>
</td>
<td>
&nbsp;
</td>
</tr>
</table>
<table style="width: 100%;" border="1">
<tr>
<td width: 10%; text-align: left;"><strong>S.No.</strong></td>
<td width: 15%; text-align: left;"><strong>Item Code</strong></td>
<td width: 40%; text-align: center;"><strong>Item Name</strong></td>
<td width: 10%; text-align: center;"><strong>Quantity</strong></td>
<td width: 25%; text-align: center;"><strong>Amount</strong></td>
</tr>
{%- for row in doc.items -%}
<tr>
<td> {{ row.idx }}</td>
<td> {{ row.item_code }}</td>
<td class='alnleft';"> {{ row.item_name }}</td>
<td class='alnright';">{{ row.qty }}</td>
<td class='alnright';">{{row.get_formatted("amount", doc) }}</td>
</tr>
{%- endfor -%}
</table>
<table style="width: 100%;" border="0">
<tr>
<td style="width: 75%;" class='alnright';>
<strong>
Total Amount:<br>
Discount Amount:<br>
Net Total:
</strong>
</td>
<td style="width: 25%;" class='alnright';>
<strong>
{{ "₹ {:,.2f}".format(doc.total) }}<br>
{{ "₹ {:,.2f}".format(doc.discount_amount) }}<br>
{{ "₹ {:,.2f}".format(doc.grand_total) }}
</strong>
</td>
</tr>
</table>

Set current form field through client script

 frappe.ui.form.on("Journal Entry", {

            after_save: function(frm) {

            frm.doc.title = frm.doc.name;

            }

            });

Client Script Events

 

Event NameDescription
setupTriggered once when the form is created for the first time
before_loadTriggered before the form is about to load
onloadTriggered when the form is loaded and is about to render
refreshTriggered when the form is loaded and rendered.
onload_post_renderTriggered after the form is loaded and rendered
validateTriggered before before_save
before_saveTriggered before save is called
after_saveTriggered after form is saved
before_submitTriggered before submit is called
on_submitTriggered after form is submitted
before_cancelTriggered before cancel is called
after_cancelTriggered after form is cancelled
timeline_refreshTriggered after form timeline is rendered
{fieldname}_on_form_renderedTriggered when a row is opened as a form in a Table field
{fieldname}Triggered when the value of fieldname is changed