Rule snippets

From iDempiere en
Revision as of 22:57, 24 February 2021 by Schnbeck (talk | contribs) (Created page with "= Rule snippets = == Enforce current date == To enforce POS-orders to be completed only with the current date the following snippet was attached to c_order on before complet...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Rule snippets

Enforce current date

To enforce POS-orders to be completed only with the current date the following snippet was attached to c_order on before complete:

import org.compiere.util.Env;

today = Env.getContextAsDate(A_Ctx, "#Date");
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
today.setNanos(0);

if (A_PO.getDateOrdered().before(today) && A_PO.getC_DocTypeTarget_ID() == 1000041)
  msg = "POS-Aufträge nicht für zurückliegende Daten";
else
  msg = "";

return msg;

Of course the doctype ID must be adjusted to your installation. The usage auf #Date instead of the systemtime allows to use an older date by setting it at login if required.

See Also

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