IsInsertRecord = 'Y' for Organization Info Tab on Organization Window

Description

When we create a new Organization the afterSave method creates automatically a new Organization Info record, then i think that the flag IsInsertRecord could be set to false for Organization Info tab on Organization Window.

This can prevent this error: "Could not save record - Require unique data: - Please change information.: ERROR: duplicate key value violates unique constraint "ad_orginfo_pkey" Detail: Key (ad_org_id)=(50000) already exists."

To reproduce on demo server:

  • login as garden world

  • go to Organization Window and select a Org

  • switch to Organization Info tab, the new button is enabled

  • click the new button, insert some data and try to save

– sql to change the IsInsertRecord
UPDATE AD_Tab SET IsInsertRecord = 'N' WHERE AD_Tab_ID=170;

Environment

None

Attachments

1

Activity

Show:

Carlos Ruiz January 7, 2015 at 4:39 PM

Thanks , I committed a version without changing the Accounting Schema window as in my tests it was not possible to create GL defaults for a new schema.

Murilo Habermann Torquato January 3, 2014 at 5:38 PM
Edited

Hi Carlos / Hieplq,

Tks for the tips!

PS: i deleted the sql file that i had attached, because of the patch sent by Hieplq is the right one to test/use.

Hiep Lq January 3, 2014 at 5:26 AM

I don't see test case for AD_Ref_Table and A_RegistrationProduct rise message DuplicatedKey,
because I think nothing change for two this table.

for friendly message. DuplicatedKey message is handle by function DBException.getDefaultDBExceptionMessage
only redefine message SAVE_ERROR_NOT_UNIQUE_MSG

Carlos Ruiz January 2, 2014 at 7:34 PM

Hi Murilo, I think assigning a message to the corresponding unique index does the trick, no need to java code.

Regards,

Carlos Ruiz

Murilo Habermann Torquato January 2, 2014 at 7:22 PM

Hieplq,

thanks for the info about how to patch migration scripts!

just a comment:

+ tables AD_Ref_Table and A_RegistrationProduct: I think that we could write a simple beforeSave validation to avoid the DuplicatedKey error, and show a user friendly message (For example, take a look into the beforeSave from MCostDetail class, a "AlreadyExists" message is returned if user try to save a duplicated value)

Fixed

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created December 30, 2013 at 2:48 AM
Updated May 4, 2015 at 5:43 PM
Resolved January 7, 2015 at 4:39 PM