Chapter Week1

download Chapter Week1

of 57

  • date post

  • Category


  • view

  • download


Embed Size (px)

Transcript of Chapter Week1

Openbravo ERP Advanced Development Chapter 2 Setupv2.50.17 2008-2010 Openbravo S.L. All rights reserved. The information in this document is confidential and may not be disseminated or disclosed to third parties (either in digital form or on paper) without the prior written consent of Openbravo S.L.

1. Introduction 2. Local Environment 3. The Community Appliance 1. Starting Up the Appliance 2. Accessing the Appliance 1. The Application Itself 2. Command Line 3. File System 1. Ubuntu 2. Windows + Bitvise Tunellier 4. The Database 3. Performing Various Tasks 4. Hotel Scenario Introduction 1. Entities 2. E/R Diagram 3. Window Functionality 4. Window Customizations 5. Additional Functionality

IntroductionBefore we start discussing advanced development artifacts of Openbravo ERP we need to set up a few elements as well as introduce the Hotel Management module that we will be developing.

Local EnvironmentIn case of a live classroom course: y The latest community release of Openbravo ERP must be used!

y If one does not arrive with Openbravo ERP pre-installed, we offer the use of the virtual appliance that can be downloaded from and is also located on the USB key provided. Install the VMWare Player ( ) that is supplied on the USB key. y Install pgAdmin III Postgres database administration tool found on the USB key or downloadable from . This tool will be used to access the database, browse its content and execute SQL queries. y In case of using Windows operating system and an appliance, install Bitvise Tunnelier so that you can browse and upload files to the appliance. Find it on or on the USB key provided. Linux OS comes with SSH support already built into the Nautilus file browser. y copy the file from the USB onto your local harddrive and expand it y open the expanded file using VMWare Player In case of an online training: y Use the "Open My Virtual Machine" button to open your private instance of the Openbravo ERP application hosted on Amazon El astic Cloud. The virtual machine contains the latest community release of Openbravo ERP and will be used to develop the assignments given within this course. After clicking the "Open My Virtual Machine" button, a new tab will open in the browser with a URL similar to Please save/bookmark this URL somewhere , you will need it later to connect to your instance of Openbravo ERP. y A local installation/virtual appliance should also be set up in order to be used for testing and doing the HOWTO exercises. The HOWTO exercises should not be run inside the virtual machine provided online. See the following article for more information on how to use a virtual appliance: n/Community_Appliance . y Install pgAdmin III Postgres database administration tool from . This tool will be used to access the database, browse its content and execute SQL queries. y In case of using Windows operating system, install Bitvise Tunnelier so that you can browse and download/upload files to the virtual machine. Find it on Linux OS comes with SSH support already built into the Nautilus file browser so no additional tools need to be installed. Note: Openbravo Professional Subscription appliance is not suitable for use in this course since the production nature of it does not fit the development purposes.

The Community ApplianceHere are a few tasks and tips that you will need to get around of using the community appliance.

Starting Up the ApplianceOnline course: 1. the online course already comes with a deployed virtual instance on Amazon Elastic Cloud so no configuration is necessary

2. simply press the Open My Virtual Machine button on the front page of the course Live course: 1. start the VMWare player and open the .vmdx file found in the expanded OpenbravoERP-2.50MPXX-x86.vmware folder using the VMware Player 2. find the Networking setting (Edit virtual machine settings) and set it to NAT. Note: Not using the NAT Networking Adapter might cause the instance to not have access to the Internet which is required later on to install modules. 3. start the appliance by pressing the Play button

Accessing the ApplianceThe Application ItselfTo access the Openbravo ERP application itself, point your browser to the URL indicated by the appliance after it boots, e.g. for local virtual instances or something like for online virtual instances. To log in, use the following credentials: y username: Openbravo y password: openbravo Note: Do not change the password of this user in case an Openbravo instructor needs to log in and troubleshoot your instance!

Command LineTo access the commandline of the appliance use ssh (linux) or one of the free ssh tools for Windows found on (preferrably Bitvise Tunnelier which you will need anyway to access the file system, see section below on how to use it). Use the following credentials: y URL: IP/URL indicated by the appliance (or the virtual machine's URL you bookmarked earlier), e.g. y username: openbravo y password: openbravo E.g. in Linux, the following command line is used to connect to the appliance: $ ssh In Windows, follow the Windows + Bitvise Tunnelier section below.

File SystemTo manage (create/upload/delete Openbravo ERP files) on the appliance, we recommend you use a graphical file manager that supports SSH. Ubuntu

Ubuntu (or any Linux using GNOME desktop) comes with a Nautilus file browser that has built in support for browsing file systems through SSH. Go to File > Connect to Server... and enter data similar to:

Then use "openbravo" (without the quotations) as a password to receive a simple file

manager interface:

Windows + Bitvise Tunellier After installing Bitvise Tunnelier, run it to receive the front screen where connection parameter can already be entered:

Before connection, check the Options tab and see the On Login section, Open Terminal and Open SFTP should be checked off.

Click Login and it will open the terminal (command line) window AND a file manager window.

The DatabaseThe community appliance comes with no firewall configured and the Postgres database listener wide open . To connect to the database using the PgAdmin GUI, open the application and create a new connection/server:

Note the following important fields: y Host - the actual IP/URL of the appliance y Maitenance DB - the name of the database, in case of the appliance this is openbravo y Username - in case of the appliance use tad y Password - in case of the appliance use tad

Performing Various TasksHere are some handy command lines when developing on top of an appliance: y move to the Openbravo ERP sources folder # cd /opt/OpenbravoERP y restart Tomcat # su # /etc/init.d/tomcat restart # exit y location of Openbravo context in Tomcat # /var/lib/tomcat/webapps/openbravo y location of Openbravo logs in Tomcat # /var/lib/tomcat/logs (see openbravo.log, openbravo_hibernate.log and catalina.out) y create a folder # mkdir {foldername} y list files with details # ls -al y set ownership of AppsOpenbravo and tomcat context back to their corresponding users (in case you accidentally compile the application in superuser (su) mode) # su # chown openbravo:openbravo /opt/OpenbravoERP/ -R

# chown tomcat:tomcat /var/lib/tomcat/webapps/openbravo/ -R # chmod 770 /opt/OpenbravoERP/ -R # chmod 770 /var/lib/tomcat/webapps/openbravo/ -R # exit y restart the network and re-obtain the IP (DO NOT PERFORM THIS ON THE ONLINE VIRTUAL MACHINE! YOU MIGHT LOSE ACCESS TO THE APPLIANCE!) # su # /etc/init.d/network restart # exit y see what IP is assigned to the virtual machine # /sbin/ifconfig y shutdown the virtual machine (DO NOT PERFORM THIS ON THE ONLINE VIRTUAL MACHINE! YOU WILL LOSE ALL DATA! ) # su # halt

Hotel Scenario IntroductionTo make development exercises easier to understand and more realistic, the whole course revolves around development of a miniature Hotel Management module . As in a real life situation, the problem needs to be specified first, database structures defined and window functionality described. In the end, we want a clear deliverable in a form of a packaged module that can be distributed or installed at a client's site.

EntitiesThe following entities are new to existing Openbravo ERP functionality: y Guest that can tie to a Business Partner to whom an invoice can be issued o Custom Identifier such as a unique number for each guest o First name o Last name o Business Partner - link to an existing Business Partner to whom the invoice will be issued o Guest Rate - daily rate the guest is entitled to (fixed list of options: A, B or C) y Room o Number o ARate - rate for regular guests that have stayed for more than 10 nights within the last 6 months o BRate - rate for guests that have stayed for more than 5 nights within the last 6 months o CRate - default rate for a walk-in guest o Type - Single/Double/Suite o Smoking - Y/N y Stay - an overnight stay of a particular guest in a room o Date In - date of the check-in o Planned Nights - preplanned booking of a number of nights o Date Out - date of the check-out o Room Rate - the room rate used for a stay (A, B or C) o Final Sum - sum calculated upon checkout based on the number of nights stayed and the rate used

E/R Diagram

Window FunctionalityTo support the functionality indicated by the structur