Fixes issue 39036: Wrong Current Unit Cost for production products
authorMark <markmm82@gmail.com>
Wed, 08 Aug 2018 13:12:19 -0400
changeset 34499 e0772da8f954
parent 34498 0956448be546
child 34500 eed070ea968c
Fixes issue 39036: Wrong Current Unit Cost for production products
in Inventory Amount Update Lines

To avoid confusion to users if the selected product is marked as production then
the warehouse dimension will be hidden as this dimension is not taken into account
in the process when the Current Inventory Amount and On hand qty values are calculated
for production products.

This solution includes:
- Created a new auxiliary input related to the Inventory Amount Update Lines tab to store
the value if the selected product is a production product or not.
- Was modified the Display Logic of the Warehouse field to take into account if the selected
product is a production product or not. In case it is the field is hidden, in other case it is shown.
- Was modified the SL_InvAmtUpd_ProductRefDate.java callout to set an empy warehouse
when the product is marked as production.
src-db/database/sourcedata/AD_AUXILIARINPUT.xml
src-db/database/sourcedata/AD_FIELD.xml
src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_ProductRefDate.java
--- a/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Wed Aug 08 11:03:32 2018 +0000
+++ b/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Wed Aug 08 13:12:19 2018 -0400
@@ -1788,6 +1788,17 @@
 <!--3EE2062DF62F4E948FD9786D21AF2D0C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--3EE2062DF62F4E948FD9786D21AF2D0C--></AD_AUXILIARINPUT>
 
+<!--3FA6F8EE86B547E48924388C6A74D646--><AD_AUXILIARINPUT>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <AD_AUXILIARINPUT_ID><![CDATA[3FA6F8EE86B547E48924388C6A74D646]]></AD_AUXILIARINPUT_ID>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <AD_TAB_ID><![CDATA[BD883B355F1B448A9CB6BD472600EB2D]]></AD_TAB_ID>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <NAME><![CDATA[isProduction]]></NAME>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <CODE><![CDATA[@SQL=select production from m_product where m_product_id = @M_PRODUCT_ID@]]></CODE>
+<!--3FA6F8EE86B547E48924388C6A74D646-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--3FA6F8EE86B547E48924388C6A74D646--></AD_AUXILIARINPUT>
+
 <!--40289C202E523822012E525106E70036--><AD_AUXILIARINPUT>
 <!--40289C202E523822012E525106E70036-->  <AD_AUXILIARINPUT_ID><![CDATA[40289C202E523822012E525106E70036]]></AD_AUXILIARINPUT_ID>
 <!--40289C202E523822012E525106E70036-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Wed Aug 08 11:03:32 2018 +0000
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Aug 08 13:12:19 2018 -0400
@@ -286509,7 +286509,7 @@
 <!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <AD_COLUMN_ID><![CDATA[24E857B14059424FA2F311C9F3AB7E8F]]></AD_COLUMN_ID>
 <!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
 <!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <DISPLAYLOGIC><![CDATA[@isWarehouseDimension@ = 'Y']]></DISPLAYLOGIC>
+<!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <DISPLAYLOGIC><![CDATA[@isWarehouseDimension@ = 'Y' & @isProduction@!'Y']]></DISPLAYLOGIC>
 <!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--BC2831B59A584C64A6BCEE7D5D1DA7D1-->  <SEQNO><![CDATA[50]]></SEQNO>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_ProductRefDate.java	Wed Aug 08 11:03:32 2018 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_ProductRefDate.java	Wed Aug 08 13:12:19 2018 -0400
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014-2017 Openbravo SLU
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -62,8 +62,8 @@
       SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
 
       referenceDate = outputFormat.parse(info.getStringParameter("inpreferencedate", null));
-
-      if (StringUtils.equals(isWarehouseDimension, "N")) {
+      boolean isProductionProduct = product != null && product.isProduction();
+      if (StringUtils.equals(isWarehouseDimension, "N") || isProductionProduct) {
         warehouseId = null;
         info.addResult("inpmWarehouseId", "");
       }