Cannot save more than one order line when an _ID field is not displayed

Description

Reported by

When you try to create an order with two lines and the M_Shipper_ID is hidden an error is thrown because it tries to set 0 instead of null as the value. It seems to be, that this only happens with FK hidden fields that are in the master and detail tables.

 

This is not reproducible in iDempiere 9.

Steps to reproduce:

  1. Login as System

  2. Open Window, Tab & Field

  3. Navigate to Sales Order

  4. Open the Order Line tab

  5. Navigate to the Shipper record

  6. Uncheck Displayed

  7. Uncheck Show in Grid

  8. Save

  9. Log out and log back as Garden Admin

  10. Create a new Sales Order

  11. Create a new Order Line with any product and Save

  12. Create a second line with any product

 

Expected result

The order line saves normally

Actual result

An error message is shown and the second line cannot be saved

Environment

None

Attachments

1

Activity

Carlos Ruiz 
June 12, 2023 at 9:33 AM

I don’t understand how this is the same issue and how does it relate to the changes make by this ticket.

The description of the ticket sounds suspiciously similar, just that the description of this ticket was in a grid record, and the new finding is in the master form, but maybe is a new different issue as you point.

I think the fix could be different, 0 is null for most _ID field and we don’t have to relied on WSearchEditor to peform that conversion.

Yes, created pull request 1896 implementing this idea.

Heng Sin Low 
June 11, 2023 at 2:41 PM

Hi ,

I don’t understand how this is the same issue and how does it relate to the changes make by this ticket.

I think the fix could be different, 0 is null for most _ID field and we don’t have to relied on WSearchEditor to peform that conversion.

Regards,

Low

Carlos Ruiz 
June 11, 2023 at 2:00 PM

I went deep debugging this.

I think the cause is the same, this is the finding:

CalloutInOut.order is setting the field User1_ID to zero

When the field is configured as displayed (even if is hidden because of DisplayLogic), then it has associated a WSearchEditor

The associated WSearchEditor has a PropertyChangeListener listening for changes on this field.

When the callout set the value to zero, the WSearchEditor notice that zero is not in the lookup and set the value back to null.

The problem is, when the field is configured as not displayed - then there is no WSearchEditor to set back to null the invalid zero value.

The workaround is pretty easy, set the field as displayed with a false DisplayLogic, but I’m not sure if is OK to have this as a documented issue with a workaround and cope with the error, or fix the problem. I guess to fix it we would need to treat all lookup fields as displayed, which can go against performance.

- WDYT?

Carlos Ruiz 
April 27, 2023 at 9:04 PM

Thanks for checking - I’ll take a deeper look when I got some time.

Heng Sin Low 
April 27, 2023 at 4:54 AM

hi , this should be a different issue. I think the M_InOut.User1_ID value is copy from PO inside the CalloutInOut.order(…) method.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created January 31, 2023 at 2:02 PM
Updated August 1, 2023 at 5:26 PM
Resolved June 16, 2023 at 12:36 PM