details:   https://code.openbravo.com/erp/devel/pi/rev/e55d9bf9a2b7
changeset: 31058:e55d9bf9a2b7
user:      Rafael Queralta Pozo <rqueralta <at> nauta.cu>
date:      Fri Dec 23 10:39:36 2016 -0500
summary:   Fixes issue 34802: Unhomogeneous behavior in Cost Adjustments

 Now when Cost Adjustment is created:
 - In header, Organization field is filled with the "Legal" organization of the
   transaction's organization
 - Organization field is shown in Cost Adjustment Lines and filled with
   transaction's organization

details:   https://code.openbravo.com/erp/devel/pi/rev/13f087a1517e
changeset: 31059:13f087a1517e
user:      Mark <markmm82 <at> gmail.com>
date:      Fri Dec 23 14:26:16 2016 -0500
summary:   Related to 34802: Code review improvements

Set to the Cost Adjustment header's organization the legal entity of the
transaction's organization.

diffstat:

 src-db/database/sourcedata/AD_FIELD.xml            |  3 ++-
 src/org/openbravo/costing/CostAdjustmentUtils.java |  7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 426de9ed6cd3 -r 13f087a1517e src-db/database/sourcedata/AD_FIELD.xml
--- a/src-db/database/sourcedata/AD_FIELD.xml   Fri Dec 30 15:40:23 2016 +0000
+++ b/src-db/database/sourcedata/AD_FIELD.xml   Fri Dec 23 14:26:16 2016 -0500
@@ -313908,9 +313908,10 @@
 <!--FD0D66CE5B74096DE040007F010024B1-->  
<AD_TAB_ID><![CDATA[06DCB72BB6D24F82BCDA5FFF8EA0425C]]></AD_TAB_ID>
 <!--FD0D66CE5B74096DE040007F010024B1-->  
<AD_COLUMN_ID><![CDATA[FD0CA136DD459858E040007F01001C35]]></AD_COLUMN_ID>
 <!--FD0D66CE5B74096DE040007F010024B1-->  
<IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
-<!--FD0D66CE5B74096DE040007F010024B1-->  
<ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--FD0D66CE5B74096DE040007F010024B1-->  
<ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--FD0D66CE5B74096DE040007F010024B1-->  
<DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--FD0D66CE5B74096DE040007F010024B1-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--FD0D66CE5B74096DE040007F010024B1-->  <SEQNO><![CDATA[15]]></SEQNO>
 <!--FD0D66CE5B74096DE040007F010024B1-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--FD0D66CE5B74096DE040007F010024B1-->  
<ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--FD0D66CE5B74096DE040007F010024B1-->  
<ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
diff -r 426de9ed6cd3 -r 13f087a1517e 
src/org/openbravo/costing/CostAdjustmentUtils.java
--- a/src/org/openbravo/costing/CostAdjustmentUtils.java        Fri Dec 30 
15:40:23 2016 +0000
+++ b/src/org/openbravo/costing/CostAdjustmentUtils.java        Fri Dec 23 
14:26:16 2016 -0500
@@ -86,9 +86,12 @@
 
     final DocumentType docType = FIN_Utility.getDocumentType(org, 
strCategoryCostAdj);
     final String docNo = FIN_Utility.getDocumentNo(docType, strTableCostAdj);
+    final Organization orgLegal = OBContext.getOBContext()
+        
.getOrganizationStructureProvider(OBContext.getOBContext().getCurrentClient().getId())
+        .getLegalEntity(org);
 
     CostAdjustment costAdjustment = 
OBProvider.getInstance().get(CostAdjustment.class);
-    costAdjustment.setOrganization(org);
+    costAdjustment.setOrganization(orgLegal != null ? orgLegal : org);
     costAdjustment.setDocumentType(docType);
     costAdjustment.setDocumentNo(docNo);
     costAdjustment.setReferenceDate(new Date());
@@ -118,7 +121,7 @@
       Date accountingDate) {
     Long stdPrecission = transaction.getCurrency().getStandardPrecision();
     CostAdjustmentLine costAdjustmentLine = 
OBProvider.getInstance().get(CostAdjustmentLine.class);
-    costAdjustmentLine.setOrganization(costAdjustmentHeader.getOrganization());
+    costAdjustmentLine.setOrganization(transaction.getOrganization());
     costAdjustmentLine.setCostAdjustment(costAdjustmentHeader);
     if (costAdjusted == null) {
       costAdjustmentLine.setAdjustmentAmount(null);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to