IDempiere Recipes

From iDempiere en


Solutions to common problems and requirements.

Please contribute here, to improve the coverage of documentation.

Translations

Refer: Localization

Setting up menus by using menu trees

Use menu trees to quickly setup access and structures (per role).

  • Login to system - tree maintenance.
  • Associate role with tree.

Organization column to show all organizations, regardless of security

...
I've created a new window, where I have a field that should be a list/table
 of all the Organizations available in the Client. Just like AD_Org_ID, but different, 
lets call it "AD_OrgForPrint_ID" for example.

The problem is that I would like that every user of the system could choose 
any Organization, but right now it is limited by the Organization(s) that the Role
 or the User has been assigned to. So I thought that I could make a callout to fill 
the list/table with all the Organizations available, but I haven't been able to. 
And I haven't found any other callout filling a list/table/tabledir field, so... could it be done?

...

[Google Groups Thread]

Common error messages, with meanings and/or solutions

ERROR: relation "tablename_Trl" does not exist

14:04:49.298===========> DB.executeUpdate: INSERT INTO tablename_Trl (AD_Language,.... [POSavetablename_19ff2eb4-f49b-416a-985f-4cd9858654ed] [107]
org.postgresql.util.PSQLException: ERROR: relation "tablename_Trl" does not exist
  • Certain columns in ad_column are ticked 'translated', and no translation table is available. Untick.

SEVERE: Error - WrongDataType: Escalated - IsEscalated - Class invalid: class java.lang.Boolean, Should be class java.lang.String: false

I am seeing one bug, like if you enable request processor then in the console you will see below error SEVERE: Error - WrongDataType: Escalated - IsEscalated - Class invalid: class java.lang.Boolean, Should be class java.lang.String: false Cause of the issue is, in the X_R_RequestAction, IsEscalated column is String instead of boolean

[[1]]

java.sql.SQLException: ORA-01407: cannot update ("AD_FIELD_TRL"."NAME") to NULL

  • Error occurs when copying window tabs, from the Window definition window.
  • Solution is to add missing translations for all active languages

java.lang.RuntimeException: Error initializing storage

  • The OSGI module database was corrupted (probably the server was unable to store it correctly)
  • Solution is to add osgi.clean=true to the configuration/config.ini file - see also [[2]]

Open different iDempiere sessions, same browser, different tabs

Create hosts entries pointing to server IP with different host names.

Allow or disallow users connecting to Postgres server

Edit pg_hba.conf

UI

Added button to window, but can't see it on the window

  • Check access to the process
  • On the table column, "toolbar button": check window/toolbar (button may only be visible in the gears list at the top)

GUI window editor

There is a GUI tab (window layout) editor available on the Window/Tab (click on the gears icon)

https://www.youtube.com/watch?v=3vOmZ0o09KY&index=13&list=PL2805F9B642C0C91C

Credit:

Thanks to nTier Software Services (Simbarashe Musabaike) for pointing it out!

Use a virtual column to display value from related table on window

Virtual Columns

  • Hint: don't use alias in select list

Credit:

nTier Software Services Simbarashe Musabaike

Start iDempiere automatically when linux machine starts

Google Groups Post

Development

Info windows

  • Receive error "No info columns" when opening info window: check that there is a window linked to the table

Plugin development

Service not starting in plugin: troubleshooting

NB: Below is work in progress and subject to improvement and correction

If your service (example, Model Factory) doesn't start

  • Make sure the plugin is ticked in the list of plugins in the run configuration
  • Carefully follow the steps given in the appropriate page under Category:Plug-In Development, or watch one of the videos available on You Tube.
  • If the plugin starts in development mode, but not in deployed mode:

"Before exporting a bundle jar file you have to be sure that your component definition xml in OSGI-INF file is exported into the jar file. Open the build.properties file and look whether all your definitions are checked in the "Binary Build" list." (from Jan Thielemann's writeup from evenos GmbH (www.evenos-consulting.de))

  • Increase the trace level through iDempiere Monitor or by editing idempiere.properties.
  • Check if anything can be seen in the log file.
  • You can check to see if your service is running in Felix Console, by clicking on the arrow next to the plugin.
  • Type (for example) services org.adempiere.base.IModelFactory (or services *IModelFactory*) in the OSGi console to see if service has started.
  • Check that your service is referenced and that the reference is correct (check for spelling mistakes and so on) in the plugin's MANIFEST.MF file.
  • Check that your "implementation class" and "provide interface" classes are correct in the service.xml (check for spelling mistakes and so on).
  • Check that your service has a public default constructor.
  • Duplicate component name causes service not to start.
  • Open the exported binary code (jar) under the plugins folder of the deployment and check:
    • That the xml files corresponding to the service are there.
    • That the .class file for the service is there.
      • Problem with invalid character in the build.properties file caused classes not to be exported into jar file.
  • After attempting to use your service make sure the relevant plugin has been started by typing ss pluginname in the OSGi console.
  • Make sure org.osgi.framework and org.osgi.service.event are imported (TO BE REVIEWED).
  • Check your exports and imports match (TO BE REVIEWED).
  • Check that the "Bundle-RequiredExecutionEnvironment" matches between all your plugins.
  • Try create new plugin and re-create services in question.
  • For regressions use use hg update and hg revert to return to specific revisions when service was starting.

Credit:

How to import existing plugins into workspace

  • Use file/import/existing projects

OSGi Services

It's important to note that OSGi services are shared between consumers, and are effectively singletons. Therefore instance variables are not inherently thread-safe.

Use a factory mechanism combined with the service mechanism if you wish to use instance variables in your services.


from Osgi spec:

• Service Scope - Indicates how service objects are obtained when requesting a service object. The following service scopes are defined: singleton, bundle, and prototype.

The default service scope is singleton.

• Service Factory - A facility to let the registering bundle customize the service object for each using bundle. When using a Service Factory, the service scope of the service is bundle.

• Prototype Service Factory - A facility to let the registering bundle customize the service object for each caller. When using a Prototype Service Factory, the service scope of the service is prototype.

iDempiere 3.1 Upgrade Notes

  • Don't forget to install buckminster maven support in Eclipse
  • server.product configuration worked, but server.product.eventtest did not. Hangs, related to the starting of Jetty ("WARNING: No default jetty created.")
  • Had to use Java 1.8 (change in the run configuration) otherwise error about too many open files and "java.lang.RuntimeException: Error scanning file I_PA_ReportColumnSet.class" (for example)
  • Had to run sequence check after upgrade

Deployment

How to add your custom plugins to the core and build them together

Useful for Jenkins build:

http://wiki.idempiere.org/en/Add_customize_plugin_to_package_with_core

Credit:

Hiệp lê quý

Remote debugging using Eclipse

Change the sequence of capture of address details

If you want to capture the country before you capture address line 1 (for example), change the Country Setup in System as follows:

Capture Sequence Old:

@A1@ @A2@ @A3@ @A4@ @C@, @P@ @CO@

Capture Sequence New:

@CO@ @A1@ @A2@ @A3@ @A4@ @C@, @P@


Pack Out / In

Notes

  • Include SQL to remove window tabs before the window is packed out (see AD scratchpad for details)
  • Data pack out: appears that the case which is used in composing the SQL statement is significant
    • Don't include trailing spaces after the SQL
  • Doesn't packout reference if reference is defined only on the Window and not in a column anywhere (see reference overwrite on window)
  • if you find things are missing from your 2pack for no apparent reason, check 'Export Dictionary Entity' is ticked on the header
  • To packout the packout definition itself, click on the export button on the toolbar , for each pack out
  • Sometimes a cache reset or even server restart is required after a pack-in
  • The following error indicates that the table concerned needs UUID to be generated (done under System/UUID Generator). Check the stack trace for the exact table.
org.adempiere.pipo2.exception.DatabaseAccessException: Failed to export 

SEVERE: AD_Window_Access
java.lang.IllegalStateException: 2Pack doesn't work with record without official Id and UUID -> AD_Window_Access_UU
	at org.adempiere.pipo2.AbstractElementHandler.verifyPackOutRequirement(AbstractElementHandler.java:519)
	at org.adempiere.pipo2.handler.WindowAccessElementHandler.create(WindowAccessElementHandler.java:69)
	at org.adempiere.pipo2.handler.RoleElementHandler.createWindowAccess(RoleElementHandler.java:289)
	at org.adempiere.pipo2.handler.RoleElementHandler.create(RoleElementHandler.java:167)

Table, window & field

Default logic for fields

Specify the default document type without hard coding the c_doctype_id

@SQL=SELECT c_doctype_id as DefaultValue from C_DocType where Name='AR Receipt' and AD_Client_ID=@AD_Client_ID@

UUID missing from table

See menu option: Generate UUIDs

Item showing in dropdown list which is not part of query

Check your callouts. A callout might set a value in the list, which is not included in the reference or dynamic validation.

Report & Process

Display a tabulated report after running process

For example, use the following statements in your process code:

addLog(0, null, new BigDecimal(100), "Test output line 1");
addLog(0, null, new BigDecimal(100), "Test output line 2");
addLog("Test output line 3");
addLog("Test output line 4");


Display or hide user prompt when running process

Various options are available for prompting the user when running a report & process, including:

  • Show Help
  • Run silently - Take Defaults
  • Don't show help

These are available under the Report & Process, Help field

Validate parameters for a report & process

For example if you wish to validate the start and end date parameters entered when running a report, add a class and validate in the java code (add the class to the definition of the report & process). If validation fails, throw an exception - the report will be cancelled.

Workflow

nTier Workflow Analysis & Review Research Document

See: https://groups.google.com/forum/#!topic/idempiere/RnE0kfl9dA4

Workflow: The Soul of an ERP

Red1's document: Workflow: The Soul of an ERP, is available here: http://sourceforge.net/projects/red1/files/ADempiere%20PDFs/Workflow.pdf/download

Jasper Reports

Developing report on Windows machine and deploying to a linux machine

If developing report on Windows machine and deploying to a linux machine, then use SanSerif (or a linux compatible font). If necessary, can find and replace in the .jrxml source. Otherwise, will encounter an error when running the report.

This page is brought to you by nTier Software Services. Feel free to improve directly or suggest using the Discussion tab.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.