diff --git a/migration/i5.1/oracle/201709181100_Ticket_1008477.sql b/migration/i5.1/oracle/201709181100_Ticket_1008477.sql
new file mode 100644
index 0000000000..999c740297
--- /dev/null
+++ b/migration/i5.1/oracle/201709181100_Ticket_1008477.sql
@@ -0,0 +1,11 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Sep 18, 2017 12:37:19 PM GMT+08:00
+-- 1008477 List on Position field in Lead window is blank even if there are position options configured.
+UPDATE AD_Val_Rule SET Code='((C_Job.IsEmployee=(SELECT IsEmployee FROM C_BPartner WHERE C_BPartner_ID=@C_BPartner_ID:0@)) OR (C_Job.IsEmployee=''N'' AND @C_BPartner_ID:0@=0))',Updated=TO_DATE('2017-09-18 12:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=243
+;
+
+SELECT register_migration_script('201709181100_Ticket_1008477.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql b/migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql
new file mode 100644
index 0000000000..8bb23e0e46
--- /dev/null
+++ b/migration/i5.1/oracle/201712141459_IDEMPIERE-3388.sql
@@ -0,0 +1,15 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3388
+-- Dec 14, 2017 2:58:05 PM CET
+UPDATE C_AcctSchema SET CostingMethod='A',Updated=TO_DATE('2017-12-14 14:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_AcctSchema_ID=101
+;
+
+-- Dec 14, 2017 2:58:14 PM CET
+UPDATE M_CostElement SET IsActive='N',Updated=TO_DATE('2017-12-14 14:58:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE M_CostElement_ID=104
+;
+
+SELECT register_migration_script('201712141459_IDEMPIERE-3388.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201712151351_MinorHelpFix.sql b/migration/i5.1/oracle/201712151351_MinorHelpFix.sql
new file mode 100644
index 0000000000..b84fff0d58
--- /dev/null
+++ b/migration/i5.1/oracle/201712151351_MinorHelpFix.sql
@@ -0,0 +1,16 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Fix help of form Merge Entities wrongly formatted breaking the wiki manual
+-- Dec 15, 2017 1:49:32 PM CET
+UPDATE AD_Form SET Help='Dangerous - Please are aware of what you are doing!
+All instances of the From entity (e.g. Customer A) are changed to the To entity (e.g. Customer B).
+The From entity (e.g. Customer A) is deleted.
+
There is NO undo nor trace ! Please do a backup first Please be aware that you may be changing history records (e.g. invoices, etc.) !
+
Side effects: Merging Products are likely to distort product costs; Merging Business Partners may result in incorrect open item balance. Check with support on remedies.
+
Restrictions: Accounting and Inventory conflicts are not resolved in this version.
',Updated=TO_DATE('2017-12-15 13:49:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=112
+;
+
+SELECT register_migration_script('201712151351_MinorHelpFix.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql b/migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql
new file mode 100644
index 0000000000..c3b53506ad
--- /dev/null
+++ b/migration/i5.1/oracle/201712161006_IDEMPIERE-1721.sql
@@ -0,0 +1,15 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-1721 Window Position, tab Remuneration, refers to a disabled window
+-- Dec 16, 2017 10:04:11 AM CET
+UPDATE AD_Window SET IsActive='Y', IsBetaFunctionality='N',Updated=TO_DATE('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=353
+;
+
+-- Dec 16, 2017 10:04:11 AM CET
+UPDATE AD_Menu SET Name='Remuneration', Description='Maintain Remuneration', IsActive='Y',Updated=TO_DATE('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=532
+;
+
+SELECT register_migration_script('201712161006_IDEMPIERE-1721.sql') FROM dual
+;
+
diff --git a/migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql b/migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql
new file mode 100644
index 0000000000..95d1d1923f
--- /dev/null
+++ b/migration/i5.1/oracle/201712161023_IDEMPIERE-3358.sql
@@ -0,0 +1,15 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- IDEMPIERE-3358 Dictionary fixes
+-- Dec 16, 2017 10:22:29 AM CET
+UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-12-16 10:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202750
+;
+
+-- Dec 16, 2017 10:22:42 AM CET
+UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-12-16 10:22:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202776
+;
+
+SELECT register_migration_script('201712161023_IDEMPIERE-3358.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201709181100_Ticket_1008477.sql b/migration/i5.1/postgresql/201709181100_Ticket_1008477.sql
new file mode 100644
index 0000000000..f015d8518c
--- /dev/null
+++ b/migration/i5.1/postgresql/201709181100_Ticket_1008477.sql
@@ -0,0 +1,8 @@
+-- Sep 18, 2017 12:37:19 PM GMT+08:00
+-- 1008477 List on Position field in Lead window is blank even if there are position options configured.
+UPDATE AD_Val_Rule SET Code='((C_Job.IsEmployee=(SELECT IsEmployee FROM C_BPartner WHERE C_BPartner_ID=@C_BPartner_ID:0@)) OR (C_Job.IsEmployee=''N'' AND @C_BPartner_ID:0@=0))',Updated=TO_TIMESTAMP('2017-09-18 12:37:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=243
+;
+
+SELECT register_migration_script('201709181100_Ticket_1008477.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql b/migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql
new file mode 100644
index 0000000000..cb5a300614
--- /dev/null
+++ b/migration/i5.1/postgresql/201712141459_IDEMPIERE-3388.sql
@@ -0,0 +1,12 @@
+-- IDEMPIERE-3388
+-- Dec 14, 2017 2:58:05 PM CET
+UPDATE C_AcctSchema SET CostingMethod='A',Updated=TO_TIMESTAMP('2017-12-14 14:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_AcctSchema_ID=101
+;
+
+-- Dec 14, 2017 2:58:14 PM CET
+UPDATE M_CostElement SET IsActive='N',Updated=TO_TIMESTAMP('2017-12-14 14:58:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE M_CostElement_ID=104
+;
+
+SELECT register_migration_script('201712141459_IDEMPIERE-3388.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201712151351_MinorHelpFix.sql b/migration/i5.1/postgresql/201712151351_MinorHelpFix.sql
new file mode 100644
index 0000000000..9604328067
--- /dev/null
+++ b/migration/i5.1/postgresql/201712151351_MinorHelpFix.sql
@@ -0,0 +1,13 @@
+-- Fix help of form Merge Entities wrongly formatted breaking the wiki manual
+-- Dec 15, 2017 1:49:32 PM CET
+UPDATE AD_Form SET Help='Dangerous - Please are aware of what you are doing!
+All instances of the From entity (e.g. Customer A) are changed to the To entity (e.g. Customer B).
+The From entity (e.g. Customer A) is deleted.
+
There is NO undo nor trace ! Please do a backup first Please be aware that you may be changing history records (e.g. invoices, etc.) !
+
Side effects: Merging Products are likely to distort product costs; Merging Business Partners may result in incorrect open item balance. Check with support on remedies.
+
Restrictions: Accounting and Inventory conflicts are not resolved in this version.
',Updated=TO_TIMESTAMP('2017-12-15 13:49:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=112
+;
+
+SELECT register_migration_script('201712151351_MinorHelpFix.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql b/migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql
new file mode 100644
index 0000000000..a618574d99
--- /dev/null
+++ b/migration/i5.1/postgresql/201712161006_IDEMPIERE-1721.sql
@@ -0,0 +1,12 @@
+-- IDEMPIERE-1721 Window Position, tab Remuneration, refers to a disabled window
+-- Dec 16, 2017 10:04:11 AM CET
+UPDATE AD_Window SET IsActive='Y', IsBetaFunctionality='N',Updated=TO_TIMESTAMP('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=353
+;
+
+-- Dec 16, 2017 10:04:11 AM CET
+UPDATE AD_Menu SET Name='Remuneration', Description='Maintain Remuneration', IsActive='Y',Updated=TO_TIMESTAMP('2017-12-16 10:04:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=532
+;
+
+SELECT register_migration_script('201712161006_IDEMPIERE-1721.sql') FROM dual
+;
+
diff --git a/migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql b/migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql
new file mode 100644
index 0000000000..0a48b6d65a
--- /dev/null
+++ b/migration/i5.1/postgresql/201712161023_IDEMPIERE-3358.sql
@@ -0,0 +1,12 @@
+-- IDEMPIERE-3358 Dictionary fixes
+-- Dec 16, 2017 10:22:29 AM CET
+UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-12-16 10:22:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202750
+;
+
+-- Dec 16, 2017 10:22:42 AM CET
+UPDATE AD_Field SET IsReadOnly='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-12-16 10:22:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202776
+;
+
+SELECT register_migration_script('201712161023_IDEMPIERE-3358.sql') FROM dual
+;
+
diff --git a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java
index bdadacea6a..c14c3bb203 100644
--- a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java
+++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java
@@ -20,6 +20,8 @@ package org.adempiere.model;
import java.math.BigDecimal;
import java.util.Properties;
+import org.adempiere.base.Core;
+import org.adempiere.base.IProductPricing;
import org.compiere.model.CalloutEngine;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
@@ -30,7 +32,6 @@ import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
-import org.compiere.model.MProductPricing;
import org.compiere.model.MRMA;
import org.compiere.model.MRMALine;
import org.compiere.model.Query;
@@ -146,7 +147,8 @@ public class CalloutRMA extends CalloutEngine {
return "";
MRMA rma = new MRMA(ctx, M_RMA_ID, null);
- MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null);
int taxId = 0;
int precision = 0;
diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java
index e8b3f4f666..8772db6a42 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java
@@ -24,6 +24,9 @@ import java.sql.Timestamp;
import java.util.Properties;
import java.util.logging.Level;
+import org.adempiere.base.Core;
+import org.adempiere.base.IProductPricing;
+import org.adempiere.model.GridTabWrapper;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@@ -87,9 +90,9 @@ public class CalloutInvoice extends CalloutEngine
Env.setContext(ctx, WindowNo, "DocBaseType", s);
// AP Check & AR Credit Memo
if (s.startsWith("AP"))
- mTab.setValue("PaymentRule", "S"); // Check
+ mTab.setValue("PaymentRule", X_C_Invoice.PAYMENTRULE_Check);
else if (s.endsWith("C"))
- mTab.setValue("PaymentRule", "P"); // OnCredit
+ mTab.setValue("PaymentRule", X_C_Invoice.PAYMENTRULE_OnCredit);
}
}
catch (SQLException e)
@@ -183,13 +186,9 @@ public class CalloutInvoice extends CalloutEngine
// PaymentRule
String s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO");
if (s != null && s.length() != 0)
- {
- if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term
- s = "P";
- else if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx
- s = "P"; // Payment Term
mTab.setValue("PaymentRule", s);
- }
+ if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term
+ s = X_C_Invoice.PAYMENTRULE_OnCredit;
// Payment Term
ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID"));
if (!rs.wasNull())
@@ -324,10 +323,9 @@ public class CalloutInvoice extends CalloutEngine
mTab.setValue("M_AttributeSetInstance_ID", null);
/***** Price Calculation see also qty ****/
- boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
- int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
- BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced");
- MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setInvoiceLine(invoiceLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
@@ -350,8 +348,6 @@ public class CalloutInvoice extends CalloutEngine
}
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
- Timestamp date = Env.getContextAsDate(ctx, WindowNo, "DateInvoiced");
- pp.setPriceDate(date);
//
mTab.setValue("PriceList", pp.getPriceList());
mTab.setValue("PriceLimit", pp.getPriceLimit());
@@ -557,19 +553,18 @@ public class CalloutInvoice extends CalloutEngine
|| mField.getColumnName().equals("M_Product_ID"))
&& !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema")))
{
- int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
if (mField.getColumnName().equals("QtyEntered"))
QtyInvoiced = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered);
if (QtyInvoiced == null)
QtyInvoiced = QtyEntered;
- boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
- MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null);
+ I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setInvoiceLine(invoiceLine, null);
pp.setM_PriceList_ID(M_PriceList_ID);
+ pp.setQty(QtyInvoiced);
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
- Timestamp date = (Timestamp)mTab.getValue("DateInvoiced");
- pp.setPriceDate(date);
//
PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, pp.getPriceStd());
@@ -842,10 +837,9 @@ public class CalloutInvoice extends CalloutEngine
}
/***** Price Calculation see also qty ****/
- int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
- BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
- boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
- MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ I_C_InvoiceLine invoiceLine = GridTabWrapper.create(mTab, I_C_InvoiceLine.class);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setInvoiceLine(invoiceLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
@@ -866,7 +860,6 @@ public class CalloutInvoice extends CalloutEngine
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID );
}
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
- pp.setPriceDate(orderDate);
//
Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N");
Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N");
diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java
index 08414017be..236f4143c5 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoiceBatch.java
@@ -105,13 +105,9 @@ public class CalloutInvoiceBatch extends CalloutEngine
// PaymentRule
String s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO");
if (s != null && s.length() != 0)
- {
- if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term
- s = "P";
- else if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx
- s = "P"; // Payment Term
- // mTab.setValue("PaymentRule", s);
- }
+ mTab.setValue("PaymentRule", s);
+ if (Env.getContext(ctx, WindowNo, "DocBaseType").endsWith("C")) // Credits are Payment Term
+ s = X_C_Invoice.PAYMENTRULE_OnCredit;
// Payment Term
Integer ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID"));
if (!rs.wasNull())
diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
index 7cc24c63aa..36ef208b32 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java
@@ -24,6 +24,9 @@ import java.sql.Timestamp;
import java.util.Properties;
import java.util.logging.Level;
+import org.adempiere.base.Core;
+import org.adempiere.base.IProductPricing;
+import org.adempiere.model.GridTabWrapper;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@@ -181,13 +184,7 @@ public class CalloutOrder extends CalloutEngine
// PaymentRule
String s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO");
if (s != null && s.length() != 0)
- {
- if (IsSOTrx && (s.equals("B") || s.equals("S") || s.equals("U"))) // No Cash/Check/Transfer for SO_Trx
- s = "P"; // Payment Term
- if (!IsSOTrx && (s.equals("B"))) // No Cash for PO_Trx
- s = "P"; // Payment Term
mTab.setValue("PaymentRule", s);
- }
// Payment Term
Integer ii =new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID"));
if (!rs.wasNull())
@@ -401,13 +398,7 @@ public class CalloutOrder extends CalloutEngine
// PaymentRule
s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO");
if (s != null && s.length() != 0)
- {
- if (s.equals("B")) // No Cache in Non POS
- s = "P";
- if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx
- s = "P"; // Payment Term
mTab.setValue("PaymentRule", s);
- }
// Payment Term
ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID"));
if (!rs.wasNull())
@@ -589,13 +580,7 @@ public class CalloutOrder extends CalloutEngine
// PaymentRule
s = rs.getString(IsSOTrx ? "PaymentRule" : "PaymentRulePO");
if (s != null && s.length() != 0)
- {
- if (s.equals("B")) // No Cache in Non POS
- s = "P";
- if (IsSOTrx && (s.equals("S") || s.equals("U"))) // No Check/Transfer for SO_Trx
- s = "P"; // Payment Term
mTab.setValue("PaymentRule", s);
- }
// Payment Term
ii = new Integer(rs.getInt(IsSOTrx ? "C_PaymentTerm_ID" : "PO_PaymentTerm_ID"));
if (!rs.wasNull())
@@ -797,10 +782,9 @@ public class CalloutOrder extends CalloutEngine
mTab.setValue("M_AttributeSetInstance_ID", null);
/***** Price Calculation see also qty ****/
- int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
- BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
- boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
- MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setOrderLine(orderLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
@@ -821,7 +805,6 @@ public class CalloutOrder extends CalloutEngine
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID );
}
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
- pp.setPriceDate(orderDate);
//
mTab.setValue("PriceList", pp.getPriceList());
mTab.setValue("PriceLimit", pp.getPriceLimit());
@@ -1089,19 +1072,18 @@ public class CalloutOrder extends CalloutEngine
|| mField.getColumnName().equals("M_Product_ID"))
&& !"N".equals(Env.getContext(ctx, WindowNo, "DiscountSchema")))
{
- int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
if (mField.getColumnName().equals("QtyEntered"))
QtyOrdered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, QtyEntered);
if (QtyOrdered == null)
QtyOrdered = QtyEntered;
- boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
- MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null);
+ I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setOrderLine(orderLine, null);
+ pp.setQty(QtyOrdered);
pp.setM_PriceList_ID(M_PriceList_ID);
int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID");
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
- Timestamp date = (Timestamp)mTab.getValue("DateOrdered");
- pp.setPriceDate(date);
//
PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID,
C_UOM_To_ID, pp.getPriceStd());
@@ -1422,10 +1404,9 @@ public class CalloutOrder extends CalloutEngine
}
/***** Price Calculation see also qty ****/
- int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID");
- BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered");
- boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y");
- MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null);
+ I_C_OrderLine orderLine = GridTabWrapper.create(mTab, I_C_OrderLine.class);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setOrderLine(orderLine, null);
//
int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID");
pp.setM_PriceList_ID(M_PriceList_ID);
@@ -1446,7 +1427,6 @@ public class CalloutOrder extends CalloutEngine
Env.setContext(ctx, WindowNo, "M_PriceList_Version_ID", M_PriceList_Version_ID );
}
pp.setM_PriceList_Version_ID(M_PriceList_Version_ID);
- pp.setPriceDate(orderDate);
//
Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N");
Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N");
diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java
index 5391757bda..c219a54c8d 100644
--- a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java
+++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java
@@ -21,12 +21,13 @@ import java.sql.Timestamp;
import java.util.Properties;
import java.util.logging.Level;
+import org.adempiere.base.Core;
+import org.adempiere.base.IProductPricing;
import org.adempiere.model.GridTabWrapper;
import org.compiere.util.Env;
/**
* Requisition Callouts
- *
* @author Jorg Janke
* @version $Id: CalloutRequisition.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
*/
@@ -47,7 +48,7 @@ public class CalloutRequisition extends CalloutEngine
Integer M_Product_ID = (Integer)value;
if (M_Product_ID == null || M_Product_ID.intValue() == 0)
return "";
- final I_M_Requisition req = GridTabWrapper.create(mTab, I_M_Requisition.class);
+ final I_M_Requisition req = GridTabWrapper.create(mTab.getParentTab(), I_M_Requisition.class);
final I_M_RequisitionLine line = GridTabWrapper.create(mTab, I_M_RequisitionLine.class);
setPrice(ctx, WindowNo, req, line);
MProduct product = MProduct.get(ctx, M_Product_ID);
@@ -71,7 +72,7 @@ public class CalloutRequisition extends CalloutEngine
if (isCalloutActive() || value == null)
return "";
- final I_M_Requisition req = GridTabWrapper.create(mTab, I_M_Requisition.class);
+ final I_M_Requisition req = GridTabWrapper.create(mTab.getParentTab(), I_M_Requisition.class);
final I_M_RequisitionLine line = GridTabWrapper.create(mTab, I_M_RequisitionLine.class);
// Qty changed - recalc price
if (mField.getColumnName().equals(I_M_RequisitionLine.COLUMNNAME_Qty)
@@ -100,7 +101,8 @@ public class CalloutRequisition extends CalloutEngine
int C_BPartner_ID = line.getC_BPartner_ID();
BigDecimal Qty = line.getQty();
boolean isSOTrx = false;
- MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null);
+ IProductPricing pp = Core.getProductPricing();
+ pp.setInitialValues(line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null);
//
int M_PriceList_ID = req.getM_PriceList_ID();
pp.setM_PriceList_ID(M_PriceList_ID);
diff --git a/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java b/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java
index f8095c47c5..cbe8923926 100644
--- a/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java
+++ b/org.adempiere.base.process/src/org/adempiere/base/process/AcceptCtxHelpSuggestion.java
@@ -127,7 +127,7 @@ public class AcceptCtxHelpSuggestion extends SvrProcess {
} else {
StringBuilder insert = new StringBuilder("Insert Into AD_CtxHelpMsg_Trl (AD_Client_ID, AD_Org_ID, AD_CtxHelpMsg_ID, IsActive, IsTranslated, AD_Language, MsgText,");
insert.append("Created, CreatedBy, Updated, UpdatedBy, AD_CtxHelpMsg_Trl_UU)")
- .append(" Values (?, ?, ?, 'Y', 'N', ?, ?, now(), ?, now(), ?, generate_uuid()) ");
+ .append(" Values (?, ?, ?, 'Y', 'N', ?, ?, sysdate, ?, sysdate, ?, generate_uuid()) ");
List