Compiere Developer Documentation from an Idea of Marco LOMBARDO
Total Page:16
File Type:pdf, Size:1020Kb
Compiere Developer Documentation from an idea of Marco LOMBARDO Copyright c 2004 Marco LOMBARDO i Table of Contents 1 Name and License ............................ 1 2 Introduction.................................. 1 The word Compilo ........................................ 1 The initial idea............................................ 1 Conventions .............................................. 1 Version ................................................... 1 Note ..................................................... 1 3 First 10 historical topics ...................... 2 000, Howto add a PL/SQL procedure and execute it.......... 2 001, Using your java code and jars. For example using Jasper Reports............................................... 3 002, Compiere Application Dictionary. ...................... 5 003, Using Attribute Set. .................................. 5 Summary .......................................... 6 An example ........................................ 6 More examples ..................................... 6 004, Using Attribute Set from developers point of view. ...... 7 005, Trees ................................................ 7 006, Menus................................................ 9 Menu Bar.......................................... 9 007, Reporting Engine. ................................... 10 ProcessCtl.process()............................ 10 ReportCtl.start() ............................... 10 ReportEngine .................................... 11 Viewer ........................................... 11 008...................................................... 11 009...................................................... 11 4 Contributions ............................... 11 010, Application Dictionary (by Peter Shen)................ 11 The “Tables and Columns” Window. ............... 12 The “Windows, Tabs and Fields” Window. .......... 13 011, Compiere Source (by Redhuan D. Oon)....................... 14 Overview of Topics ....................................... 14 Open Questions .......................................... 14 Where did it come from?........................... 14 Is it truly Open? .................................. 14 What about been Open Knowledge? ................ 14 What about Market Forces?........................ 14 The Source .............................................. 15 The Source Layout ................................ 15 Cracking the source ............................... 15 Business Functionality ............................. 16 Development Work Cycle .......................... 16 Compiling from Source ................................... 17 Build Process ............................................ 17 SQL Debugging .......................................... 17 Researching from the Web ....................................... 18 Using the Forums ........................................ 18 How to Setup Eclipse for Compiere ........................ 18 Downloading Eclipse ..................................... 19 Setting up perspectives and views ......................... 19 ii Importing Compiere Source into Eclipse.................... 19 Setting up Debug and RUN modes ........................ 19 How to Modify a Callout ........................................ 19 Searching for the Callout ................................. 20 Defining the Callout ...................................... 20 Opening the Callout in Eclipse ............................ 20 Callout Design ........................................... 20 Getting and setting values ................................ 21 Accessing other tables’ values ............................. 22 How to Debug Compiere ......................................... 22 Identifying the problem ................................... 22 Setting the debug level ................................... 22 Reading the debug logs ................................... 22 Understanding the problem ............................... 23 Handling SQL codes ...................................... 23 Testing SQL statements ........................... 23 Tracing SQL Procedures ........................... 24 Integrating into Compiere .......................... 24 Handling Java codes ...................................... 24 GenerateModel.java .............................. 24 Finding out the root cause ................................ 24 Amending Codes ......................................... 25 Recompiling Compiere ........................................... 25 Avoiding change impact .................................. 25 Backing up and risks scenarios ............................ 25 Documenting your work .................................. 25 Deploying the CClient.jar ............................... 26 Deploying the CServer.jar ............................... 26 Common pitfalls ................................................ 26 Wrong understanding of business scenario .................. 26 Attempting risky changes ................................. 26 Poor Planning ........................................... 26 Poor documentation ...................................... 26 Checking out unstable version ............................. 27 Migration Process (by Redhuan D. Oon) .......................... 27 Backup your present instance ............................. 27 Post migration tests ...................................... 27 5 Contributors ................................ 28 6 GNU Free Documentation License ............ 28 ADDENDUM: How to use this License for your documents .. 32 7 Final Note .................................. 33 8 Concept Index .............................. 33 Chapter 3: First 10 historical topics 1 1 Name and License The name came from the word Compiere. In italian Compilo means do it and I compile, it depends on how you stress the word. Copyright c 2004 Marco LOMBARDO. Permission is granted to copy, distribute and/or mod- ify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being: In- troduction, First 10 historical topics, Final Note. With the Front-Cover Texts being: “Compilo, Compiere Developer Documentation”, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”. 2 Introduction The word Compilo The name came from the word Compiere. In italian Compilo means do it and I compile, it depends on how you stress the word. The initial idea There is an online italian GNU/Linux manual called manualinux, you can find it at http://www.manualinux.it/, that began the same way: as an howto beginning with a few points. Adding topic after topic it is now quite usefull. Some parts of this document might be highly condensed, I apologise for that. You can query me or add topics yourself. Or write a better version than mine. I reserve the first 10 points for myself but the section “Coming soon” is not an Invariant Section so everyone is free to add topics here. Conventions You can find Tabs references by the Window name and the Tab name. For example: “Sales Order.Order” is the Tab Order in the Sales Order Window. Contact: [email protected] Marco LOMBARDO, 2004-03-14, Lucca, Italy. Version Versions are numbered based on how many points the document contains. Version 1.0 will have 1000 points/topics. This is the 0.1.0 version. Note This is my first document under the GNU Free Documentation License. It’s dedicated to RMS. The Master. Chapter 3: First 10 historical topics 2 3 First 10 historical topics 000, Howto add a PL/SQL procedure and execute it. 1. Summary Let’s consider you have a new or an existing Window/Tab and you want to add a button that executes the procedure myproc if pressed. Obviously there is a GUI part, adding the button and a PL/SQL part, creating the right PL/SQL procedure. 2. GUI part Open the Report & Process Window and create a new Process. Decide: • The name, description and help. Name is not important but I usually choose something that I think will not conflict with Compiere in the future. Description and Help are displayed when the user uses the mouse button so they are relatively important. • “User can start process” can be unchecked. • In the Procedure Name field write myproc. • Obviously “Is Report” field should be unchecked. • Parameters: you have a Tab for setup Parameters. The only thing to keep in mind is that what you write in the Column Name field is used for the column ParameterName of AD PInstance Para were java code pass parameters to PL/SQL code, see the example below. After this, alter the table referenced by the Tab in which you want to add the button: alter table mytable add( NewButton char(1) ); Modify the Compiere AD, adding this Column to mytable (Table & Column Tab). For the newly created Column, set reference to Button and Process with the name of the Process you create above. In the Procedure Name write the name of the procedure you are going to create at point 3. Let this new Column show in one or more Tab (Window, Tab and Field window). 3. PL/SQL part. To explain how to write your own PL/SQL code, let’s study an existing Procedure: CREATE OR REPLACE PROCEDURE M_Product_BOM_Check ( PInstance_ID IN NUMBER ) Every procedure you create should looks this way, with an IN parameters of type Number. As you have a row for each defined Process in the AD Process you have a new row every time you call a Process in the AD PInstance table (Process Instance). You have to communicate to the java code that the procedure is running. For this reason