Sunday, 13 February 2022

Upgrade ERPNext from V12 to V13

 # update

cd ~/frappe-bench bench update # update to major release ex. v12 --> v13 # nodejs >= 10 required cd ~ curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install nodejs nodejs -v # now upgrade cd ~/frappe-bench bench switch-to-branch version-13-beta frappe erpnext --upgrade bench update --patch bench migrate bench update --build

bench retry-upgrade
bench --site yoursitename migrate

Thursday, 11 November 2021

Increase Swap size of server

 

  1. First disable the swap and delete it

     sudo swapoff /swapfile  
     sudo rm  /swapfile
    
  2. Create new swap space of size 16 GB (16 * 1024 = 16384). bs is the block size. Basically bs * count = bytes to be allocated (in this case 16 GB). Here bs = 1M (M stands for mega, so we are assigning 1MB block size) and we are allocating 16384 * 1MB (=16GB) to swap.

     sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
    
  3. Give it the read/write permission for root

     sudo chmod 600 /swapfile
    
  4. Format it to swap

     sudo mkswap /swapfile
    
  5. Turn on swap again

     sudo swapon /swapfile
    
  6. Now reboot the PC for the above changes to take place.

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