svn commit: r1626409 - in /ofbiz/trunk/applications/accounting: webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy widget/InvoiceForms.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1626409 - in /ofbiz/trunk/applications/accounting: webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy widget/InvoiceForms.xml

ashish-18
Author: ashish
Date: Sat Sep 20 10:08:51 2014
New Revision: 1626409

URL: http://svn.apache.org/r1626409
Log:
Applied bug fix from jira issue - OFBIZ-3537 - Not all sales invoice item types are showing in listInvoiceItems screen.
Thanks Arun Patidar for the contribution.  

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy
    ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy?rev=1626409&r1=1626408&r2=1626409&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy Sat Sep 20 10:08:51 2014
@@ -33,13 +33,14 @@ if (!invoice) return;
 glAccountOrganizationAndClassList = null;
 if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
-        EQUALS(invoiceItemTypeId: "INVOICE_ADJ")
-        EQUALS(parentTypeId: "INVOICE_ADJ")
-        EQUALS(invoiceItemTypeId: "INVOICE_ITM_ADJ")
-        EQUALS(parentTypeId: "INVOICE_ITM_ADJ")
+        EQUALS(invoiceItemTypeId: "SINVOICE_ADJ")
+        EQUALS(parentTypeId: "SINVOICE_ADJ")
+        EQUALS(invoiceItemTypeId: "SINVOICE_ITM_ADJ")
+        EQUALS(parentTypeId: "SINVOICE_ITM_ADJ")
         EQUALS(invoiceItemTypeId: "INV_PROD_ITEM")
         EQUALS(parentTypeId: "INV_PROD_ITEM")
     }
+    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
     glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyIdFrom], null, false);
 } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
@@ -50,6 +51,7 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM")
         EQUALS(parentTypeId: "PINV_PROD_ITEM")
     }
+    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
     glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false);
 } else if ("PAYROL_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
@@ -60,6 +62,7 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "PAYROL_TAXES")
         EQUALS(parentTypeId: "PAYROL_TAXES")
     }
+    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
     glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false);
 } else if ("COMMISSION_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
@@ -68,6 +71,12 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "COMM_INV_ADJ")
         EQUALS(parentTypeId: "COMM_INV_ADJ")
     }
+    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
     glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false);
+} else {
+    map = delegator.findByAnd("InvoiceItemTypeMap", [invoiceTypeId : invoice.invoiceTypeId], null, true);
+    invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", map, null, false);
 }
+context.invoiceItemTypes = invoiceItemTypes;
+
 context.glAccountOrganizationAndClassList = glAccountOrganizationAndClassList;

Modified: ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml?rev=1626409&r1=1626408&r2=1626409&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/InvoiceForms.xml Sat Sep 20 10:08:51 2014
@@ -364,7 +364,7 @@ under the License.
        <field name="quantity"><text size="10"/></field>
        <field name="invoiceItemTypeId">
            <drop-down allow-empty="false">
-               <entity-options entity-name="InvoiceItemType" description="${description}" key-field-name="invoiceItemTypeId"/>
+               <list-options list-name="invoiceItemTypes" key-name="invoiceItemTypeId" description="${description}"/>
            </drop-down>
        </field>
        <field name="productId"><lookup target-form-name="LookupProduct" size="20"/></field>
@@ -392,7 +392,7 @@ under the License.
         <field name="invoiceId"><hidden/></field>
         <field position="1" name="invoiceItemTypeId">
             <drop-down allow-empty="false">
-                <entity-options entity-name="InvoiceItemType" description="${description}" key-field-name="invoiceItemTypeId"/>
+                <list-options list-name="invoiceItemTypes" key-name="invoiceItemTypeId" description="${description}"/>
             </drop-down>
         </field>
         <field position="1" name="description"><text size="80"/></field>