Holding A_Tab.set... value before save

47 views
Skip to first unread message

StabilisOne

unread,
Jun 23, 2020, 8:15:24 AM6/23/20
to iDempiere
Hi Community,
Let me ask for your help, please.

Environment: Smart Suite ERP, CRM and SCM  5.1; server: Linux client2 4.15.0-99-generic #100-Ubuntu; local: Linux  5.3.0-59-generic #53~18.04.1-Ubuntu, FireFox 77.0.

Description: Callout uncheck selected IsBillToin if the count of BPartner invoicing Addresses is greater than one.

Problem: I am not able to link prepareStatement with any transaction, so standard saving the window overwrites the update imposed in the callout.      

Question:Is any better way to hold A_Tab.set... in Field before standard save? Better and more correct  than A_Tab.dataRefreshAll() method?

PS. Please find Callout contents in attached file

chckDblInvAddrsss.jsr223

Hiep Lq

unread,
Jun 23, 2020, 9:06:53 AM6/23/20
to idem...@googlegroups.com
Not sure I correct understand what you askIng for
Maybe you study about model event before save

Sent from my Phone

On Jun 23, 2020, at 19:15, StabilisOne <stabi...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/3cb18c86-f5cb-4c35-85a9-e94c4aafeda1o%40googlegroups.com.
<chckDblInvAddrsss.jsr223>

StabilisOne

unread,
Jun 23, 2020, 9:43:41 AM6/23/20
to iDempiere
Thank you for quick answer Hiep. I am trying to have dynamic control over 'isBillTo' flag in the Window Field 'Invoice Address' for each C_BPartner_Location record without any developing/plugin works. My intention is to avoid more then one invoicing adress (C_BPartner_Location tab with column isBillTo='Y'), because it could badly affect documents ex. invoice jasper report. Without using A_Tab.dataRefreshAll() method context could still holding previos positive value of 'isBillTo' in spite of command: A_Tab.setValue("IsBillTo",no); that made it negative, so simple save icon click can overvrite update triggered by the callout. 
Best Regards,
AWieclawski

Carlos Antonio Ruiz Gomez

unread,
Jun 23, 2020, 2:59:58 PM6/23/20
to idem...@googlegroups.com
Hi,

Do you know that you can enforce that with an index?

Something like:

CREATE UNIQUE INDEX idx_loc_unq_isbillto ON c_bpartner_location
(c_bpartner_id, (CASE WHEN isbillto='Y' THEN 0 ELSE
c_bpartner_location_id END))

If you create the unique index from the dictionary you can also provide
the user with a meaningful translatable message when the unique index fails.

Regards,

Carlos Ruiz



El 23/06/20 a las 3:43 p. m., StabilisOne escribió:
Reply all
Reply to author
Forward
0 new messages