Unicenta oPos to iDempiere

From iDempiere en
Jump to navigation Jump to search


Credits

  • iDempiere
  • OpenBravo
  • Unicenta
  • Ghintech

Background

Our goal was to integrate Unicenta oPos to iDempiere using Web Services in a minimalistic way. That led me to Plugin:_Unicenta_POS which was done by Ghintech with contributions from Red1. We eventually managed to get it up and running but realised that there were functionality that we were not interested in. We downloaded the latest Unicenta code: 4.6.2 (at this time) and rewrote the web service requests to iDempiere. Unicenta seemed to have paused on maintaining their PostgreSQL compatibility so we followed their lead and used a MySql database as well.

Functionality

The basic premise is to have a one way update of information from Unicenta (POS) to iDempiere (ERP)

  • After a sales order/s is complete on the POS then it will be transmitted to the ERP. If any of it's multiple steps fail then it will be rolled back
  • We use the Mixed POS Payment functionality in iDempiere (Contributed by GlobalQSS) to generate a payment
  • Once the Sales Order (SO) is successfully synchronised to the ERP. The associated invoice, payment, shipment and allocation are generated and completed
  • The assumption is that the ERP will be the 'Master' for the the products. If a line has a product that is not recognised by the ERP then 'Standard' will be used We feel that stock management is better off done on the ERP
  • If a Business Partner (BP) is used for the POS sale and it does not exist in the ERP, then a BP will be created using the POS address and contact details. Dummy records will be used if this info is not available

Download Source Code/Application

Development Environment Setup

The following will show the setup on Ubuntu 20.04. You can skip this step if you just want to run the POS binary

  • NetBeans 8.1 needs to be installed. Download from NetBeans 8.1
  • Make the installer executable: chmod +x netbeans-8.1-javase-linux.sh and then run it
  • Install JDK 8. I got it from JDK 8 Download
  • Found this How to install JDK 8 on Linux handy
  • Ensure this JDK 8 is set up on NetBeans(NB)
  • Install Maven if you don't have it:
 sudo apt install maven
  • Then in NB, go to Tools/options/java/maven and choose maven home to be your installed version...typically residing in /usr/share/maven
  • In NB, go to 'Open Project' and go to the downloaded directory e.g. ~/UC462-iDempiere-master where the pom.xml is
  • Maven will try to resolve dependencies
  • Resolve the idempierewsc.jar dependency locally. Use the jar in the target/lib directory
  • There seem to be an error in file: PaymentGatewayFac.java, but it does not seem to affect a successful build

MySql Setup

  • The POS only works with version 5.*
  • Download the installer for Ubuntu from mysql download. Click on 'install from apt' button
  • On Ubuntu 18, the following installed the correct version of mysql:
 sudo apt update; sudo apt install -y mysql-server
  • Once the database is installed, do the following
 sudo mysql
 create database unicentaopos;
 grant all on unicentaopos.* to 'unicentaopos'@'localhost' identified by 'password';
  • The above steps would have created a database: unicentaopos, user: unicentaopos and password: password

iDempiere Changes

  • Pack in the web services definitions from UC Web Service Type.zip. This file is located in UC462-iDempiere/src/main/resources/com/ntier/pos/templates
  • Ensure there are at least 3 taxes v.i.z. Standard, Exempt, Zero. The names of the taxes must be exact to match those created in the POS. Ensure the correct rates are captured for each of the tax rates
  • Create pos tender types exactly as follows:
 Search Key|1000000, Name|Credit Card, Tender type|Credit Card
 Search Key|1000001, Name|Cash, Tender type|Cash
 Search Key|1000002, Name|EFT, Tender type|Direct Deposit
 Search Key|1000003, Name|OnCredit, Tender type|Account
  • Set sale prices for 'Standard' Product
  • In System Configurator, set:
 PAYMENT_OVERWRITE_DOCUMENTNO_WITH_CREDIT_CARD to 'N'
 CLIENT_ACCOUNTING to M

Unicenta oPOS Changes

  • The information required is contained in a file: erp.properties.xml. You would need to amend it to suit your requirements. This file is located in UC462-iDempiere/src/main/resources/com/ntier/pos/templates
Erp-properties.png













  • Unfortunately this file is loaded, when the MySql database is created the first time. We will be looking at changing this, in the future,

to load every time the POS is reloaded

  • I use sql to re-load a changed file as follows:
 ...Notice, I am doing this on the MySql command line
 sudo mysql
 DELETE FROM resources where id = '102';
 INSERT INTO resources(id, name, restype, content) VALUES('102', 'erp.properties', 0, LOAD_FILE('/var/lib/mysql-files/erp.properties.xml'))
 ...there is something about 'secure_file_priv' setting in MySql that I did not get right, so I put the file in /var/lib/mysql-files to load it
  • To enable integration to the ERP, set:
 AllowSync=Y in unicentaopos.properties
  • unicentaopos.properties is typically in your home directory

Run Unicenta oPOS

  • ~/UC462-iDempiere-master/target$ sh start.sh
  • or run it from NetBeans



If you want to provide additional comments, please use the Discussion page.

See Also