http://ofbiz.116.s1.nabble.com/Users-product-requirements-tp138923p138936.html
> Hi Fred,
>
> it's good but, I'd not use the Person entity because a supplier could be
> a Person or a PartyGroup.
> Or at least use a view entity instead of Person: I think there is one
> called PartyNameView
>
> Jacopo
>
>
> Fred Forester wrote:
>
>>I have the static view. at least it seems to be correct. I'll try to
>>swap (back) in the minilang service later on today.
>>
>><view-entity entity-name="RequirementAndProductSupplier"
>> package-name="org.ofbiz.product.inventory"
>> title="Suppliers and Requirements">
>> <member-entity entity-alias="RE" entity-name="Requirement"/>
>> <member-entity entity-alias="SP" entity-name="SupplierProduct"/>
>> <member-entity entity-alias="PE" entity-name="Person"/>
>> <alias-all entity-alias="RE"/>
>> <alias-all entity-alias="SP"/>
>> <alias entity-alias="PE" name="lastName"/>
>> <alias entity-alias="PE" name="firstName"/>
>> <alias entity-alias="PE" name="partyId"/>
>> <view-link entity-alias="RE" rel-entity-alias="SP"
>>rel-optional="false">
>> <key-map field-name="productId"/>
>> </view-link>
>> <view-link entity-alias="SP" rel-entity-alias="PE"
>>rel-optional="false">
>> <key-map field-name="partyId"/>
>> </view-link>
>> <relation type="one-nofk" rel-entity-name="SupplierProduct">
>> <key-map field-name="productId"/>
>> <key-map field-name="partyId"/>
>> <key-map field-name="currencyUomId"/>
>> <key-map field-name="minimumOrderQuantity"/>
>> <key-map field-name="availableFromDate"/>
>> </relation>
>> <relation type="one-nofk" rel-entity-name="Person">
>> <key-map field-name="partyId"/>
>> </relation>
>> </view-entity>
>>
>>
>>Fred Forester wrote:
>>
>>>I only used a dynamic view cause I did something similar with purchase
>>>order "Quick Lookup" where the dynamic view selects only products for
>>>the selected supplier so I used a modified version of that.
>>>
>>>
>>>
>>>Jacopo Cappellato wrote:
>>>
>>>
>>>>Fred,
>>>>
>>>>why not simply patching the existing minilang service:
>>>>
>>>>Index:
>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml
>>>>===================================================================
>>>>---
>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml
>>>>(revision 7548)
>>>>+++
>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml
>>>>(working copy)
>>>>@@ -74,10 +74,11 @@
>>>>
>>>> <simple-method method-name="getRequirementsForSupplier"
>>>>short-description="Get the requirements applicable to a given supplier">
>>>> <make-value value-name="newEntity" entity-name="Requirement"/>
>>>>- <entity-condition entity-name="Requirement"
>>>>list-name="requirementsForSupplier">
>>>>+ <entity-condition entity-name="RequirementAndProductSupplier"
>>>>list-name="requirementsForSupplier">
>>>> <condition-list>
>>>> <condition-object
>>>>field-name="parameters.requirementConditions"/>
>>>> <condition-expr field-name="statusId"
>>>>value="REQ_APPROVED"/>
>>>>+ <condition-expr field-name="partyId"
>>>>env-name="parameters.partyId"/>
>>>> <condition-list combine="or">
>>>> <condition-expr field-name="requirementTypeId"
>>>>value="MRP_PRO_PURCH_ORDER"/>
>>>> <condition-expr field-name="requirementTypeId"
>>>>value="PRODUCT_REQUIREMENT"/>
>>>>
>>>>
>>>>?
>>>>
>>>>You'll have to define the RequirementAndProductSupplier view-entity to
>>>>make the abve code work correctly.
>>>>
>>>>Jacopo
>>>>
>>>>Fred Forester wrote:
>>>>
>>>>
>>>>
>>>>>Jacopo,
>>>>>
>>>>>it makes sense that the productId is part of the incoming
>>>>>requirementConditions. however, how do I merge or combine the
>>>>>requirementConditions with the mainCond?
>>>>>
>>>>>thanx
>>>>>Fred
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>Jacopo Cappellato wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Fred,
>>>>>>
>>>>>>thanks for your work.
>>>>>>
>>>>>>I think you should add the incoming requirementConditions as they are to
>>>>>>the other conditions of your service.
>>>>>>
>>>>>>You should also remove the productId parameter (that is not even
>>>>>>declared in the service definition); if the user has selected a
>>>>>>productId to filter out requirements, this condition will be in the
>>>>>>requirementConditions.
>>>>>>
>>>>>>Does it make sense?
>>>>>>
>>>>>>Jacopo
>>>>>>
>>>>>>Fred Forester wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Jacopo,
>>>>>>>
>>>>>>>the patch is attached and based on 7445
>>>>>>>
>>>>>>>I wasnt sure how to merge the incomming requirementConditions with the
>>>>>>>conditions being built by the code. comments welcome.
>>>>>>>
>>>>>>>Thanx
>>>>>>>Fred
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>_______________________________________________
>>>>>>Users mailing list
>>>>>>
[hidden email]
>>>>>>
http://lists.ofbiz.org/mailman/listinfo/users>>>>>>
>>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>Users mailing list
>>>>>
[hidden email]
>>>>>
http://lists.ofbiz.org/mailman/listinfo/users>>>>>
>>>>
>>>>
>>>>_______________________________________________
>>>>Users mailing list
>>>>
[hidden email]
>>>>
http://lists.ofbiz.org/mailman/listinfo/users>>>>
>>>>
>>>
>>>
>>>_______________________________________________
>>>Users mailing list
>>>
[hidden email]
>>>
http://lists.ofbiz.org/mailman/listinfo/users>>>
>>>
>>
>>
>>_______________________________________________
>>Users mailing list
>>
[hidden email]
>>
http://lists.ofbiz.org/mailman/listinfo/users>>
>
>
>
> _______________________________________________
> Users mailing list
>
[hidden email]
>
http://lists.ofbiz.org/mailman/listinfo/users>
>