core-jgi/migration/320-trunk/019_RMA_dml.sql

288 lines
30 KiB
SQL

-- Element change
INSERT INTO AD_ELEMENT
(AD_ELEMENT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY,COLUMNNAME, ENTITYTYPE, NAME, PRINTNAME, DESCRIPTION, HELP, PO_NAME, PO_PRINTNAME, PO_DESCRIPTION, PO_HELP)
VALUES
(52000,0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'InOut_ID', 'D', 'Shipment/Receipt', 'Shipment/Receipt', 'MaterialShipment Document', 'The Material Shipment / Receipt ', 'Receipt', 'Receipt', 'Material Receipt Document', 'The Material Shipment / Receipt ');
-- Rule
INSERT INTO AD_VAL_RULE
(AD_VAL_RULE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, TYPE, CODE, ENTITYTYPE)
VALUES
(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_InOutShipment/Receipt', NULL, 'S', 'M_InOut.MovementType IN (''C-'', ''V+'') AND M_InOut.DocStatus IN (''CO'', ''CL'')', 'D');
INSERT INTO AD_VAL_RULE
(AD_VAL_RULE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, TYPE, CODE, ENTITYTYPE)
VALUES
(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_InOutShipment/Receipt (RMA)', NULL, 'S', 'M_InOutLine.M_InOut_ID=@InOut_ID@', 'D');
-- Processes
INSERT INTO AD_PROCESS
(AD_PROCESS_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, HELP, ACCESSLEVEL, ENTITYTYPE, PROCEDURENAME, ISREPORT, ISDIRECTPRINT, AD_REPORTVIEW_ID, CLASSNAME, STATISTIC_COUNT,STATISTIC_SECONDS, AD_PRINTFORMAT_ID, WORKFLOWVALUE, AD_WORKFLOW_ID, ISBETAFUNCTIONALITY, ISSERVERPROCESS, SHOWHELP, JASPERREPORT)
VALUES
(52000, 0,0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_RMA_CreateOrder', 'Create Order From RMA', 'Creates an order based on this RMA Document. The RMA should be correct and completed.', 'Generate Order from RMA will create an order based on this RMA document.', '3', 'D', NULL, 'N', 'N', NULL, 'org.adempiere.process.RMACreateOrder', 0, 0, NULL, NULL, NULL, 'N', 'N', 'Y', NULL);
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52000, 0, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52000, 102, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52000, 103, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS
(AD_PROCESS_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, HELP, ACCESSLEVEL, ENTITYTYPE, PROCEDURENAME, ISREPORT, ISDIRECTPRINT, AD_REPORTVIEW_ID, CLASSNAME, STATISTIC_COUNT,STATISTIC_SECONDS, AD_PRINTFORMAT_ID, WORKFLOWVALUE, AD_WORKFLOW_ID, ISBETAFUNCTIONALITY, ISSERVERPROCESS, SHOWHELP, JASPERREPORT)
VALUES
(52001, 0,0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'M_InOut_GenerateRMA (Manual)', 'Generate Shipments for Vendor RMA', 'Generate Shipments from open vendor RMA based on selection.', NULL, '3', 'D', NULL, 'N', 'N', NULL, 'org.adempiere.process.InOutGenerateRMA', 0, 0, NULL, NULL, NULL, 'N', 'N', 'Y', NULL);
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52001, 0, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52001, 102, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52001, 103, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS
(AD_PROCESS_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, HELP, ACCESSLEVEL, ENTITYTYPE, PROCEDURENAME, ISREPORT, ISDIRECTPRINT, AD_REPORTVIEW_ID, CLASSNAME, STATISTIC_COUNT,STATISTIC_SECONDS, AD_PRINTFORMAT_ID, WORKFLOWVALUE, AD_WORKFLOW_ID, ISBETAFUNCTIONALITY, ISSERVERPROCESS, SHOWHELP, JASPERREPORT)
VALUES
(52002, 0,0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'C_Invoice_GenerateRMA (Manual)', 'Generate Invoices for Vendor RMA', 'Generate Invoices from open vendor RMA based on selection.', NULL, '3', 'D', NULL, 'N', 'N', NULL, 'org.adempiere.process.InvoiceGenerateRMA', 0, 0, NULL, NULL, NULL, 'N', 'N', 'Y', NULL);
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52002, 0, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52002, 102, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
INSERT INTO AD_PROCESS_ACCESS
(AD_PROCESS_ID, AD_ROLE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, ISREADWRITE)
VALUES
(52002, 103, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Y');
-- Column Addition
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Sales Transaction', 'This is a Sales Transaction', 'The Sales Transaction checkbox indicates if this item is a Sales Transaction.', 1, 'D', 'IsSOTrx', 661, 20, NULL, NULL, 1, '@IsSOTrx@', 'N', 'N', 'Y', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 1106, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Amount', 'Amount', 'Amount', 1, 'D', 'Amt', 660, 12, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', '@M_InOutLine_ID@!0', 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 160, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52002, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Charge', 'Additional document charges', 'The Charge indicates a type of Charge (Handling, Shipping, Restocking)', 1, 'D', 'C_Charge_ID', 660, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 968, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52003, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Line Amount', 'Line Extended Amount (Quantity * Actual Price) without Freight and Charges','Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.', 1, 'D', 'LineNetAmt', 660, 12, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 441, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52004, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Line No', 'Unique line for this document', 'Indicates the unique line for a document. It will also control the display order of the lines within a document.', 1, 'D', 'Line', 660, 11, NULL, NULL, 22, '@SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_RMALine WHERE M_RMA_ID=@M_RMA_ID@', 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 439, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52005, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Delivered Quantity', 'Delivered Quantity', 'The Delivered Quantity indicates the quantity of a product that has been delivered.', 1, 'D', 'QtyDelivered', 660, 29, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 528, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52006, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'Generate To', 'Generate To', NULL, 0, 'D', 'GenerateTo', 661, 28, NULL, NULL, 1, NULL, 'N','N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 1491, 52000, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52007, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA', 'Return Material Authorization', 'A Return Material Authorization may be required to accept returns and to create Credit Memos', 1, 'D', 'M_RMA_ID', 318, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2412, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52008, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA Line', 'Return Material Authorization Line', 'Detail information about the returned goods', 1, 'D', 'M_RMALine_ID', 333, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2413, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52009, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA', 'Return Material Authorization', 'A Return Material Authorization may be required to accept returns and to create Credit Memos', 1, 'D', 'M_RMA_ID', 319, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2412, NULL, 'N', 'N', NULL);
INSERT INTO AD_COLUMN
(AD_COLUMN_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, UPDATED, CREATEDBY, UPDATEDBY, NAME, DESCRIPTION, HELP, VERSION, ENTITYTYPE, COLUMNNAME, AD_TABLE_ID, AD_REFERENCE_ID, AD_REFERENCE_VALUE_ID, AD_VAL_RULE_ID, FIELDLENGTH, DEFAULTVALUE, ISKEY, ISPARENT, ISMANDATORY, ISUPDATEABLE, READONLYLOGIC, ISIDENTIFIER, SEQNO, ISTRANSLATED, ISENCRYPTED, CALLOUT, VFORMAT, VALUEMIN, VALUEMAX, ISSELECTIONCOLUMN, AD_ELEMENT_ID, AD_PROCESS_ID, ISSYNCDATABASE, ISALWAYSUPDATEABLE, COLUMNSQL)
VALUES
(52010, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 100, 'RMA Line', 'Return Material Authorization Line', 'Detail information about the returned goods', 0, 'D', 'M_RMALine_ID', 320, 19, NULL, NULL, 22, NULL, 'N', 'N', 'N', 'Y', NULL, 'N', 0, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 2413, NULL, 'N', 'N', NULL);
-- Field addition
INSERT INTO AD_FIELD
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
VALUES
(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Create Order From RMA', 'Creates an order based on the RMA document', NULL, 'Y', 628, 52006, NULL, 'Y', '@Processed@=''Y'' & @C_Order_ID@=0 & @DocStatus@=''CO''', 1, 'N', 160, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
INSERT INTO AD_FIELD
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
VALUES
(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Amount', 'Amount', 'Amount', 'Y', 629, 52001, NULL, 'Y', NULL, 22, 'N', 100, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
INSERT INTO AD_FIELD
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
VALUES
(52002, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Charge', 'Additional document charges', 'The Charge indicates a type of Charge (Handling, Shipping, Restocking)', 'Y', 629, 52002, NULL, 'Y', NULL, 22, 'N', 80, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
INSERT INTO AD_FIELD
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
VALUES
(52003, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Delivered Quantity', 'Delivered Quantity', 'The Delivered Quantity indicates the quantity of a product that has been delivered.', 'Y', 629, 52005, NULL, 'N', NULL, 22, 'N', 0, NULL, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
INSERT INTO AD_FIELD
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
VALUES
(52004, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Line Amount', 'Line Extended Amount (Quantity * Actual Price) without Freight and Charges', 'Indicates the extended line amount based on the quantity and the actual price. Any additional charges or freight are not included. The Amount may or may not include tax. If the price list is inclusive tax, the line amount is the same as the line total.', 'Y', 629, 52003, NULL, 'Y', NULL, 22, 'Y', 110, NULL, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
INSERT INTO AD_FIELD
(AD_FIELD_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, NAME, DESCRIPTION, HELP, ISCENTRALLYMAINTAINED, AD_TAB_ID, AD_COLUMN_ID, AD_FIELDGROUP_ID, ISDISPLAYED, DISPLAYLOGIC, DISPLAYLENGTH, ISREADONLY, SEQNO, SORTNO, ISSAMELINE, ISHEADING, ISFIELDONLY, ISENCRYPTED, ENTITYTYPE, OBSCURETYPE, AD_REFERENCE_ID, ISMANDATORY)
VALUES
(52005, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Line No', 'Unique line for this document', 'Indicates the unique line for a document. It will also control the display order of the lines within a document.', 'Y', 629, 52004, NULL, 'Y', NULL, 22, 'N', 40, NULL, 'Y', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
INSERT INTO AD_FIELD(ad_field_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, help, iscentrallymaintained, ad_tab_id, ad_column_id, ad_fieldgroup_id, isdisplayed, displaylogic, displaylength, isreadonly, seqno, sortno, issameline, isheading, isfieldonly, isencrypted, entitytype, obscuretype, ad_reference_id, ismandatory)
VALUES(52007, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Sales Transaction', 'This is a Sales Transaction', 'The Sales Transaction checkbox indicates if this item is a Sales Transaction.', 'Y', 628, 52000, NULL, 'N', NULL, 1, 'N', NULL, NULL, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
-- Update Field
UPDATE AD_FIELD SET SeqNo=(SeqNo + 10) WHERE AD_Tab_ID=296 AND SeqNo > 40;
INSERT INTO AD_FIELD
(ad_field_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, help, iscentrallymaintained, ad_tab_id, ad_column_id, ad_fieldgroup_id, isdisplayed, displaylogic, displaylength, isreadonly, seqno, sortno, issameline, isheading, isfieldonly, isencrypted, entitytype, obscuretype, ad_reference_id, ismandatory)
VALUES(52006, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'RMA', 'Return Material Authorization', 'A Return Material Authorization may be required to accept returns and to create Credit Memos', 'Y', 296, 52009, NULL, 'Y', '@M_RMA_ID@!0', 26, 'Y', 50, 0, 'N', 'N', 'N', 'N', 'D', NULL, NULL, NULL);
-- Garden World RMA Fix
INSERT INTO AD_SEQUENCE(ad_sequence_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, vformat, isautosequence, incrementno, startno, currentnext, currentnextsys, isaudited, istableid, prefix, suffix, startnewyear)
VALUES(52000, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, 'Vendor Return Material', NULL, NULL, 'Y', 1, 990000, 990000, 900, 'N', 'N', NULL, NULL, 'N');
INSERT INTO AD_SEQUENCE(ad_sequence_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, description, vformat, isautosequence, incrementno, startno, currentnext, currentnextsys, isaudited, istableid, prefix, suffix, startnewyear)
VALUES(52001, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 0, 'MM Vendor Return', 'MM Vendor Return', NULL, 'Y', 1, 590000, 590000, 59000, 'N', 'N', NULL, NULL, 'N');
INSERT INTO C_DOCTYPE(c_doctype_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, printname, description, docbasetype, issotrx, docsubtypeso, hasproforma, c_doctypeproforma_id, c_doctypeshipment_id, c_doctypeinvoice_id, isdocnocontrolled, docnosequence_id, gl_category_id, hascharges, documentnote, isdefault, documentcopies, ad_printformat_id, isdefaultcounterdoc, isshipconfirm, ispickqaconfirm, isintransit, issplitwhendifference, c_doctypedifference_id, iscreatecounter, isindexed)
VALUES(151, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'MM Vendor Return', 'Vendor Return Material', NULL, 'MMS', 'Y', NULL, 'N', NULL, NULL, NULL, 'Y', 52001, 111, 'N', NULL, 'Y', 1, NULL, 'N', 'N', 'N', 'N', 'N', NULL, 'Y', 'Y');
INSERT INTO C_DOCTYPE(c_doctype_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, NAME, printname, description, docbasetype, issotrx, docsubtypeso, hasproforma, c_doctypeproforma_id, c_doctypeshipment_id, c_doctypeinvoice_id, isdocnocontrolled, docnosequence_id, gl_category_id, hascharges, documentnote, isdefault, documentcopies, ad_printformat_id, isdefaultcounterdoc, isshipconfirm, ispickqaconfirm, isintransit, issplitwhendifference, c_doctypedifference_id, iscreatecounter, isindexed)
VALUES(150, 11, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'Vendor Return Material', 'Vendor Return Material Authorization', NULL, 'POO', 'N', 'RM', 'N', NULL, 151, 124, 'Y', 52000, 111, 'N', NULL, 'N', 1, NULL, 'N', 'N', 'N', 'N', 'N', NULL, 'Y', 'Y');
-- Message Addition
INSERT INTO AD_MESSAGE
(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype)
VALUES(52000, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'OrderOrRMA', 'Either Order or RMA can be process on this document.', NULL, 'E', 'D');
INSERT INTO AD_MESSAGE
(ad_message_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, VALUE, msgtext, msgtip, msgtype, entitytype)
VALUES(52001, 0, 0, 'Y', TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, TO_DATE('07/05/2007 17:00:00', 'MM/DD/YYYY HH24:MI:SS'), 100, 'VendorRMA', 'Vendor RMA', NULL, 'I', 'D');
-- Misc AD Updates
UPDATE AD_COLUMN SET ColumnName='InOut_ID' WHERE AD_Column_ID=10842;
UPDATE AD_COLUMN SET AD_Element_ID=52000 WHERE AD_Column_ID=10842;
UPDATE AD_COLUMN SET AD_Reference_Value_ID=337 WHERE AD_Column_ID=10842;
UPDATE AD_COLUMN SET AD_Val_Rule_ID=52000 WHERE AD_Column_ID=10842;
UPDATE AD_TAB SET WhereClause='MovementType IN (''C+'', ''V+'')' WHERE AD_Tab_ID=296;
UPDATE AD_TAB SET WhereClause='MovementType IN (''C-'', ''V-'')' WHERE AD_Tab_ID=257;
UPDATE AD_COLUMN SET IsMandatory='N' WHERE AD_Column_ID=10829;
UPDATE AD_COLUMN SET AD_Val_Rule_ID=52001 WHERE AD_Column_ID=10829;
UPDATE AD_FIELD SET SeqNo=60, IsSameLine='N' WHERE AD_Field_ID=9310;
UPDATE AD_FIELD SET SeqNo=20, IsSameLine='Y' WHERE AD_Field_ID=9311;
UPDATE AD_FIELD SET SeqNo=70, IsSameLine='N' WHERE AD_Field_ID=9312;
UPDATE AD_FIELD SET SeqNo=0, IsSameLine='N' WHERE AD_Field_ID=9313;
UPDATE AD_FIELD SET SeqNo=30, IsSameLine='N' WHERE AD_Field_ID=9314;
UPDATE AD_FIELD SET SeqNo=50, IsSameLine='N' WHERE AD_Field_ID=9315;
UPDATE AD_FIELD SET SeqNo=90, IsSameLine='N' WHERE AD_Field_ID=9316;
UPDATE AD_FIELD SET SeqNo=10, IsSameLine='N' WHERE AD_Field_ID=9317;
UPDATE AD_FIELD SET SeqNo=0, IsSameLine='N' WHERE AD_Field_ID=10401;
UPDATE AD_FIELD SET SeqNo=100, IsSameLine='Y' WHERE AD_Field_ID=52001;
UPDATE AD_FIELD SET SeqNo=80, IsSameLine='Y' WHERE AD_Field_ID=52002;
UPDATE AD_FIELD SET SeqNo=0, IsSameLine='N' WHERE AD_Field_ID=52003;
UPDATE AD_FIELD SET SeqNo=110, IsSameLine='N' WHERE AD_Field_ID=52004;
UPDATE AD_FIELD SET SeqNo=40, IsSameLine='Y' WHERE AD_Field_ID=52005;
UPDATE AD_TAB SET IsSingleRow='Y' WHERE AD_Tab_ID=628;
UPDATE AD_TAB SET IsSingleRow='Y' WHERE AD_Tab_ID=629;
UPDATE C_DOCTYPE SET IsActive='Y' WHERE C_DocType_ID=149;
UPDATE AD_COLUMN SET Callout='org.adempiere.model.CalloutRMA.docType' WHERE AD_Column_ID=12118;
UPDATE AD_COLUMN SET ReadOnlyLogic='@IsSOTrx@=''N''' WHERE AD_Column_ID=52006;
UPDATE AD_FIELD SET DisplayLogic='@Processed@=''Y'' & @C_Order_ID@=0 & @DocStatus@=''CO'' & @IsSOTrx@=''Y'''
WHERE AD_Field_ID=52000;
UPDATE AD_REF_TABLE SET WhereClause='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@'
WHERE AD_Reference_ID=321;
UPDATE AD_VAL_RULE SET Code='M_InOutLine.M_InOut_ID=@InOut_ID@ AND NOT EXISTS (SELECT * FROM M_RMALine rl WHERE rl.M_InOutLine_ID=M_InOutLine.M_InOutLine_ID AND rl.M_RMA_ID=@M_RMA_ID@)'
WHERE AD_Val_Rule_ID=52001;
UPDATE C_DOCTYPE SET NAME='MM Returns', IsSOTrx='N' WHERE C_DocType_ID=149;
COMMIT;
-- NOTE: Don't forget to run the three processes:
-- 1 - Add missing translations
-- 2 - Synchronize terminology
-- 3 - Check sequences