Fixes issue 30017: Landed Cost must not be applied to negative receipt lines
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Fri, 29 May 2015 09:52:37 +0200
changeset 26837 eef37b346fe4
parent 26836 099550fa4baa
child 26838 56776f691f4b
Fixes issue 30017: Landed Cost must not be applied to negative receipt lines

Goods Receipt selector in Landed Cost window - Receipt tab, will not show receipts which does not have any positive line.
Goods Receipt Line selector in Landed Cost window - Receipt tab, will not show negative receipts lines.
Landed Cost process will not consider negative receipt lines to distribute the amount of the landed cost.
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_REFERENCE.xml
src-db/database/sourcedata/OBUISEL_SELECTOR.xml
src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml
src/org/openbravo/costing/LandedCostDistributionByAmount.java
src/org/openbravo/costing/LandedCostProcess.java
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed May 27 16:27:00 2015 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Fri May 29 09:52:37 2015 +0200
@@ -222222,7 +222222,7 @@
 <!--00568254CB928733E050007F01000513-->  <COLUMNNAME><![CDATA[M_Inoutline_ID]]></COLUMNNAME>
 <!--00568254CB928733E050007F01000513-->  <AD_TABLE_ID><![CDATA[FC90AED3E5ED45CAB28A1FF2D571FB99]]></AD_TABLE_ID>
 <!--00568254CB928733E050007F01000513-->  <AD_REFERENCE_ID><![CDATA[95E2A8B50A254B2AAE6774B8C2F28120]]></AD_REFERENCE_ID>
-<!--00568254CB928733E050007F01000513-->  <AD_REFERENCE_VALUE_ID><![CDATA[224C53E343404771A44494C2AD51DAF3]]></AD_REFERENCE_VALUE_ID>
+<!--00568254CB928733E050007F01000513-->  <AD_REFERENCE_VALUE_ID><![CDATA[1A431A28EC2E48BF990DFA1C12C962B3]]></AD_REFERENCE_VALUE_ID>
 <!--00568254CB928733E050007F01000513-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
 <!--00568254CB928733E050007F01000513-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--00568254CB928733E050007F01000513-->  <ISPARENT><![CDATA[N]]></ISPARENT>
--- a/src-db/database/sourcedata/AD_REFERENCE.xml	Wed May 27 16:27:00 2015 +0200
+++ b/src-db/database/sourcedata/AD_REFERENCE.xml	Fri May 29 09:52:37 2015 +0200
@@ -4423,6 +4423,18 @@
 <!--1852D69AB3FD453F8F031813501B26F0-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--1852D69AB3FD453F8F031813501B26F0--></AD_REFERENCE>
 
+<!--1A431A28EC2E48BF990DFA1C12C962B3--><AD_REFERENCE>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <AD_REFERENCE_ID><![CDATA[1A431A28EC2E48BF990DFA1C12C962B3]]></AD_REFERENCE_ID>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <NAME><![CDATA[M_InOutLine Receipts]]></NAME>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <PARENTREFERENCE_ID><![CDATA[95E2A8B50A254B2AAE6774B8C2F28120]]></PARENTREFERENCE_ID>
+<!--1A431A28EC2E48BF990DFA1C12C962B3-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--1A431A28EC2E48BF990DFA1C12C962B3--></AD_REFERENCE>
+
 <!--1CC9902786384893A551465428468C2A--><AD_REFERENCE>
 <!--1CC9902786384893A551465428468C2A-->  <AD_REFERENCE_ID><![CDATA[1CC9902786384893A551465428468C2A]]></AD_REFERENCE_ID>
 <!--1CC9902786384893A551465428468C2A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Wed May 27 16:27:00 2015 +0200
+++ b/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Fri May 29 09:52:37 2015 +0200
@@ -450,6 +450,22 @@
 <!--814758DD755642E9BF38BD2E5AD713EC-->  <CUSTOM_QUERY><![CDATA[N]]></CUSTOM_QUERY>
 <!--814758DD755642E9BF38BD2E5AD713EC--></OBUISEL_SELECTOR>
 
+<!--8190C8CCE42C41B2AF573D075BF90F1B--><OBUISEL_SELECTOR>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <NAME><![CDATA[M_InOutLine Receipts]]></NAME>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <AD_REFERENCE_ID><![CDATA[1A431A28EC2E48BF990DFA1C12C962B3]]></AD_REFERENCE_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <AD_TABLE_ID><![CDATA[320]]></AD_TABLE_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <WHERECLAUSE><![CDATA[e.shipmentReceipt.id = @inpmInoutId@ AND e.movementQuantity >= 0]]></WHERECLAUSE>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[substring]]></SUGGESTIONTEXTMATCHSTYLE>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <POPUPTEXTMATCHSTYLE><![CDATA[substring]]></POPUPTEXTMATCHSTYLE>
+<!--8190C8CCE42C41B2AF573D075BF90F1B-->  <CUSTOM_QUERY><![CDATA[N]]></CUSTOM_QUERY>
+<!--8190C8CCE42C41B2AF573D075BF90F1B--></OBUISEL_SELECTOR>
+
 <!--862F54CB1B074513BD791C6789F4AA42--><OBUISEL_SELECTOR>
 <!--862F54CB1B074513BD791C6789F4AA42-->  <OBUISEL_SELECTOR_ID><![CDATA[862F54CB1B074513BD791C6789F4AA42]]></OBUISEL_SELECTOR_ID>
 <!--862F54CB1B074513BD791C6789F4AA42-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -988,7 +1004,7 @@
 <!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <NAME><![CDATA[Receipts]]></NAME>
 <!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <AD_REFERENCE_ID><![CDATA[E68CCF4495A34ED7902293A930386B93]]></AD_REFERENCE_ID>
 <!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <AD_TABLE_ID><![CDATA[319]]></AD_TABLE_ID>
-<!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <WHERECLAUSE><![CDATA[e.salesTransaction = false AND e.documentStatus = 'CO']]></WHERECLAUSE>
+<!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <WHERECLAUSE><![CDATA[e.salesTransaction = false AND e.documentStatus = 'CO' AND exists ( select 1 from MaterialMgmtShipmentInOutLine m where m.shipmentReceipt.id=e.id and m.movementQuantity >= 0 )]]></WHERECLAUSE>
 <!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
 <!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--F3CDEE79343F4746A2FEE8C60EBEC0BF-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[startsWith]]></SUGGESTIONTEXTMATCHSTYLE>
--- a/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Wed May 27 16:27:00 2015 +0200
+++ b/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Fri May 29 09:52:37 2015 +0200
@@ -1342,6 +1342,28 @@
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A--></OBUISEL_SELECTOR_FIELD>
 
+<!--4EF51CFED3194C2CAF394CB3E8C9989B--><OBUISEL_SELECTOR_FIELD>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[4EF51CFED3194C2CAF394CB3E8C9989B]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <AD_COLUMN_ID><![CDATA[3795]]></AD_COLUMN_ID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <NAME><![CDATA[Business Partner]]></NAME>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <DESCRIPTION><![CDATA[Anyone who takes part in daily business operations by acting as a customer, employee, etc.]]></DESCRIPTION>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <HELP><![CDATA[A Business Partner is anyone with whom you transact.  This can include a customer, vendor, employee or any combination of these.]]></HELP>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <PROPERTY><![CDATA[shipmentReceipt.businessPartner]]></PROPERTY>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <SORT><![CDATA[Y]]></SORT>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <SEARCHINSUGGESTIONBOX><![CDATA[N]]></SEARCHINSUGGESTIONBOX>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <SORTNO><![CDATA[30]]></SORTNO>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--4EF51CFED3194C2CAF394CB3E8C9989B--></OBUISEL_SELECTOR_FIELD>
+
 <!--5044C81844C841AB9B123DE30591D671--><OBUISEL_SELECTOR_FIELD>
 <!--5044C81844C841AB9B123DE30591D671-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[5044C81844C841AB9B123DE30591D671]]></OBUISEL_SELECTOR_FIELD_ID>
 <!--5044C81844C841AB9B123DE30591D671-->  <OBUISEL_SELECTOR_ID><![CDATA[D47A3616483E46C18A09794B9B276B37]]></OBUISEL_SELECTOR_ID>
@@ -1364,6 +1386,28 @@
 <!--5044C81844C841AB9B123DE30591D671-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--5044C81844C841AB9B123DE30591D671--></OBUISEL_SELECTOR_FIELD>
 
+<!--52D36264D17D4EE193C59B61478BC467--><OBUISEL_SELECTOR_FIELD>
+<!--52D36264D17D4EE193C59B61478BC467-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[52D36264D17D4EE193C59B61478BC467]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <AD_COLUMN_ID><![CDATA[3539]]></AD_COLUMN_ID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <NAME><![CDATA[Product]]></NAME>
+<!--52D36264D17D4EE193C59B61478BC467-->  <DESCRIPTION><![CDATA[An item produced by a process.]]></DESCRIPTION>
+<!--52D36264D17D4EE193C59B61478BC467-->  <HELP><![CDATA[Identifies an item which is either purchased or sold in this organization.]]></HELP>
+<!--52D36264D17D4EE193C59B61478BC467-->  <PROPERTY><![CDATA[product]]></PROPERTY>
+<!--52D36264D17D4EE193C59B61478BC467-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--52D36264D17D4EE193C59B61478BC467-->  <SORT><![CDATA[Y]]></SORT>
+<!--52D36264D17D4EE193C59B61478BC467-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--52D36264D17D4EE193C59B61478BC467-->  <SEARCHINSUGGESTIONBOX><![CDATA[N]]></SEARCHINSUGGESTIONBOX>
+<!--52D36264D17D4EE193C59B61478BC467-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--52D36264D17D4EE193C59B61478BC467-->  <SORTNO><![CDATA[50]]></SORTNO>
+<!--52D36264D17D4EE193C59B61478BC467-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--52D36264D17D4EE193C59B61478BC467-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--52D36264D17D4EE193C59B61478BC467-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--52D36264D17D4EE193C59B61478BC467--></OBUISEL_SELECTOR_FIELD>
+
 <!--541F7FD2135848ED854ED1327A06A679--><OBUISEL_SELECTOR_FIELD>
 <!--541F7FD2135848ED854ED1327A06A679-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[541F7FD2135848ED854ED1327A06A679]]></OBUISEL_SELECTOR_FIELD_ID>
 <!--541F7FD2135848ED854ED1327A06A679-->  <OBUISEL_SELECTOR_ID><![CDATA[32CFC9EB6DD04FACA7452C20C39116F0]]></OBUISEL_SELECTOR_ID>
@@ -3013,6 +3057,28 @@
 <!--B759B8BC264044D1A93CD79594A72F38-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--B759B8BC264044D1A93CD79594A72F38--></OBUISEL_SELECTOR_FIELD>
 
+<!--B7C53AA69D3248859079B3419EB733CC--><OBUISEL_SELECTOR_FIELD>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[B7C53AA69D3248859079B3419EB733CC]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <AD_COLUMN_ID><![CDATA[3798]]></AD_COLUMN_ID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <NAME><![CDATA[Warehouse]]></NAME>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <DESCRIPTION><![CDATA[The location where products arrive to or are sent from.]]></DESCRIPTION>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <HELP><![CDATA[The Warehouse identifies a unique Warehouse where products are stored or Services are provided.]]></HELP>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <PROPERTY><![CDATA[shipmentReceipt.warehouse]]></PROPERTY>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <SORT><![CDATA[Y]]></SORT>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <SEARCHINSUGGESTIONBOX><![CDATA[N]]></SEARCHINSUGGESTIONBOX>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <SORTNO><![CDATA[10]]></SORTNO>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--B7C53AA69D3248859079B3419EB733CC-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--B7C53AA69D3248859079B3419EB733CC--></OBUISEL_SELECTOR_FIELD>
+
 <!--BB033289258248078B1F36B148D04387--><OBUISEL_SELECTOR_FIELD>
 <!--BB033289258248078B1F36B148D04387-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[BB033289258248078B1F36B148D04387]]></OBUISEL_SELECTOR_FIELD_ID>
 <!--BB033289258248078B1F36B148D04387-->  <OBUISEL_SELECTOR_ID><![CDATA[4C8BC3E8E56441F4B8C98C684A0C9212]]></OBUISEL_SELECTOR_ID>
@@ -3188,6 +3254,28 @@
 <!--C3F5DD6F4E964FF090ACF187960C4CAD-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--C3F5DD6F4E964FF090ACF187960C4CAD--></OBUISEL_SELECTOR_FIELD>
 
+<!--C420F12B0A74419397162106AE797C80--><OBUISEL_SELECTOR_FIELD>
+<!--C420F12B0A74419397162106AE797C80-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[C420F12B0A74419397162106AE797C80]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--C420F12B0A74419397162106AE797C80-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--C420F12B0A74419397162106AE797C80-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C420F12B0A74419397162106AE797C80-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C420F12B0A74419397162106AE797C80-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--C420F12B0A74419397162106AE797C80-->  <AD_COLUMN_ID><![CDATA[3517]]></AD_COLUMN_ID>
+<!--C420F12B0A74419397162106AE797C80-->  <NAME><![CDATA[Movement Date]]></NAME>
+<!--C420F12B0A74419397162106AE797C80-->  <DESCRIPTION><![CDATA[The date that a certain item is moved from one location to another.]]></DESCRIPTION>
+<!--C420F12B0A74419397162106AE797C80-->  <HELP><![CDATA[The Movement Date indicates the date that a product moved in or out of inventory.  This is the result of a shipment, receipt or inventory movement.]]></HELP>
+<!--C420F12B0A74419397162106AE797C80-->  <PROPERTY><![CDATA[shipmentReceipt.movementDate]]></PROPERTY>
+<!--C420F12B0A74419397162106AE797C80-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--C420F12B0A74419397162106AE797C80-->  <SORT><![CDATA[Y]]></SORT>
+<!--C420F12B0A74419397162106AE797C80-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--C420F12B0A74419397162106AE797C80-->  <SEARCHINSUGGESTIONBOX><![CDATA[N]]></SEARCHINSUGGESTIONBOX>
+<!--C420F12B0A74419397162106AE797C80-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--C420F12B0A74419397162106AE797C80-->  <SORTNO><![CDATA[40]]></SORTNO>
+<!--C420F12B0A74419397162106AE797C80-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C420F12B0A74419397162106AE797C80-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--C420F12B0A74419397162106AE797C80-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--C420F12B0A74419397162106AE797C80--></OBUISEL_SELECTOR_FIELD>
+
 <!--C4D04905498A4966976DA9E33E57CAEB--><OBUISEL_SELECTOR_FIELD>
 <!--C4D04905498A4966976DA9E33E57CAEB-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[C4D04905498A4966976DA9E33E57CAEB]]></OBUISEL_SELECTOR_FIELD_ID>
 <!--C4D04905498A4966976DA9E33E57CAEB-->  <OBUISEL_SELECTOR_ID><![CDATA[D60F1A02D8D54D55BE825659A2879262]]></OBUISEL_SELECTOR_ID>
@@ -3426,6 +3514,28 @@
 <!--D28E1E1D317844B896947BBD5DDD902A-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--D28E1E1D317844B896947BBD5DDD902A--></OBUISEL_SELECTOR_FIELD>
 
+<!--D2FC05CE951E496CA63117EDD3B92995--><OBUISEL_SELECTOR_FIELD>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[D2FC05CE951E496CA63117EDD3B92995]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <AD_COLUMN_ID><![CDATA[3540]]></AD_COLUMN_ID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <NAME><![CDATA[Movement Quantity]]></NAME>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <DESCRIPTION><![CDATA[The number of items being moved from one location to another.]]></DESCRIPTION>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <HELP><![CDATA[The Movement Quantity indicates the quantity of a product that has been moved.]]></HELP>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <PROPERTY><![CDATA[movementQuantity]]></PROPERTY>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <SORT><![CDATA[Y]]></SORT>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <SEARCHINSUGGESTIONBOX><![CDATA[N]]></SEARCHINSUGGESTIONBOX>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <SORTNO><![CDATA[60]]></SORTNO>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--D2FC05CE951E496CA63117EDD3B92995-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--D2FC05CE951E496CA63117EDD3B92995--></OBUISEL_SELECTOR_FIELD>
+
 <!--D313500687424563ABC3782E70F2F73B--><OBUISEL_SELECTOR_FIELD>
 <!--D313500687424563ABC3782E70F2F73B-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[D313500687424563ABC3782E70F2F73B]]></OBUISEL_SELECTOR_FIELD_ID>
 <!--D313500687424563ABC3782E70F2F73B-->  <OBUISEL_SELECTOR_ID><![CDATA[518C9A856274423AB19490CA145AE139]]></OBUISEL_SELECTOR_ID>
@@ -3830,6 +3940,28 @@
 <!--EC506629A62741D0B4BECED153FD8526-->  <SHOWINPICKLIST><![CDATA[Y]]></SHOWINPICKLIST>
 <!--EC506629A62741D0B4BECED153FD8526--></OBUISEL_SELECTOR_FIELD>
 
+<!--ECBD8D593A3D4035BEE67C327463BB92--><OBUISEL_SELECTOR_FIELD>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[ECBD8D593A3D4035BEE67C327463BB92]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <OBUISEL_SELECTOR_ID><![CDATA[8190C8CCE42C41B2AF573D075BF90F1B]]></OBUISEL_SELECTOR_ID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <AD_COLUMN_ID><![CDATA[3791]]></AD_COLUMN_ID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <NAME><![CDATA[Document No.]]></NAME>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <DESCRIPTION><![CDATA[An often automatically generated identifier for all documents.]]></DESCRIPTION>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <HELP><![CDATA[The document number is usually automatically generated by the system and determined by the document type of the document. If the document is not saved, the preliminary number is displayed in "<>". If the document type of your document has no automatic document sequence defined, the field will be empty when creating a new document. This is for documents which usually have an external number (like vendor invoice).  If you leave the field empty, the system will generate a document number for you. The document sequence used for this fallback number is defined in the "Document Sequence" window with the name "DocumentNo_<TableName>", where TableName is the actual name of the table inside the database (e.g. C_Order).]]></HELP>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <PROPERTY><![CDATA[shipmentReceipt.documentNo]]></PROPERTY>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <SORT><![CDATA[Y]]></SORT>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <SEARCHINSUGGESTIONBOX><![CDATA[Y]]></SEARCHINSUGGESTIONBOX>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <SORTNO><![CDATA[20]]></SORTNO>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--ECBD8D593A3D4035BEE67C327463BB92-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--ECBD8D593A3D4035BEE67C327463BB92--></OBUISEL_SELECTOR_FIELD>
+
 <!--ED5469193BCF430995F32F9586C85DAF--><OBUISEL_SELECTOR_FIELD>
 <!--ED5469193BCF430995F32F9586C85DAF-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[ED5469193BCF430995F32F9586C85DAF]]></OBUISEL_SELECTOR_FIELD_ID>
 <!--ED5469193BCF430995F32F9586C85DAF-->  <OBUISEL_SELECTOR_ID><![CDATA[DE0239D3891D434E889A48916A7CAF88]]></OBUISEL_SELECTOR_ID>
--- a/src/org/openbravo/costing/LandedCostDistributionByAmount.java	Wed May 27 16:27:00 2015 +0200
+++ b/src/org/openbravo/costing/LandedCostDistributionByAmount.java	Fri May 29 09:52:37 2015 +0200
@@ -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 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -137,6 +137,7 @@
     qry.append("   join trx." + MaterialTransaction.PROPERTY_GOODSSHIPMENTLINE + " as iol");
     qry.append(" , " + LCReceipt.ENTITY_NAME + " as lcr");
     qry.append(" where tc." + CostAdjustmentLine.PROPERTY_UNITCOST + " = true");
+    qry.append(" and iol." + ShipmentInOutLine.PROPERTY_MOVEMENTQUANTITY + " >= 0");
     qry.append("   and ((lcr." + LCReceipt.PROPERTY_GOODSSHIPMENTLINE + " is not null");
     qry.append("        and lcr." + LCReceipt.PROPERTY_GOODSSHIPMENTLINE + " = iol)");
     qry.append("         or (lcr." + LCReceipt.PROPERTY_GOODSSHIPMENTLINE + " is null");
--- a/src/org/openbravo/costing/LandedCostProcess.java	Wed May 27 16:27:00 2015 +0200
+++ b/src/org/openbravo/costing/LandedCostProcess.java	Fri May 29 09:52:37 2015 +0200
@@ -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 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -125,7 +125,7 @@
       throw new OBException(OBMessageUtils.messageBD("LandedCostNoReceipts"));
     }
 
-    // Check that all related receipt lines have their cost already calculated.
+    // Check that all related receipt lines with movementqty >=0 have their cost already calculated.
     StringBuffer where = new StringBuffer();
     where.append(" as lcr ");
     where.append("\n  left join lcr." + LCReceipt.PROPERTY_GOODSSHIPMENT + " lcrr");
@@ -135,6 +135,7 @@
     where.append("\n   from " + MaterialTransaction.ENTITY_NAME + " as trx");
     where.append("\n     join trx." + MaterialTransaction.PROPERTY_GOODSSHIPMENTLINE + " as iol");
     where.append("\n   where trx." + MaterialTransaction.PROPERTY_ISCOSTCALCULATED + " = false");
+    where.append("\n   and iol." + ShipmentInOutLine.PROPERTY_MOVEMENTQUANTITY + " >= 0");
     where.append("\n   and (lcrrl is null");
     where.append("\n        or iol = lcrrl)");
     where.append("\n   and (lcrr is null");