Ticket #1001770: RMA improvements - support optional shipment/receipt line in rma line
This commit is contained in:
parent
11e8a2a0ed
commit
c3288cdd41
|
@ -0,0 +1,207 @@
|
|||
-- Jan 21, 2013 3:00:42 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Column SET ReadOnlyLogic='@M_Product_ID@!0',Updated=TO_DATE('2013-01-21 15:00:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:01:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Column (Version,IsSyncDatabase,IsEncrypted,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,AD_Val_Rule_ID,IsKey,AD_Element_ID,ReadOnlyLogic,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection,IsToolbarButton,IsAlwaysUpdateable) VALUES (0,'N','N',660,208397,'D','N','N','N',0,'N',10,'N',30,231,'N',454,'@M_InOutLine_ID@!0 | @C_Charge_ID@!0','N','Y','afd09a4d-ab7f-4880-8f7d-b4b8c25acdfa','Y','M_Product_ID','Product, Service, Item','Identifies an item which is either purchased or sold in this organization.','Product','Y',100,TO_DATE('2013-01-21 15:01:57','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2013-01-21 15:01:57','YYYY-MM-DD HH24:MI:SS'),100,0,0,'N','N')
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:02:00 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=208397 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:02:05 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
ALTER TABLE M_RMALine ADD M_Product_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:02:22 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Column SET ReadOnlyLogic='@M_InOutLine_ID@!0 | @M_Product_ID@!0',Updated=TO_DATE('2013-01-21 15:02:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:17 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',629,10,'N','N',208397,'Y',201688,'N','Identifies an item which is either purchased or sold in this organization.','D','Product, Service, Item','Product','N','Y','09418daf-385d-4f02-b05c-35ed42ce9dac',100,0,TO_DATE('2013-01-21 15:06:16','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2013-01-21 15:06:16','YYYY-MM-DD HH24:MI:SS'),'Y')
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:17 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201688 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=201688
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=9316
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=52001
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=201663
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=52004
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=201688
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=9316
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=52001
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=201663
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=52004
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:39 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET DisplayLength=14, ColumnSpan=2,Updated=TO_DATE('2013-01-21 15:06:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201688
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',53281,10,'N','N',208397,'Y',201689,'N','Identifies an item which is either purchased or sold in this organization.','D','Product, Service, Item','Product','N','Y','24772a1f-1505-4194-ba8d-27b2031c7584',100,0,TO_DATE('2013-01-21 15:06:49','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2013-01-21 15:06:49','YYYY-MM-DD HH24:MI:SS'),'Y')
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201689 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=201689
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=57977
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=57978
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=57979
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=201677
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=57980
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=201689
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=57977
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=57978
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=57979
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=201677
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=57980
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:15 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET DisplayLength=14, ColumnSpan=2,Updated=TO_DATE('2013-01-21 15:07:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201689
|
||||
;
|
||||
|
||||
UPDATE M_RMALine rl SET M_Product_ID = (
|
||||
SELECT iol.M_Product_ID
|
||||
FROM M_InOutLine iol
|
||||
WHERE rl.M_InOutLine_ID = iol.M_InOutLine_ID),
|
||||
C_Charge_ID = (
|
||||
SELECT iol.C_Charge_ID
|
||||
FROM M_InOutLine iol
|
||||
WHERE rl.M_InOutLine_ID = iol.M_InOutLine_ID)
|
||||
WHERE rl.M_InOutLine_ID > 0;
|
||||
|
||||
-- Jan 21, 2013 7:39:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message SET MsgText='Shipment/Receipt Line or product or charge should be entered', Value='FillShipLineOrProductOrCharge',Updated=TO_DATE('2013-01-21 19:39:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=523849
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 7:39:25 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=523849
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 7:39:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message SET MsgText='Either product or charge should be selected', Value='JustProductOrCharge',Updated=TO_DATE('2013-01-21 19:39:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=523850
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 7:39:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=523850
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201301211935_TICKET-1001770.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,207 @@
|
|||
-- Jan 21, 2013 3:00:42 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Column SET ReadOnlyLogic='@M_Product_ID@!0',Updated=TO_TIMESTAMP('2013-01-21 15:00:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:01:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Column (Version,IsSyncDatabase,IsEncrypted,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,AD_Val_Rule_ID,IsKey,AD_Element_ID,ReadOnlyLogic,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection,IsToolbarButton,IsAlwaysUpdateable) VALUES (0,'N','N',660,208397,'D','N','N','N',0,'N',10,'N',30,231,'N',454,'@M_InOutLine_ID@!0 | @C_Charge_ID@!0','N','Y','afd09a4d-ab7f-4880-8f7d-b4b8c25acdfa','Y','M_Product_ID','Product, Service, Item','Identifies an item which is either purchased or sold in this organization.','Product','Y',100,TO_TIMESTAMP('2013-01-21 15:01:57','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2013-01-21 15:01:57','YYYY-MM-DD HH24:MI:SS'),100,0,0,'N','N')
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:02:00 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=208397 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:02:05 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
ALTER TABLE M_RMALine ADD COLUMN M_Product_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:02:22 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Column SET ReadOnlyLogic='@M_InOutLine_ID@!0 | @M_Product_ID@!0',Updated=TO_TIMESTAMP('2013-01-21 15:02:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:17 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',629,10,'N','N',208397,'Y',201688,'N','Identifies an item which is either purchased or sold in this organization.','D','Product, Service, Item','Product','N','Y','09418daf-385d-4f02-b05c-35ed42ce9dac',100,0,TO_TIMESTAMP('2013-01-21 15:06:16','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2013-01-21 15:06:16','YYYY-MM-DD HH24:MI:SS'),'Y')
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:17 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201688 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=201688
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=9316
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=52001
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=201663
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=52004
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=201688
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=52002
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=9316
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=52001
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=201663
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:28 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=52004
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:39 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET DisplayLength=14, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-01-21 15:06:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201688
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',53281,10,'N','N',208397,'Y',201689,'N','Identifies an item which is either purchased or sold in this organization.','D','Product, Service, Item','Product','N','Y','24772a1f-1505-4194-ba8d-27b2031c7584',100,0,TO_TIMESTAMP('2013-01-21 15:06:49','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2013-01-21 15:06:49','YYYY-MM-DD HH24:MI:SS'),'Y')
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201689 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=201689
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=57977
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=57978
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=57979
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=201677
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:06:59 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=57980
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=201689
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=57977
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=57978
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=57979
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=201677
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:03 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=57980
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 3:07:15 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Field SET DisplayLength=14, ColumnSpan=2,Updated=TO_TIMESTAMP('2013-01-21 15:07:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201689
|
||||
;
|
||||
|
||||
UPDATE M_RMALine rl SET M_Product_ID = (
|
||||
SELECT iol.M_Product_ID
|
||||
FROM M_InOutLine iol
|
||||
WHERE rl.M_InOutLine_ID = iol.M_InOutLine_ID),
|
||||
C_Charge_ID = (
|
||||
SELECT iol.C_Charge_ID
|
||||
FROM M_InOutLine iol
|
||||
WHERE rl.M_InOutLine_ID = iol.M_InOutLine_ID)
|
||||
WHERE rl.M_InOutLine_ID > 0;
|
||||
|
||||
-- Jan 21, 2013 7:39:24 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message SET MsgText='Shipment/Receipt Line or product or charge should be entered', Value='FillShipLineOrProductOrCharge',Updated=TO_TIMESTAMP('2013-01-21 19:39:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=523849
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 7:39:25 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=523849
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 7:39:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message SET MsgText='Either product or charge should be selected', Value='JustProductOrCharge',Updated=TO_TIMESTAMP('2013-01-21 19:39:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=523850
|
||||
;
|
||||
|
||||
-- Jan 21, 2013 7:39:52 PM SGT
|
||||
-- Ticket 1001770: RMA improvements
|
||||
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=523850
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201301211935_TICKET-1001770.sql') FROM dual
|
||||
;
|
|
@ -184,7 +184,7 @@ public class InOutGenerateRMA extends SvrProcess
|
|||
MRMALine rmaLines[] = rma.getLines(true);
|
||||
for (MRMALine rmaLine : rmaLines)
|
||||
{
|
||||
if (rmaLine.getM_InOutLine_ID() != 0 || rmaLine.getC_Charge_ID() != 0)
|
||||
if (rmaLine.getM_InOutLine_ID() != 0 || rmaLine.getC_Charge_ID() != 0 || rmaLine.getM_Product_ID() != 0)
|
||||
{
|
||||
MInOutLine shipLine = new MInOutLine(shipment);
|
||||
shipLine.setM_RMALine_ID(rmaLine.get_ID());
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.adempiere.process;
|
||||
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MRMA;
|
||||
|
@ -80,11 +82,13 @@ public class RMACreateOrder extends SvrProcess
|
|||
throw new IllegalStateException("Could not create order");
|
||||
}
|
||||
|
||||
MRMALine lines[] = rma.getLines(true);
|
||||
|
||||
MInOut originalShipment = rma.getShipment();
|
||||
MInvoice originalInvoice = rma.getOriginalInvoice();
|
||||
|
||||
MRMALine lines[] = rma.getLines(true);
|
||||
for (MRMALine line : lines)
|
||||
{
|
||||
if (line.getShipLine() != null && line.getShipLine().getC_OrderLine_ID() != 0)
|
||||
if (line.getShipLine() != null && line.getShipLine().getC_OrderLine_ID() != 0 && line.getM_Product_ID() != 0)
|
||||
{
|
||||
// Create order lines if the RMA Doc line has a shipment line
|
||||
MOrderLine orderLine = new MOrderLine(order);
|
||||
|
@ -108,6 +112,53 @@ public class RMACreateOrder extends SvrProcess
|
|||
throw new IllegalStateException("Could not create Order Line");
|
||||
}
|
||||
}
|
||||
else if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (originalInvoice != null)
|
||||
{
|
||||
MOrderLine orderLine = new MOrderLine(order);
|
||||
orderLine.setAD_Org_ID(line.getAD_Org_ID());
|
||||
orderLine.setM_Product_ID(line.getM_Product_ID());
|
||||
orderLine.setM_AttributeSetInstance_ID(line.getM_AttributeSetInstance_ID());
|
||||
orderLine.setC_UOM_ID(line.getC_UOM_ID());
|
||||
orderLine.setC_Tax_ID(line.getC_Tax_ID());
|
||||
orderLine.setM_Warehouse_ID(originalShipment.getM_Warehouse_ID());
|
||||
orderLine.setC_Currency_ID(originalInvoice.getC_Currency_ID());
|
||||
orderLine.setQty(line.getQty());
|
||||
orderLine.setC_Project_ID(line.getC_Project_ID());
|
||||
orderLine.setC_Activity_ID(line.getC_Activity_ID());
|
||||
orderLine.setC_Campaign_ID(line.getC_Campaign_ID());
|
||||
orderLine.setPrice();
|
||||
orderLine.setPrice(line.getAmt());
|
||||
|
||||
if (!orderLine.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create Order Line");
|
||||
}
|
||||
}
|
||||
else if (originalOrder != null)
|
||||
{
|
||||
MOrderLine orderLine = new MOrderLine(order);
|
||||
orderLine.setAD_Org_ID(line.getAD_Org_ID());
|
||||
orderLine.setM_Product_ID(line.getM_Product_ID());
|
||||
orderLine.setM_AttributeSetInstance_ID(line.getM_AttributeSetInstance_ID());
|
||||
orderLine.setC_UOM_ID(line.getC_UOM_ID());
|
||||
orderLine.setC_Tax_ID(line.getC_Tax_ID());
|
||||
orderLine.setM_Warehouse_ID(originalOrder.getM_Warehouse_ID());
|
||||
orderLine.setC_Currency_ID(originalOrder.getC_Currency_ID());
|
||||
orderLine.setQty(line.getQty());
|
||||
orderLine.setC_Project_ID(line.getC_Project_ID());
|
||||
orderLine.setC_Activity_ID(line.getC_Activity_ID());
|
||||
orderLine.setC_Campaign_ID(line.getC_Campaign_ID());
|
||||
orderLine.setPrice();
|
||||
orderLine.setPrice(line.getAmt());
|
||||
|
||||
if (!orderLine.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create Order Line");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rma.setC_Order_ID(order.getC_Order_ID());
|
||||
|
|
|
@ -188,6 +188,21 @@ public interface I_M_RMALine
|
|||
|
||||
public org.compiere.model.I_M_InOutLine getM_InOutLine() throws RuntimeException;
|
||||
|
||||
/** Column name M_Product_ID */
|
||||
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
|
||||
|
||||
/** Set Product.
|
||||
* Product, Service, Item
|
||||
*/
|
||||
public void setM_Product_ID (int M_Product_ID);
|
||||
|
||||
/** Get Product.
|
||||
* Product, Service, Item
|
||||
*/
|
||||
public int getM_Product_ID();
|
||||
|
||||
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException;
|
||||
|
||||
/** Column name M_RMA_ID */
|
||||
public static final String COLUMNNAME_M_RMA_ID = "M_RMA_ID";
|
||||
|
||||
|
|
|
@ -352,15 +352,13 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
}
|
||||
}
|
||||
|
||||
// Updates Amount
|
||||
if (!calculateTaxTotal())
|
||||
{
|
||||
m_processMsg = "Error calculating tax";
|
||||
return DocAction.STATUS_Invalid;
|
||||
}
|
||||
|
||||
// Updates Amount
|
||||
setAmt(getTotalAmount());
|
||||
|
||||
m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
|
||||
if (m_processMsg != null)
|
||||
return DocAction.STATUS_Invalid;
|
||||
|
@ -898,32 +896,6 @@ public class MRMA extends X_M_RMA implements DocAction
|
|||
setDescription(desc + " | " + description);
|
||||
} // addDescription
|
||||
|
||||
/**
|
||||
* Get the total amount based on the lines
|
||||
* @return Total Amount
|
||||
*/
|
||||
public BigDecimal getTotalAmount()
|
||||
{
|
||||
MRMALine lines[] = this.getLines(true);
|
||||
|
||||
BigDecimal amt = Env.ZERO;
|
||||
|
||||
for (MRMALine line : lines)
|
||||
{
|
||||
amt = amt.add(line.getLineNetAmt());
|
||||
}
|
||||
|
||||
return amt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the amount on the document
|
||||
*/
|
||||
public void updateAmount()
|
||||
{
|
||||
setAmt(getTotalAmount());
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Get Summary
|
||||
* @return Summary of Document
|
||||
|
|
|
@ -82,29 +82,17 @@ public class MRMALine extends X_M_RMALine
|
|||
private int precision = 0;
|
||||
private BigDecimal unitAmount = Env.ZERO;
|
||||
private BigDecimal originalQty = Env.ZERO;
|
||||
private int taxId = 0;
|
||||
|
||||
/**
|
||||
* Initialise parameters that are required
|
||||
*/
|
||||
private void init()
|
||||
{
|
||||
if (getC_Charge_ID() != 0)
|
||||
{
|
||||
// Retrieve tax Exempt
|
||||
String sql = "SELECT C_Tax_ID FROM C_Tax WHERE AD_Client_ID=? AND IsActive='Y' "
|
||||
+ "AND IsTaxExempt='Y' AND ValidFrom < SYSDATE ORDER BY IsDefault DESC";
|
||||
|
||||
// Set tax for charge as exempt
|
||||
setC_Tax_ID(DB.getSQLValueEx(null, sql, Env.getAD_Client_ID(getCtx())));
|
||||
m_ioLine = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
getShipLine();
|
||||
}
|
||||
getShipLine();
|
||||
|
||||
if (m_ioLine != null)
|
||||
{
|
||||
{
|
||||
// Get pricing details (Based on invoice if found, on order otherwise)
|
||||
// --> m_ioLine.isInvoiced just work for sales orders - so it doesn't work for purchases
|
||||
if (getInvoiceLineId() != 0)
|
||||
|
@ -113,7 +101,7 @@ public class MRMALine extends X_M_RMALine
|
|||
precision = invoiceLine.getPrecision();
|
||||
unitAmount = invoiceLine.getPriceEntered();
|
||||
originalQty = invoiceLine.getQtyInvoiced();
|
||||
setC_Tax_ID(invoiceLine.getC_Tax_ID());
|
||||
taxId = invoiceLine.getC_Tax_ID();
|
||||
}
|
||||
else if (m_ioLine.getC_OrderLine_ID() != 0)
|
||||
{
|
||||
|
@ -121,7 +109,7 @@ public class MRMALine extends X_M_RMALine
|
|||
precision = orderLine.getPrecision();
|
||||
unitAmount = orderLine.getPriceEntered();
|
||||
originalQty = orderLine.getQtyDelivered();
|
||||
setC_Tax_ID(orderLine.getC_Tax_ID());
|
||||
taxId = orderLine.getC_Tax_ID();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -132,6 +120,53 @@ public class MRMALine extends X_M_RMALine
|
|||
{
|
||||
MCharge charge = MCharge.get(this.getCtx(), getC_Charge_ID());
|
||||
unitAmount = charge.getChargeAmt();
|
||||
|
||||
// Retrieve tax Exempt
|
||||
String sql = "SELECT C_Tax_ID FROM C_Tax WHERE AD_Client_ID=? AND IsActive='Y' "
|
||||
+ "AND IsTaxExempt='Y' AND ValidFrom < SYSDATE ORDER BY IsDefault DESC";
|
||||
|
||||
// Set tax for charge as exempt
|
||||
taxId = DB.getSQLValueEx(null, sql, Env.getAD_Client_ID(getCtx()));
|
||||
m_ioLine = null;
|
||||
}
|
||||
else if (getM_Product_ID() != 0)
|
||||
{
|
||||
MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx());
|
||||
|
||||
MInvoice invoice = getParent().getOriginalInvoice();
|
||||
if (invoice != null)
|
||||
{
|
||||
pp.setM_PriceList_ID(invoice.getM_PriceList_ID());
|
||||
pp.setPriceDate(invoice.getDateInvoiced());
|
||||
|
||||
precision = invoice.getPrecision();
|
||||
taxId = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID(), invoice.getDateInvoiced(), invoice.getDateInvoiced(),
|
||||
getAD_Org_ID(), getParent().getShipment().getM_Warehouse_ID(),
|
||||
invoice.getC_BPartner_Location_ID(), // should be bill to
|
||||
invoice.getC_BPartner_Location_ID(), getParent().isSOTrx());
|
||||
}
|
||||
else
|
||||
{
|
||||
MOrder order = getParent().getOriginalOrder();
|
||||
if (order != null)
|
||||
{
|
||||
pp.setM_PriceList_ID(order.getM_PriceList_ID());
|
||||
pp.setPriceDate(order.getDateOrdered());
|
||||
|
||||
precision = order.getPrecision();
|
||||
taxId = Tax.get(getCtx(), getM_Product_ID(), getC_Charge_ID(), order.getDateOrdered(), order.getDateOrdered(),
|
||||
getAD_Org_ID(), order.getM_Warehouse_ID(),
|
||||
order.getC_BPartner_Location_ID(), // should be bill to
|
||||
order.getC_BPartner_Location_ID(), getParent().isSOTrx());
|
||||
}
|
||||
else
|
||||
throw new IllegalStateException("No Invoice/Order found the Shipment/Receipt associated");
|
||||
}
|
||||
|
||||
pp.calculatePrice();
|
||||
unitAmount = pp.getPriceStd();
|
||||
|
||||
m_ioLine = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +197,7 @@ public class MRMALine extends X_M_RMALine
|
|||
*/
|
||||
public MInOutLine getShipLine()
|
||||
{
|
||||
if ((m_ioLine == null || is_ValueChanged("M_InOutLine_ID")) && getM_InOutLine_ID() != 0)
|
||||
if ((m_ioLine == null || is_ValueChanged(COLUMNNAME_M_InOutLine_ID)) && getM_InOutLine_ID() != 0)
|
||||
m_ioLine = new MInOutLine (getCtx(), getM_InOutLine_ID(), get_TrxName());
|
||||
return m_ioLine;
|
||||
} // getShipLine
|
||||
|
@ -200,7 +235,8 @@ public class MRMALine extends X_M_RMALine
|
|||
|
||||
// juddm: Tax Exempt & Tax Included in Price List & not Document Level - Adjust Line Amount
|
||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1733602&group_id=176962&atid=879332
|
||||
if (getParent().isTaxIncluded() && !documentLevel) {
|
||||
if (getParent().isTaxIncluded() && !documentLevel)
|
||||
{
|
||||
BigDecimal taxStdAmt = Env.ZERO, taxThisAmt = Env.ZERO;
|
||||
|
||||
MTax orderTax = getTax();
|
||||
|
@ -256,26 +292,28 @@ public class MRMALine extends X_M_RMALine
|
|||
@Override
|
||||
protected boolean beforeSave(boolean newRecord)
|
||||
{
|
||||
if (newRecord && getParent().isComplete()) {
|
||||
if (newRecord && getParent().isComplete())
|
||||
{
|
||||
log.saveError("ParentComplete", Msg.translate(getCtx(), "M_RMA"));
|
||||
return false;
|
||||
}
|
||||
if (getM_InOutLine_ID() == 0 && getC_Charge_ID() == 0)
|
||||
if (getM_InOutLine_ID() == 0 && getC_Charge_ID() == 0 && getM_Product_ID() == 0)
|
||||
{
|
||||
log.saveError("FillShipLineOrCharge", "");
|
||||
log.saveError("FillShipLineOrProductOrCharge", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getM_InOutLine_ID() != 0 && getC_Charge_ID() != 0)
|
||||
if (getM_Product_ID() != 0 && getC_Charge_ID() != 0)
|
||||
{
|
||||
log.saveError("JustShipLineOrCharge", "");
|
||||
log.saveError("JustProductOrCharge", "");
|
||||
return false;
|
||||
}
|
||||
|
||||
init();
|
||||
if (m_ioLine != null)
|
||||
{
|
||||
if (! checkQty()) {
|
||||
if (! checkQty())
|
||||
{
|
||||
log.saveError("AmtReturned>Shipped", "");
|
||||
return false;
|
||||
}
|
||||
|
@ -293,8 +331,17 @@ public class MRMALine extends X_M_RMALine
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set default amount and qty for product
|
||||
if (this.getM_Product_ID() != 0 && this.getQty().doubleValue() <= 0)
|
||||
{
|
||||
if (getQty().signum() == 0)
|
||||
this.setQty(Env.ONE);
|
||||
if (getAmt().signum() == 0)
|
||||
this.setAmt(getUnitAmt());
|
||||
}
|
||||
|
||||
// Set default amount for charge and qty
|
||||
// Set default amount and qty for charge
|
||||
if (this.getC_Charge_ID() != 0 && this.getQty().doubleValue() <= 0)
|
||||
{
|
||||
if (getQty().signum() == 0)
|
||||
|
@ -306,14 +353,18 @@ public class MRMALine extends X_M_RMALine
|
|||
// Set amount for products
|
||||
if (this.getM_InOutLine_ID() != 0)
|
||||
{
|
||||
this.setM_Product_ID(m_ioLine.getM_Product_ID());
|
||||
this.setC_Charge_ID(m_ioLine.getC_Charge_ID());
|
||||
this.setAmt(getUnitAmt());
|
||||
|
||||
if (newRecord && getQty().signum() == 0)
|
||||
{
|
||||
this.setQty(originalQty);
|
||||
}
|
||||
}
|
||||
|
||||
// Set tax
|
||||
if (this.getC_Tax_ID() == 0)
|
||||
this.setC_Tax_ID(taxId);
|
||||
|
||||
// Get Line No
|
||||
if (getLine() == 0)
|
||||
{
|
||||
|
@ -327,11 +378,11 @@ public class MRMALine extends X_M_RMALine
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean checkQty() {
|
||||
public boolean checkQty()
|
||||
{
|
||||
if (m_ioLine.getMovementQty().compareTo(getQty()) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BigDecimal totalQty = DB.getSQLValueBD(get_TrxName(),
|
||||
"SELECT SUM(Qty) FROM M_RMALine rl JOIN M_RMA r ON (r.M_RMA_ID = rl.M_RMA_ID) WHERE M_InOutLine_ID = ? AND M_RMALine_ID != ? AND r.Processed = 'Y' AND r.DocStatus IN ('CO','CL')",
|
||||
getM_InOutLine_ID(), getM_RMALine_ID());
|
||||
|
@ -339,23 +390,25 @@ public class MRMALine extends X_M_RMALine
|
|||
totalQty = Env.ZERO;
|
||||
totalQty = totalQty.add(getQty());
|
||||
if (m_ioLine.getMovementQty().compareTo(totalQty) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean updateOrderTax(boolean oldTax) {
|
||||
private boolean updateOrderTax(boolean oldTax)
|
||||
{
|
||||
MRMATax tax = MRMATax.get (this, getPrecision(), oldTax, get_TrxName());
|
||||
if (tax != null) {
|
||||
if (tax != null)
|
||||
{
|
||||
if (!tax.calculateTaxFromLines())
|
||||
return false;
|
||||
if (tax.getTaxAmt().signum() != 0) {
|
||||
if (tax.getTaxAmt().signum() != 0)
|
||||
{
|
||||
if (!tax.save(get_TrxName()))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (!tax.is_new() && !tax.delete(false, get_TrxName()))
|
||||
return false;
|
||||
}
|
||||
|
@ -383,10 +436,7 @@ public class MRMALine extends X_M_RMALine
|
|||
protected boolean afterDelete(boolean success)
|
||||
{
|
||||
if (!success)
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
return success;
|
||||
return updateHeaderAmt();
|
||||
}
|
||||
|
||||
|
@ -449,31 +499,16 @@ public class MRMALine extends X_M_RMALine
|
|||
*/
|
||||
public int getC_UOM_ID()
|
||||
{
|
||||
if (m_ioLine == null) // Charge
|
||||
{
|
||||
if (m_ioLine == null && getC_Charge_ID() != 0) // Charge
|
||||
return 100; // Each
|
||||
else if (m_ioLine == null && getM_Product_ID() != 0)
|
||||
{
|
||||
MProduct product = getProduct();
|
||||
return product.getC_UOM_ID();
|
||||
}
|
||||
|
||||
return m_ioLine.getC_UOM_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Product
|
||||
* @return product if based on shipment line and 0 for charge based
|
||||
*/
|
||||
public int getM_Product_ID()
|
||||
{
|
||||
if (getC_Charge_ID() != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getM_Product_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Product
|
||||
* @return product or null
|
||||
|
@ -514,9 +549,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getC_Project_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_Project_ID();
|
||||
}
|
||||
|
||||
|
@ -527,9 +560,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getC_ProjectPhase_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_ProjectPhase_ID();
|
||||
}
|
||||
|
||||
|
@ -540,9 +571,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getC_ProjectTask_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_ProjectTask_ID();
|
||||
}
|
||||
|
||||
|
@ -553,9 +582,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getC_Activity_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_Activity_ID();
|
||||
}
|
||||
|
||||
|
@ -566,9 +593,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getC_Campaign_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getC_Campaign_ID();
|
||||
}
|
||||
|
||||
|
@ -579,9 +604,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getAD_OrgTrx_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getAD_OrgTrx_ID();
|
||||
}
|
||||
|
||||
|
@ -592,9 +615,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getUser1_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getUser1_ID();
|
||||
}
|
||||
|
||||
|
@ -605,9 +626,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getUser2_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getUser2_ID();
|
||||
}
|
||||
|
||||
|
@ -618,9 +637,7 @@ public class MRMALine extends X_M_RMALine
|
|||
public int getM_AttributeSetInstance_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_ioLine.getM_AttributeSetInstance_ID();
|
||||
}
|
||||
|
||||
|
@ -630,9 +647,14 @@ public class MRMALine extends X_M_RMALine
|
|||
*/
|
||||
public int getM_Locator_ID()
|
||||
{
|
||||
if (m_ioLine == null)
|
||||
{
|
||||
if (m_ioLine == null && getC_Charge_ID() != 0)
|
||||
return 0;
|
||||
else if (m_ioLine == null && getM_Product_ID() != 0)
|
||||
{
|
||||
MInOut shipment = getParent().getShipment();
|
||||
MWarehouse warehouse = new MWarehouse (getCtx(), shipment.getM_Warehouse_ID(), get_TrxName());
|
||||
MLocator locator = MLocator.getDefault(warehouse);
|
||||
return locator.getM_Locator_ID();
|
||||
}
|
||||
return m_ioLine.getM_Locator_ID();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20130118L;
|
||||
private static final long serialVersionUID = 20130121L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_RMALine (Properties ctx, int M_RMALine_ID, String trxName)
|
||||
|
@ -237,6 +237,34 @@ public class X_M_RMALine extends PO implements I_M_RMALine, I_Persistent
|
|||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.I_M_Product.Table_Name)
|
||||
.getPO(getM_Product_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Product.
|
||||
@param M_Product_ID
|
||||
Product, Service, Item
|
||||
*/
|
||||
public void setM_Product_ID (int M_Product_ID)
|
||||
{
|
||||
if (M_Product_ID < 1)
|
||||
set_Value (COLUMNNAME_M_Product_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
|
||||
}
|
||||
|
||||
/** Get Product.
|
||||
@return Product, Service, Item
|
||||
*/
|
||||
public int getM_Product_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_M_RMA getM_RMA() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_M_RMA)MTable.get(getCtx(), org.compiere.model.I_M_RMA.Table_Name)
|
||||
|
|
|
@ -70,12 +70,15 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
StringBuilder sqlStmt = new StringBuilder();
|
||||
|
||||
sqlStmt.append("SELECT iol.M_InOutLine_ID, iol.Line, ");
|
||||
sqlStmt.append("CASE WHEN iol.M_Product_ID IS NOT NULL THEN (Select p.Name from M_Product p where p.M_Product_ID = iol.M_Product_ID) END as ProductName, ");
|
||||
sqlStmt.append("COALESCE(p.Name, c.Name) AS ProductName, ");
|
||||
sqlStmt.append("iol.QtyEntered, ");
|
||||
sqlStmt.append("iol.movementQty, ");
|
||||
sqlStmt.append("CASE WHEN iol.M_AttributeSetInstance_ID IS NOT NULL THEN (SELECT SerNo FROM M_AttributeSetInstance asi where asi.M_AttributeSetInstance_ID=iol.M_AttributeSetInstance_ID) END as ASI ");
|
||||
sqlStmt.append("from M_InOutLine iol where M_InOut_ID=? ");
|
||||
sqlStmt.append("and iol.M_InOutLine_ID not in (select rmal.M_InOutLine_ID from M_RMALine rmal where rmal.M_RMA_ID=?)");
|
||||
sqlStmt.append("CASE WHEN iol.M_AttributeSetInstance_ID IS NOT NULL THEN (SELECT SerNo FROM M_AttributeSetInstance asi WHERE asi.M_AttributeSetInstance_ID=iol.M_AttributeSetInstance_ID) END as ASI ");
|
||||
sqlStmt.append("FROM M_InOutLine iol ");
|
||||
sqlStmt.append("LEFT JOIN M_Product p ON p.M_Product_ID = iol.M_Product_ID ");
|
||||
sqlStmt.append("LEFT JOIN C_Charge c ON c.C_Charge_ID = iol.C_Charge_ID ");
|
||||
sqlStmt.append("WHERE M_InOut_ID=? ");
|
||||
sqlStmt.append("AND iol.M_InOutLine_ID NOT IN (SELECT rmal.M_InOutLine_ID FROM M_RMALine rmal WHERE rmal.M_RMA_ID=?)");
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -273,7 +273,7 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
|
||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||
StringBuilder sqlStmt = new StringBuilder();
|
||||
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, iol.M_Product_ID, p.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
|
||||
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, p.M_Product_ID, COALESCE(p.Name, c.Name), uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
|
||||
sqlStmt.append("FROM M_RMALine rl INNER JOIN M_InOutLine iol ON rl.M_InOutLine_ID=iol.M_InOutLine_ID ");
|
||||
|
||||
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
||||
|
@ -286,9 +286,26 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
|
||||
}
|
||||
sqlStmt.append("LEFT OUTER JOIN M_Product p ON p.M_Product_ID=iol.M_Product_ID ");
|
||||
sqlStmt.append("LEFT OUTER JOIN C_Charge c ON c.C_Charge_ID=iol.C_Charge_ID ");
|
||||
sqlStmt.append("WHERE rl.M_RMA_ID=? ");
|
||||
sqlStmt.append("AND rl.M_INOUTLINE_ID IS NOT NULL");
|
||||
sqlStmt.append("AND rl.M_InOutLine_ID IS NOT NULL");
|
||||
|
||||
sqlStmt.append(" UNION ");
|
||||
|
||||
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, p.M_Product_ID, p.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
|
||||
sqlStmt.append("FROM M_RMALine rl INNER JOIN M_Product p ON p.M_Product_ID = rl.M_Product_ID ");
|
||||
if (Env.isBaseLanguage(Env.getCtx(), "C_UOM"))
|
||||
{
|
||||
sqlStmt.append("LEFT OUTER JOIN C_UOM uom ON (uom.C_UOM_ID=p.C_UOM_ID) ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlStmt.append("LEFT OUTER JOIN C_UOM_Trl uom ON (uom.C_UOM_ID=100 AND uom.AD_Language='");
|
||||
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
|
||||
}
|
||||
sqlStmt.append("WHERE rl.M_RMA_ID=? ");
|
||||
sqlStmt.append("AND rl.M_Product_ID IS NOT NULL AND rl.M_InOutLine_ID IS NULL");
|
||||
|
||||
sqlStmt.append(" UNION ");
|
||||
|
||||
sqlStmt.append("SELECT rl.M_RMALine_ID, rl.line, rl.Qty - rl.QtyDelivered, 0, c.Name, uom.C_UOM_ID, COALESCE(uom.UOMSymbol,uom.Name) ");
|
||||
|
@ -303,7 +320,7 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
sqlStmt.append(Env.getAD_Language(Env.getCtx())).append("') ");
|
||||
}
|
||||
sqlStmt.append("WHERE rl.M_RMA_ID=? ");
|
||||
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL");
|
||||
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL AND rl.M_InOutLine_ID IS NULL");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -312,6 +329,7 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
pstmt = DB.prepareStatement(sqlStmt.toString(), null);
|
||||
pstmt.setInt(1, M_RMA_ID);
|
||||
pstmt.setInt(2, M_RMA_ID);
|
||||
pstmt.setInt(3, M_RMA_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
|
|
Loading…
Reference in New Issue