Author: jacopoc
Date: Mon Sep 4 08:08:12 2006 New Revision: 440103 URL: http://svn.apache.org/viewvc?view=rev&rev=440103 Log: Newly created purchasing requirements (i.e. requirements of type "PRODUCT_REQUIREMENT") are now automatically assigned to the main supplier (from the SupplierProduct entity) thru the RequirementRole entity. Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml incubator/ofbiz/trunk/applications/order/servicedef/secas.xml incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml?view=diff&rev=440103&r1=440102&r2=440103 ============================================================================== --- incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml (original) +++ incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml Mon Sep 4 08:08:12 2006 @@ -75,4 +75,31 @@ <field-to-result field-name="requirementsForSupplier" result-name="requirementsForSupplier"/> </simple-method> + <simple-method method-name="autoAssignRequirementToSupplier" short-description="If the requirement is a product requirement (purchasing) try to assign it to the primary supplier"> + <entity-one entity-name="Requirement" value-name="requirement" auto-field-map="true"/> + <check-errors/> + <if-compare field-name="requirement.requirementTypeId" operator="equals" value="PRODUCT_REQUIREMENT"> + <if-not-empty field-name="requirement.productId"> + <entity-condition entity-name="SupplierProduct" list-name="supplierProducts"> + <condition-list> + <condition-expr field-name="productId" env-name="requirement.productId"/> + <!-- TODO: compare quantity in requirement to the quantity in the SupplierProduct entity --> + <!--<condition-expr field-name="supplierPrefOrderId" value="PRODUCT_REQUIREMENT"/>--> + </condition-list> + <order-by field-name="supplierPrefOrderId"/> + </entity-condition> + <filter-list-by-date list-name="supplierProducts" from-field-name="availableFromDate" thru-field-name="availableThruDate"/> + <first-from-list list-name="supplierProducts" entry-name="supplierProduct"/> + <if-not-empty field-name="supplierProduct.partyId"> + <make-value value-name="requirementSupplier" entity-name="RequirementRole"/> + <set field="requirementSupplier.requirementId" from-field="requirement.requirementId"/> + <set field="requirementSupplier.partyId" from-field="supplierProduct.partyId"/> + <set field="requirementSupplier.roleTypeId" value="SUPPLIER"/> + <now-timestamp-to-env env-name="requirementSupplier.fromDate"/> + <create-value value-name="requirementSupplier"/> + </if-not-empty> + </if-not-empty> + </if-compare> + + </simple-method> </simple-methods> Modified: incubator/ofbiz/trunk/applications/order/servicedef/secas.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/secas.xml?view=diff&rev=440103&r1=440102&r2=440103 ============================================================================== --- incubator/ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ incubator/ofbiz/trunk/applications/order/servicedef/secas.xml Mon Sep 4 08:08:12 2006 @@ -226,6 +226,12 @@ <action service="associatedRequirementWithRequestItem" mode="sync"/> </eca> + <eca service="createRequirement" event="commit"> + <condition field-name="productId" operator="is-not-empty"/> + <condition field-name="requirementTypeId" operator="equals" value="PRODUCT_REQUIREMENT"/> + <action service="autoAssignRequirementToSupplier" mode="sync"/> + </eca> + <!-- Requirement / stock level --> <eca service="createItemIssuance" event="invoke"> <condition field-name="quantity" value="0" operator="greater" type="Double"/> Modified: incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml?view=diff&rev=440103&r1=440102&r2=440103 ============================================================================== --- incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml (original) +++ incubator/ofbiz/trunk/applications/order/servicedef/services_requirement.xml Mon Sep 4 08:08:12 2006 @@ -120,5 +120,11 @@ <attribute mode="IN" name="requirementId" optional="false" type="String"/> <attribute mode="IN" name="quantity" optional="true" type="Double"/> </service> + + <service name="autoAssignRequirementToSupplier" engine="simple" auth="true" + location="org/ofbiz/order/requirement/RequirementServices.xml" invoke="autoAssignRequirementToSupplier"> + <description>If the requirement is a product requirement (purchasing) try to assign it to the primary supplier</description> + <attribute name="requirementId" type="String" mode="IN" optional="false"/> + </service> </services> |
Free forum by Nabble | Edit this page |