Hi Hans,
If you're working in the ItemIssuance area, you might want to look at https://issues.apache.org/jira/browse/OFBIZ-4386 . I reckon there's a nasty bug there, and the Jira issue has a unit test to demonstrate it and a patch. Since your change is for service products, I doubt there's any interaction between your changes and mine, but it would be good to make sure of that. Cheers Paul Foxworthy
--
Coherent Software Australia Pty Ltd http://www.coherentsoftware.com.au/ Bonsai ERP, the all-inclusive ERP system http://www.bonsaierp.com.au/ |
I see Jacques is working on your issue. The changes we made are for the
specific product type only, so i do not expect a conflict here. Regards, Hans On Thu, 2011-09-15 at 19:24 -0700, Paul Foxworthy wrote: > Hi Hans, > > If you're working in the ItemIssuance area, you might want to look at > https://issues.apache.org/jira/browse/OFBIZ-4386 . I reckon there's a nasty > bug there, and the Jira issue has a unit test to demonstrate it and a patch. > > Since your change is for service products, I doubt there's any interaction > between your changes and mine, but it would be good to make sure of that. > > Cheers > > Paul Foxworthy > > -- > View this message in context: http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1171093-in-ofbiz-trunk-applications-accounting-servicedef-order-src-org-ofbiz-order-o-tp3817223p3817223.html > Sent from the OFBiz - Dev mailing list archive at Nabble.com. -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Alternative ofbiz website: http://www.ofbiz.info http://www.antwebsystems.com : Quality services for competitive rates. |
In reply to this post by Paul Foxworthy
Hi Hans,
IMO it would probably be more robust to let the service execute and then check who the owner of the inventoryItem is before creating the transactions instead of checking the productTypeId. This would cover a much larger range of receipt and issuances in the future and really is the true rule that we're trying to enforce: "Don't create ledger entries for inventory movements if we don't own the inventory". Regards Scott On 16/09/2011, at 1:32 AM, [hidden email] wrote: > Author: hansbak > Date: Thu Sep 15 13:32:52 2011 > New Revision: 1171093 > > URL: http://svn.apache.org/viewvc?rev=1171093&view=rev > Log: > make sure that the product type productservice does not affect accounting when entering and shipping from inventory > > Modified: > ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml > ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml > ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml > ofbiz/trunk/applications/product/servicedef/services_shipment.xml > ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java > > Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > ============================================================================== > --- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original) > +++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Thu Sep 15 13:32:52 2011 > @@ -31,6 +31,8 @@ under the License. > <eca service="createItemIssuance" event="commit"> > <condition field-name="orderId" operator="is-not-empty"/> > <condition field-name="inventoryItemId" operator="is-not-empty"/> > + <!-- Ignore the inventory shipment if the product type is service_product --> > + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> > <action service="createAcctgTransForSalesShipmentIssuance" mode="sync"/> > </eca> > > @@ -42,6 +44,8 @@ under the License. > > <!-- create the accounting transactions for a shipment receipt every time the inventory is received --> > <eca service="createShipmentReceipt" event="commit"> > + <!-- Ignore the inventory shipment if the product type is service_product --> > + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> > <action service="createAcctgTransForShipmentReceipt" mode="sync"/> > </eca> > > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1171093&r1=1171092&r2=1171093&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Sep 15 13:32:52 2011 > @@ -1168,7 +1168,8 @@ public class OrderServices { > GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); > ripCtx.put("productId", productId); > ripCtx.put("facilityId", inventoryFacilityId); > - ripCtx.put("inventoryItemTypeId", "NON_SERIAL_INV_ITEM"); > + ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); > + ripCtx.put("statusId","INV_AVAILABLE"); > ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity")); > ripCtx.put("quantityRejected", 0.0); > ripCtx.put("userLogin", permUserLogin); > > Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml (original) > +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml Thu Sep 15 13:32:52 2011 > @@ -43,6 +43,11 @@ under the License. > <set field="updateContext.inventoryItemId" from-field="inventoryItem.inventoryItemId"/> > <set field="updateContext.statusId" value="INV_DELIVERED"/> > <call-service service-name="updateInventoryItem" in-map-name="updateContext"/> > + > + <entity-one value-field="product" entity-name="Product"> > + <field-map field-name="productId" from-field="inventoryItem.productId"/> > + </entity-one> > + <field-to-result field="product.productTypeId" result-name="productTypeId"/> > </if-compare> > </if-not-empty> > </simple-method> > > Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original) > +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Thu Sep 15 13:32:52 2011 > @@ -45,6 +45,9 @@ under the License. > <set field="invDet.receiptId" from-field="receiptId"/> > <store-value value-field="invDet"/> > </if-not-empty> > + > + <entity-one value-field="product" entity-name="Product"/> > + <field-to-result field="product.productTypeId" result-name="productTypeId"/> > </simple-method> > > <simple-method method-name="createShipmentReceiptRole" short-description="Create a ShipmentReceipt Role"> > > Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) > +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Sep 15 13:32:52 2011 > @@ -397,6 +397,7 @@ under the License. > <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> > <auto-attributes include="pk" mode="OUT" optional="false"/> > <auto-attributes include="nonpk" mode="IN" optional="true"/> > + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> > </service> > <service name="updateItemIssuance" default-entity-name="ItemIssuance" engine="simple" > location="component://product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml" invoke="updateItemIssuance" auth="true"> > @@ -735,6 +736,7 @@ under the License. > <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> > <implements service="interfaceShipmentReceipt"/> > <attribute name="receiptId" type="String" mode="OUT" optional="false"/> > + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> > </service> > <service name="updatePurchaseShipmentFromReceipt" engine="java" > location="org.ofbiz.shipment.shipment.ShipmentServices" invoke="updatePurchaseShipmentFromReceipt" auth="true"> > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1171093&r1=1171092&r2=1171093&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) > +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Thu Sep 15 13:32:52 2011 > @@ -62,7 +62,7 @@ public class ProductWorker { > String errMsg = ""; > if (product != null) { > String productTypeId = product.getString("productTypeId"); > - if ("SERVICE".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { > + if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { > // don't charge shipping on services or digital goods > return false; > } > > smime.p7s (3K) Download Attachment |
valuable comment...will look into it.
On Fri, 2011-09-16 at 22:14 +1200, Scott Gray wrote: > Hi Hans, > > IMO it would probably be more robust to let the service execute and then check who the owner of the inventoryItem is before creating the transactions instead of checking the productTypeId. This would cover a much larger range of receipt and issuances in the future and really is the true rule that we're trying to enforce: "Don't create ledger entries for inventory movements if we don't own the inventory". > > Regards > Scott > > On 16/09/2011, at 1:32 AM, [hidden email] wrote: > > > Author: hansbak > > Date: Thu Sep 15 13:32:52 2011 > > New Revision: 1171093 > > > > URL: http://svn.apache.org/viewvc?rev=1171093&view=rev > > Log: > > make sure that the product type productservice does not affect accounting when entering and shipping from inventory > > > > Modified: > > ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml > > ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > > ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml > > ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml > > ofbiz/trunk/applications/product/servicedef/services_shipment.xml > > ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java > > > > Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original) > > +++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Thu Sep 15 13:32:52 2011 > > @@ -31,6 +31,8 @@ under the License. > > <eca service="createItemIssuance" event="commit"> > > <condition field-name="orderId" operator="is-not-empty"/> > > <condition field-name="inventoryItemId" operator="is-not-empty"/> > > + <!-- Ignore the inventory shipment if the product type is service_product --> > > + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> > > <action service="createAcctgTransForSalesShipmentIssuance" mode="sync"/> > > </eca> > > > > @@ -42,6 +44,8 @@ under the License. > > > > <!-- create the accounting transactions for a shipment receipt every time the inventory is received --> > > <eca service="createShipmentReceipt" event="commit"> > > + <!-- Ignore the inventory shipment if the product type is service_product --> > > + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> > > <action service="createAcctgTransForShipmentReceipt" mode="sync"/> > > </eca> > > > > > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) > > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Sep 15 13:32:52 2011 > > @@ -1168,7 +1168,8 @@ public class OrderServices { > > GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); > > ripCtx.put("productId", productId); > > ripCtx.put("facilityId", inventoryFacilityId); > > - ripCtx.put("inventoryItemTypeId", "NON_SERIAL_INV_ITEM"); > > + ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); > > + ripCtx.put("statusId","INV_AVAILABLE"); > > ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity")); > > ripCtx.put("quantityRejected", 0.0); > > ripCtx.put("userLogin", permUserLogin); > > > > Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml (original) > > +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml Thu Sep 15 13:32:52 2011 > > @@ -43,6 +43,11 @@ under the License. > > <set field="updateContext.inventoryItemId" from-field="inventoryItem.inventoryItemId"/> > > <set field="updateContext.statusId" value="INV_DELIVERED"/> > > <call-service service-name="updateInventoryItem" in-map-name="updateContext"/> > > + > > + <entity-one value-field="product" entity-name="Product"> > > + <field-map field-name="productId" from-field="inventoryItem.productId"/> > > + </entity-one> > > + <field-to-result field="product.productTypeId" result-name="productTypeId"/> > > </if-compare> > > </if-not-empty> > > </simple-method> > > > > Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original) > > +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Thu Sep 15 13:32:52 2011 > > @@ -45,6 +45,9 @@ under the License. > > <set field="invDet.receiptId" from-field="receiptId"/> > > <store-value value-field="invDet"/> > > </if-not-empty> > > + > > + <entity-one value-field="product" entity-name="Product"/> > > + <field-to-result field="product.productTypeId" result-name="productTypeId"/> > > </simple-method> > > > > <simple-method method-name="createShipmentReceiptRole" short-description="Create a ShipmentReceipt Role"> > > > > Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) > > +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Sep 15 13:32:52 2011 > > @@ -397,6 +397,7 @@ under the License. > > <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> > > <auto-attributes include="pk" mode="OUT" optional="false"/> > > <auto-attributes include="nonpk" mode="IN" optional="true"/> > > + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> > > </service> > > <service name="updateItemIssuance" default-entity-name="ItemIssuance" engine="simple" > > location="component://product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml" invoke="updateItemIssuance" auth="true"> > > @@ -735,6 +736,7 @@ under the License. > > <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> > > <implements service="interfaceShipmentReceipt"/> > > <attribute name="receiptId" type="String" mode="OUT" optional="false"/> > > + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> > > </service> > > <service name="updatePurchaseShipmentFromReceipt" engine="java" > > location="org.ofbiz.shipment.shipment.ShipmentServices" invoke="updatePurchaseShipmentFromReceipt" auth="true"> > > > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) > > +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Thu Sep 15 13:32:52 2011 > > @@ -62,7 +62,7 @@ public class ProductWorker { > > String errMsg = ""; > > if (product != null) { > > String productTypeId = product.getString("productTypeId"); > > - if ("SERVICE".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { > > + if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { > > // don't charge shipping on services or digital goods > > return false; > > } > > > > > -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Alternative ofbiz website: http://www.ofbiz.info http://www.antwebsystems.com : Quality services for competitive rates. |
In reply to this post by Scott Gray-2
Hi Scott,
We looked into your comment, but found that inventoryitem owner is not always affecting accounting: 1. service product: foreign owner: no account update 2. rental product: is owner: also no accounting update we are following however your remark to generalize: for both product types we use the new variable adjustAccounting please see Committed revision 1172965. Regards, Hans On Fri, 2011-09-16 at 22:14 +1200, Scott Gray wrote: > Hi Hans, > > IMO it would probably be more robust to let the service execute and then check who the owner of the inventoryItem is before creating the transactions instead of checking the productTypeId. This would cover a much larger range of receipt and issuances in the future and really is the true rule that we're trying to enforce: "Don't create ledger entries for inventory movements if we don't own the inventory". > > Regards > Scott > > On 16/09/2011, at 1:32 AM, [hidden email] wrote: > > > Author: hansbak > > Date: Thu Sep 15 13:32:52 2011 > > New Revision: 1171093 > > > > URL: http://svn.apache.org/viewvc?rev=1171093&view=rev > > Log: > > make sure that the product type productservice does not affect accounting when entering and shipping from inventory > > > > Modified: > > ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml > > ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > > ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml > > ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml > > ofbiz/trunk/applications/product/servicedef/services_shipment.xml > > ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java > > > > Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original) > > +++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Thu Sep 15 13:32:52 2011 > > @@ -31,6 +31,8 @@ under the License. > > <eca service="createItemIssuance" event="commit"> > > <condition field-name="orderId" operator="is-not-empty"/> > > <condition field-name="inventoryItemId" operator="is-not-empty"/> > > + <!-- Ignore the inventory shipment if the product type is service_product --> > > + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> > > <action service="createAcctgTransForSalesShipmentIssuance" mode="sync"/> > > </eca> > > > > @@ -42,6 +44,8 @@ under the License. > > > > <!-- create the accounting transactions for a shipment receipt every time the inventory is received --> > > <eca service="createShipmentReceipt" event="commit"> > > + <!-- Ignore the inventory shipment if the product type is service_product --> > > + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> > > <action service="createAcctgTransForShipmentReceipt" mode="sync"/> > > </eca> > > > > > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) > > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Sep 15 13:32:52 2011 > > @@ -1168,7 +1168,8 @@ public class OrderServices { > > GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); > > ripCtx.put("productId", productId); > > ripCtx.put("facilityId", inventoryFacilityId); > > - ripCtx.put("inventoryItemTypeId", "NON_SERIAL_INV_ITEM"); > > + ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); > > + ripCtx.put("statusId","INV_AVAILABLE"); > > ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity")); > > ripCtx.put("quantityRejected", 0.0); > > ripCtx.put("userLogin", permUserLogin); > > > > Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml (original) > > +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml Thu Sep 15 13:32:52 2011 > > @@ -43,6 +43,11 @@ under the License. > > <set field="updateContext.inventoryItemId" from-field="inventoryItem.inventoryItemId"/> > > <set field="updateContext.statusId" value="INV_DELIVERED"/> > > <call-service service-name="updateInventoryItem" in-map-name="updateContext"/> > > + > > + <entity-one value-field="product" entity-name="Product"> > > + <field-map field-name="productId" from-field="inventoryItem.productId"/> > > + </entity-one> > > + <field-to-result field="product.productTypeId" result-name="productTypeId"/> > > </if-compare> > > </if-not-empty> > > </simple-method> > > > > Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original) > > +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Thu Sep 15 13:32:52 2011 > > @@ -45,6 +45,9 @@ under the License. > > <set field="invDet.receiptId" from-field="receiptId"/> > > <store-value value-field="invDet"/> > > </if-not-empty> > > + > > + <entity-one value-field="product" entity-name="Product"/> > > + <field-to-result field="product.productTypeId" result-name="productTypeId"/> > > </simple-method> > > > > <simple-method method-name="createShipmentReceiptRole" short-description="Create a ShipmentReceipt Role"> > > > > Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) > > +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Sep 15 13:32:52 2011 > > @@ -397,6 +397,7 @@ under the License. > > <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> > > <auto-attributes include="pk" mode="OUT" optional="false"/> > > <auto-attributes include="nonpk" mode="IN" optional="true"/> > > + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> > > </service> > > <service name="updateItemIssuance" default-entity-name="ItemIssuance" engine="simple" > > location="component://product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml" invoke="updateItemIssuance" auth="true"> > > @@ -735,6 +736,7 @@ under the License. > > <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> > > <implements service="interfaceShipmentReceipt"/> > > <attribute name="receiptId" type="String" mode="OUT" optional="false"/> > > + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> > > </service> > > <service name="updatePurchaseShipmentFromReceipt" engine="java" > > location="org.ofbiz.shipment.shipment.ShipmentServices" invoke="updatePurchaseShipmentFromReceipt" auth="true"> > > > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1171093&r1=1171092&r2=1171093&view=diff > > ============================================================================== > > --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) > > +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Thu Sep 15 13:32:52 2011 > > @@ -62,7 +62,7 @@ public class ProductWorker { > > String errMsg = ""; > > if (product != null) { > > String productTypeId = product.getString("productTypeId"); > > - if ("SERVICE".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { > > + if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { > > // don't charge shipping on services or digital goods > > return false; > > } > > > > > -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Alternative ofbiz website: http://www.ofbiz.info http://www.antwebsystems.com : Quality services for competitive rates. |
Thanks for taking another look at it Hans, and you're probably right that the owner by itself probably isn't the best way to solve the problem.
In general, neither of the products you mention below are sales/purchase shipments but I guess you are using those shipment types for them. Have you considered using the incoming/outgoing shipment types instead and then adding a check in the ledger services for the shipment type? Regards Scott On 20/09/2011, at 3:51 PM, Hans Bakker wrote: > Hi Scott, > > We looked into your comment, but found that inventoryitem owner is not > always affecting accounting: > > 1. service product: foreign owner: no account update > 2. rental product: is owner: also no accounting update > > we are following however your remark to generalize: > > for both product types we use the new variable adjustAccounting > > please see Committed revision 1172965. > > Regards, > Hans > > > On Fri, 2011-09-16 at 22:14 +1200, Scott Gray wrote: >> Hi Hans, >> >> IMO it would probably be more robust to let the service execute and then check who the owner of the inventoryItem is before creating the transactions instead of checking the productTypeId. This would cover a much larger range of receipt and issuances in the future and really is the true rule that we're trying to enforce: "Don't create ledger entries for inventory movements if we don't own the inventory". >> >> Regards >> Scott >> >> On 16/09/2011, at 1:32 AM, [hidden email] wrote: >> >>> Author: hansbak >>> Date: Thu Sep 15 13:32:52 2011 >>> New Revision: 1171093 >>> >>> URL: http://svn.apache.org/viewvc?rev=1171093&view=rev >>> Log: >>> make sure that the product type productservice does not affect accounting when entering and shipping from inventory >>> >>> Modified: >>> ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java >>> ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml >>> ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml >>> ofbiz/trunk/applications/product/servicedef/services_shipment.xml >>> ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java >>> >>> Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=1171093&r1=1171092&r2=1171093&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original) >>> +++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Thu Sep 15 13:32:52 2011 >>> @@ -31,6 +31,8 @@ under the License. >>> <eca service="createItemIssuance" event="commit"> >>> <condition field-name="orderId" operator="is-not-empty"/> >>> <condition field-name="inventoryItemId" operator="is-not-empty"/> >>> + <!-- Ignore the inventory shipment if the product type is service_product --> >>> + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> >>> <action service="createAcctgTransForSalesShipmentIssuance" mode="sync"/> >>> </eca> >>> >>> @@ -42,6 +44,8 @@ under the License. >>> >>> <!-- create the accounting transactions for a shipment receipt every time the inventory is received --> >>> <eca service="createShipmentReceipt" event="commit"> >>> + <!-- Ignore the inventory shipment if the product type is service_product --> >>> + <condition field-name="productTypeId" operator="not-equals" value="SERVICE_PRODUCT"/> >>> <action service="createAcctgTransForShipmentReceipt" mode="sync"/> >>> </eca> >>> >>> >>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1171093&r1=1171092&r2=1171093&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) >>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Sep 15 13:32:52 2011 >>> @@ -1168,7 +1168,8 @@ public class OrderServices { >>> GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); >>> ripCtx.put("productId", productId); >>> ripCtx.put("facilityId", inventoryFacilityId); >>> - ripCtx.put("inventoryItemTypeId", "NON_SERIAL_INV_ITEM"); >>> + ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); >>> + ripCtx.put("statusId","INV_AVAILABLE"); >>> ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity")); >>> ripCtx.put("quantityRejected", 0.0); >>> ripCtx.put("userLogin", permUserLogin); >>> >>> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml (original) >>> +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml Thu Sep 15 13:32:52 2011 >>> @@ -43,6 +43,11 @@ under the License. >>> <set field="updateContext.inventoryItemId" from-field="inventoryItem.inventoryItemId"/> >>> <set field="updateContext.statusId" value="INV_DELIVERED"/> >>> <call-service service-name="updateInventoryItem" in-map-name="updateContext"/> >>> + >>> + <entity-one value-field="product" entity-name="Product"> >>> + <field-map field-name="productId" from-field="inventoryItem.productId"/> >>> + </entity-one> >>> + <field-to-result field="product.productTypeId" result-name="productTypeId"/> >>> </if-compare> >>> </if-not-empty> >>> </simple-method> >>> >>> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original) >>> +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Thu Sep 15 13:32:52 2011 >>> @@ -45,6 +45,9 @@ under the License. >>> <set field="invDet.receiptId" from-field="receiptId"/> >>> <store-value value-field="invDet"/> >>> </if-not-empty> >>> + >>> + <entity-one value-field="product" entity-name="Product"/> >>> + <field-to-result field="product.productTypeId" result-name="productTypeId"/> >>> </simple-method> >>> >>> <simple-method method-name="createShipmentReceiptRole" short-description="Create a ShipmentReceipt Role"> >>> >>> Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=1171093&r1=1171092&r2=1171093&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) >>> +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Sep 15 13:32:52 2011 >>> @@ -397,6 +397,7 @@ under the License. >>> <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> >>> <auto-attributes include="pk" mode="OUT" optional="false"/> >>> <auto-attributes include="nonpk" mode="IN" optional="true"/> >>> + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> >>> </service> >>> <service name="updateItemIssuance" default-entity-name="ItemIssuance" engine="simple" >>> location="component://product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml" invoke="updateItemIssuance" auth="true"> >>> @@ -735,6 +736,7 @@ under the License. >>> <permission-service service-name="facilityGenericPermission" main-action="CREATE"/> >>> <implements service="interfaceShipmentReceipt"/> >>> <attribute name="receiptId" type="String" mode="OUT" optional="false"/> >>> + <attribute name="productTypeId" type="String" mode="OUT" optional="true"/> >>> </service> >>> <service name="updatePurchaseShipmentFromReceipt" engine="java" >>> location="org.ofbiz.shipment.shipment.ShipmentServices" invoke="updatePurchaseShipmentFromReceipt" auth="true"> >>> >>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1171093&r1=1171092&r2=1171093&view=diff >>> ============================================================================== >>> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) >>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Thu Sep 15 13:32:52 2011 >>> @@ -62,7 +62,7 @@ public class ProductWorker { >>> String errMsg = ""; >>> if (product != null) { >>> String productTypeId = product.getString("productTypeId"); >>> - if ("SERVICE".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { >>> + if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) { >>> // don't charge shipping on services or digital goods >>> return false; >>> } >>> >>> >> > > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Alternative ofbiz website: http://www.ofbiz.info > http://www.antwebsystems.com : Quality services for competitive rates. > smime.p7s (3K) Download Attachment |
Free forum by Nabble | Edit this page |