Fixed invoice item type dropdown to be more flexible. Now it shows the item types for a given invoice type instead of using a non-extensible heuristic.

git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@489239 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Si Chen
2006-12-21 01:14:09 +00:00
parent dfae545b08
commit deec93e27b
3 changed files with 30 additions and 42 deletions
@@ -0,0 +1,25 @@
/*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.util.EntityUtil;
invoice = context.get("invoice");
if (invoice == null) return;
map = delegator.findByAndCache("InvoiceItemTypeMap", UtilMisc.toMap("invoiceTypeId", invoice.get("invoiceTypeId")));
invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", map);
context.put("invoiceItemTypes", invoiceItemTypes);
@@ -248,32 +248,13 @@ under the License.
<field name="invoiceId"><hidden/></field>
<field name="invoiceItemSeqId" widget-style="buttontext"><hyperlink target="listInvoiceItems?invoiceId=${invoiceId}&amp;invoiceItemSeqId=${invoiceItemSeqId}" description="${invoiceItemSeqId}"/></field>
<field name="quantity"><text size="3"/></field>
<field name="invoiceItemTypeId" use-when="&quot;${invoice.invoiceTypeId}&quot;.equals(&quot;PURCHASE_INVOICE&quot;)">
<field name="invoiceItemTypeId">
<drop-down allow-empty="false">
<entity-options description="${description}" entity-name="InvoiceItemType">
<entity-constraint name="invoiceItemTypeId" operator="like" value="PINV_%"/>
<entity-order-by field-name="description"/>
</entity-options>
<list-options list-name="invoiceItemTypes" key-name="invoiceItemTypeId" description="${description}"/>
</drop-down>
</field>
<field name="productId"><lookup target-form-name="LookupProduct" size="20"/></field>
<field name="description"><text size="30"/></field>
<field name="invoiceItemTypeId" use-when="&quot;${invoice.invoiceTypeId}&quot;.equals(&quot;SALES_INVOICE&quot;)">
<drop-down allow-empty="false">
<entity-options description="${description}" entity-name="InvoiceItemType">
<entity-constraint name="invoiceItemTypeId" operator="like" value="INV_%"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field name="invoiceItemTypeId" use-when="&quot;${invoice.invoiceTypeId}&quot;.equals(&quot;COMMISSION_INVOICE&quot;)">
<drop-down allow-empty="false">
<entity-options description="${description}" entity-name="InvoiceItemType">
<entity-constraint name="invoiceItemTypeId" operator="like" value="COMM_INV_%"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<!--field name="overrideGlAccountId"><text size="10"/></field-->
<field name="amount"><text size="7"/></field>
<field name="total" widget-area-style="tabletextright" widget-style="tabletext" use-when="uomId!=null"><display type="currency" currency="${uomId}"/></field> <!-- this should not look like something you can modify, hence "tabletext" -->
@@ -292,31 +273,12 @@ under the License.
<alt-target use-when="invoiceItem==null" target="createInvoiceItem"/>
<field name="invoiceId"><hidden/></field>
<field position="1" name="invoiceItemSeqId"><text size="5"/></field>
<field position="1" name="invoiceItemTypeId" use-when="&quot;${invoice.invoiceTypeId}&quot;.equals(&quot;PURCHASE_INVOICE&quot;)">
<field position="1" name="invoiceItemTypeId">
<drop-down allow-empty="false">
<entity-options description="${description}" entity-name="InvoiceItemType">
<entity-constraint name="invoiceItemTypeId" operator="like" value="PINV_%"/>
<entity-order-by field-name="description"/>
</entity-options>
<list-options list-name="invoiceItemTypes" key-name="invoiceItemTypeId" description="${description}"/>
</drop-down>
</field>
<field position="1" name="description"><text size="80"/></field>
<field position="1" name="invoiceItemTypeId" use-when="&quot;${invoice.invoiceTypeId}&quot;.equals(&quot;SALES_INVOICE&quot;)">
<drop-down allow-empty="false">
<entity-options description="${description}" entity-name="InvoiceItemType">
<entity-constraint name="invoiceItemTypeId" operator="like" value="INV_%"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field position="1" name="invoiceItemTypeId" use-when="&quot;${invoice.invoiceTypeId}&quot;.equals(&quot;COMMISSION_INVOICE&quot;)">
<drop-down allow-empty="false">
<entity-options description="${description}" entity-name="InvoiceItemType">
<entity-constraint name="invoiceItemTypeId" operator="like" value="COMM_INV_%"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<field position="1" name="overrideGlAccountId"><text/></field>
<field position="2" name="inventoryItemId"><text/></field>
<field position="1" name="productId">
@@ -235,6 +235,7 @@ under the License.
<field-map field-name="invoiceId" env-name="parameters.invoiceId"/>
<order-by field-name="invoiceItemSeqId"/>
</entity-and>
<script location="component://accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh"/>
</actions>
<widgets>
<decorator-screen name="CommonInvoiceDecorator" location="${parameters.mainDecoratorLocation}">