IDEMPIERE-5018 Vendor changed to customer when edited using Quick Entry (#950)

IDEMPIERE-3705
This commit is contained in:
Carlos Ruiz 2021-10-27 15:14:03 +02:00 committed by GitHub
parent 22c09368e6
commit 9abc2c09e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 5 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-5018 Vendor changed to customer when edited using Quick Entry
-- Oct 27, 2021, 12:54:13 PM CEST
UPDATE AD_Field SET DisplayLogic='@_ParentIsSOTrx_@=N & @C_BPartner_ID@>0 | @_QUICK_ENTRY_MODE_@!Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ReadOnlyLogic='@_ParentIsSOTrx_@=N & @IsVendor@=Y', IsToolbarButton=NULL,Updated=TO_DATE('2021-10-27 12:54:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623
;
-- Oct 27, 2021, 12:54:47 PM CEST
UPDATE AD_Field SET DisplayLogic='@_ParentIsSOTrx_@=Y & @C_BPartner_ID@>0 | @_QUICK_ENTRY_MODE_@!Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ReadOnlyLogic='@_ParentIsSOTrx_@=Y & @IsCustomer@=Y', IsToolbarButton=NULL,Updated=TO_DATE('2021-10-27 12:54:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614
;
SELECT register_migration_script('202110271258_IDEMPIERE-5018.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-5018 Vendor changed to customer when edited using Quick Entry
-- Oct 27, 2021, 12:54:13 PM CEST
UPDATE AD_Field SET DisplayLogic='@_ParentIsSOTrx_@=N & @C_BPartner_ID@>0 | @_QUICK_ENTRY_MODE_@!Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ReadOnlyLogic='@_ParentIsSOTrx_@=N & @IsVendor@=Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-10-27 12:54:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9623
;
-- Oct 27, 2021, 12:54:47 PM CEST
UPDATE AD_Field SET DisplayLogic='@_ParentIsSOTrx_@=Y & @C_BPartner_ID@>0 | @_QUICK_ENTRY_MODE_@!Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ReadOnlyLogic='@_ParentIsSOTrx_@=Y & @IsCustomer@=Y', IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2021-10-27 12:54:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9614
;
SELECT register_migration_script('202110271258_IDEMPIERE-5018.sql') FROM dual
;

View File

@ -23,7 +23,7 @@ import org.compiere.model.MBPartner;
import org.compiere.util.Env;
import org.compiere.util.Util;
@Callout(tableName = MBPartner.Table_Name, columnName = "*")
@Callout(tableName = MBPartner.Table_Name, columnName = MBPartner.COLUMNNAME_C_BPartner_ID)
public class CalloutBPartnerQuickEntry implements IColumnCallout {
@Override
@ -31,13 +31,18 @@ public class CalloutBPartnerQuickEntry implements IColumnCallout {
// this callout is just for quick entry window
if ("Y".equals(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_MODE_"))) {
int parent_windowNo = Integer.parseInt(Env.getContext(ctx, WindowNo, "_QUICK_ENTRY_CALLER_WINDOW_"));
String docSOTrx = Env.getContext(ctx, parent_windowNo, "IsSOTrx", false);
if (!Util.isEmpty(docSOTrx)) {
boolean isSOTrx = "Y".equals(docSOTrx);
mTab.setValue(MBPartner.COLUMNNAME_IsCustomer, isSOTrx);
mTab.setValue(MBPartner.COLUMNNAME_IsVendor, !isSOTrx);
// set _ParentIsSOTrx_ used in DisplayLogic and ReadOnlyLogic of C_BPartner.IsCustomer and IsVendor
Env.setContext(ctx, WindowNo, "_ParentIsSOTrx_", isSOTrx);
Env.setContext(ctx, WindowNo, mTab.getTabNo(), "_ParentIsSOTrx_", isSOTrx);
if (value == null || ((Integer) value) == 0) { // new record
mTab.setValue(MBPartner.COLUMNNAME_IsCustomer, isSOTrx);
mTab.setValue(MBPartner.COLUMNNAME_IsVendor, !isSOTrx);
}
}
}
return null;