NPE when csv export order with "Sales Representative"

Description

Do csv export a sales order with value at "Sales Representative", raise a NPE

Environment

None

Attachments

2

Activity

Carlos Ruiz 
May 8, 2019 at 9:41 AM

Hi , it sounds like there is an error in your dictionary, I think it would be better to fix it instead of the suggested hardcode.

Regards,

Carlos Ruiz

redhuan d. oon 
May 5, 2019 at 2:06 AM

I hit a Pack In error which complained SalesRep_ID has no Reference Key. I made a hard coded change the 2Pack now work.

diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/ColumnElementHandler.java @@ -153,7 +153,8 @@ if (mColumn.isVirtualColumn() || !syncDatabase) recreateColumn = false; } - + if (mColumn.getColumnName().equals("SalesRep_ID"))//red1 + mColumn.setAD_Reference_ID(110);//red1 if (mColumn.save(getTrxName(ctx)) == true) { logImportDetail(ctx, impDetail, 1, mColumn.getName(), mColumn .get_ID(), action);

Carlos Ruiz 
February 27, 2019 at 9:47 AM

Removed the validation as it affects adversely the Pack In process that potentially can create the foreign table in a later stage.

This dictionary definition error is hard that it pass unnoticed a test stage because it will throw errors when testing.

However, for sanity, I'll run the following query on release time, and is recommended to check for potential offending columns in your own databases:

-- Check columns without foreign key table SELECT t.tablename, c.columnname FROM ad_column c JOIN ad_table t ON (c.ad_table_id=t.ad_table_id) WHERE (c.ad_reference_id = 19 OR (c.ad_reference_id = 30 AND coalesce(ad_reference_value_id,0) = 0)) AND c.isactive='Y' AND NOT EXISTS (SELECT 1 FROM ad_table WHERE tablename = left(c.columnname, length(c.columnname)-3))

Carlos Ruiz 
January 26, 2019 at 12:44 PM

Solved adding validations in MColumn to avoid wrong data definition.

Hiep Lq 
October 13, 2017 at 3:54 PM

yes. it better, make logic consistent

Fixed

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created September 30, 2017 at 2:49 PM
Updated May 8, 2019 at 9:41 AM
Resolved January 26, 2019 at 12:44 PM