You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Hans Bakker (JIRA)" <ji...@apache.org> on 2013/07/07 10:35:48 UTC

[jira] [Comment Edited] (OFBIZ-5256) allow a value in the view relation definition

    [ https://issues.apache.org/jira/browse/OFBIZ-5256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13701529#comment-13701529 ] 

Hans Bakker edited comment on OFBIZ-5256 at 7/7/13 8:33 AM:
------------------------------------------------------------

Thank you all for your comments, the answr from Leon, Deepak looks it works when only the invoice entity is involved.

However as usual the reality is a little bit more complicated: an invoice also has invoiceitems with a productId i also want to translate when required.
 The view definition will become like:
{noformat} 
    <view-entity entity-name="InvoiceExport2" package-name="org.ofbiz.accounting.reports">
        <member-entity entity-alias="INV" entity-name="Invoice"/>
        <member-entity entity-alias="ITM" entity-name="InvoiceItem"/>
        <member-entity entity-alias="PFR" entity-name="PartyIdentification"/>
        <member-entity entity-alias="PTO" entity-name="PartyIdentification"/>
        <member-entity entity-alias="GI" entity-name="GoodIdentification"/>
        <alias entity-alias="INV" name="invoiceId" />
        <alias entity-alias="INV" name="invoiceDate"/>
        <alias entity-alias="INV" name="invoiceTypeId"/>
        <alias entity-alias="INV" name="description"/>
        <alias entity-alias="INV" name="partyIdFrom"/>
        <alias entity-alias="PFR" name="partyIdFromTrans" field="idValue"/>
        <alias entity-alias="INV" name="partyId"/>
        <alias entity-alias="PTO" name="partyIdTrans" field="idValue"/>
        <alias entity-alias="INV" name="currencyUomId"/>
        <alias entity-alias="ITM" name="invoiceItemSeqId"/>
        <alias entity-alias="ITM" name="invoiceItemTypeId"/>
        <alias entity-alias="ITM" name="itemDescription" field="description"/>
        <alias entity-alias="ITM" name="productId"/>
        <alias entity-alias="GI" name="productIdTrans" field="idValue"/>
        <alias entity-alias="ITM" name="quantity"/>
        <alias entity-alias="ITM" name="amount"/>
        <view-link entity-alias="INV" rel-entity-alias="ITM" rel-optional="true">
            <key-map field-name="invoiceId"/>
        </view-link>
        <view-link entity-alias="INV" rel-entity-alias="PFR" rel-optional="true">
            <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
        </view-link>
        <view-link entity-alias="INV" rel-entity-alias="PTO" rel-optional="true">
            <key-map field-name="partyId" rel-field-name="partyId"/>
        </view-link>
        <view-link entity-alias="ITM" rel-entity-alias="GI" rel-optional="true">
            <key-map field-name="productId" rel-field-name="productId"/>
        </view-link>
        <entity-condition>
            <condition-list combine="or">
                <condition-expr field-name="partyIdentificationTypeId" entity-alias="PTO"  value="INVOICE_EXPORT"/>
                <condition-expr field-name="partyIdentificationTypeId" entity-alias="PFR"  value="INVOICE_EXPORT"/>
                <condition-expr field-name="goodIdentificationTypeId" entity-alias="GI"  value="INVOICE_EXPORT"/>
            </condition-list>
        </entity-condition>
    </view-entity>

{noformat} 


the effect on the invoice demo data id 8008 with replace ment for company, demosupplier and product GZ-2644 gives the following output:

{noformat}
 	invoiceId 	invoiceDate 	invoiceTypeId 	description 	partyIdFrom 	partyIdFromTrans 	partyId 	partyIdTrans 	currencyUomId 	invoiceItemSeqId 	invoiceItemTypeId 	itemDescription 	productId 	productIdTrans 	quantity 	amount
View Delete 	8008 	2009-08-13 17:47:47.929 	PURCHASE_INVOICE 	Purchase Order Invoice 	DemoSupplier 	1234 5678 90123 	Company 	yyyyyyyyyyyyyyyyyy 	USD 	00001 	PINV_FPROD_ITEM 	GZ-2644-0 Round Gizmo 	GZ-2644 	34uiy4 	2 	24
View Delete 	8008 	2009-08-13 17:47:47.929 	PURCHASE_INVOICE 	Purchase Order Invoice 	DemoSupplier 	1234 5678 90123 	Company 	uytututu 	USD 	00001 	PINV_FPROD_ITEM 	GZ-2644-0 Round Gizmo 	GZ-2644 	34uiy4 	2 	24
{noformat}

problems: the invoice item is duplicated, the company has two different translation values....

if anybody has other suggestions let me know.

                
      was (Author: hansbak):
    Thank you all for your comments, the answr from Leon, Deepak looks it works when only the invoice entity is involved.

However as usual the reality is a little bit more complicated: an invoice also has invoiceitems with a productId i also want to translate when required.
 The view definition will become like:
{noformat} 
    <view-entity entity-name="InvoiceExport2" package-name="org.ofbiz.accounting.reports">
        <member-entity entity-alias="INV" entity-name="Invoice"/>
        <member-entity entity-alias="ITM" entity-name="InvoiceItem"/>
        <member-entity entity-alias="PFR" entity-name="PartyIdentification"/>
        <member-entity entity-alias="PTO" entity-name="PartyIdentification"/>
        <member-entity entity-alias="GI" entity-name="GoodIdentification"/>
        <alias entity-alias="INV" name="invoiceId" />
        <alias entity-alias="INV" name="invoiceDate"/>
        <alias entity-alias="INV" name="invoiceTypeId"/>
        <alias entity-alias="INV" name="description"/>
        <alias entity-alias="INV" name="partyIdFrom"/>
        <alias entity-alias="PFR" name="partyIdFromTrans" field="idValue"/>
        <alias entity-alias="INV" name="partyId"/>
        <alias entity-alias="PTO" name="partyIdTrans" field="idValue"/>
        <alias entity-alias="INV" name="currencyUomId"/>
        <alias entity-alias="ITM" name="invoiceItemSeqId"/>
        <alias entity-alias="ITM" name="invoiceItemTypeId"/>
        <alias entity-alias="ITM" name="itemDescription" field="description"/>
        <alias entity-alias="ITM" name="productId"/>
        <alias entity-alias="GI" name="productIdTrans" field="idValue"/>
        <alias entity-alias="ITM" name="quantity"/>
        <alias entity-alias="ITM" name="amount"/>
        <view-link entity-alias="INV" rel-entity-alias="ITM" rel-optional="true">
            <key-map field-name="invoiceId"/>
        </view-link>
        <view-link entity-alias="INV" rel-entity-alias="PFR" rel-optional="true">
            <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
        </view-link>
        <view-link entity-alias="INV" rel-entity-alias="PTO" rel-optional="true">
            <key-map field-name="partyId" rel-field-name="partyId"/>
        </view-link>
        <view-link entity-alias="ITM" rel-entity-alias="GI" rel-optional="true">
            <key-map field-name="productId" rel-field-name="productId"/>
        </view-link>
        <entity-condition>
            <condition-list combine="or">
                <condition-expr field-name="partyIdentificationTypeId" entity-alias="PTO"  value="INVOICE_EXPORT"/>
                <condition-expr field-name="partyIdentificationTypeId" entity-alias="PFR"  value="INVOICE_EXPORT"/>
                <condition-expr field-name="goodIdentificationTypeId" entity-alias="GI"  value="INVOICE_EXPORT"/>
            </condition-list>
        </entity-condition>
    </view-entity>

{noformat} 


the effect on the invoice demo data id 8008 with replace ment for company, demosupplier and product GZ-2644 gives the following output:

{noformat}
 	invoiceId 	invoiceDate 	invoiceTypeId 	description 	partyIdFrom 	partyIdFromTrans 	partyId 	partyIdTrans 	currencyUomId 	invoiceItemSeqId 	invoiceItemTypeId 	itemDescription 	productId 	productIdTrans 	quantity 	amount
View Delete 	8008 	2009-08-13 17:47:47.929 	PURCHASE_INVOICE 	Purchase Order Invoice 	DemoSupplier 	1234 5678 90123 	Company 	yyyyyyyyyyyyyyyyyy 	USD 	00001 	PINV_FPROD_ITEM 	GZ-2644-0 Round Gizmo 	GZ-2644 	34uiy4 	2 	24
View Delete 	8008 	2009-08-13 17:47:47.929 	PURCHASE_INVOICE 	Purchase Order Invoice 	DemoSupplier 	1234 5678 90123 	Company 	uytututu 	USD 	00001 	PINV_FPROD_ITEM 	GZ-2644-0 Round Gizmo 	GZ-2644 	34uiy4 	2 	24
{noformat}

if anybody has other suggestions let me know.

                  
> allow a value in the view relation definition
> ---------------------------------------------
>
>                 Key: OFBIZ-5256
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5256
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: any
>            Reporter: Hans Bakker
>            Assignee: Hans Bakker
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: value.diff
>
>
> I need help from our framework experts.
> I want to copy invoices from an ofbiz system to other systems. However the export has partyId's and productid's which are different on the other systems. I want to use the product and party alternative id's to translate these values.
> In order to be able to replace party and product id's values in a csv export it is required to be able to have a 'value' specified instead of a field name
> the link in a view definition is as follows: (first key-map current, second line new key-map possibility:
>       <view-link entity-alias="INV" rel-entity-alias="PFR" rel-optional="true">
>             <key-map field-name="partyIdFrom" rel-field-name="partyId"/>
>             <key-map value="INVOICE_EXPORT" rel-field-name="partyIdentificationTypeId"/>
>         </view-link>
> i will attach a diff for my implementation...
> Since we (Antwebsystems) focus on application development and not framework development a check with our framework committers is highly appreciated.
> The patch includes a view which uses this new feature.
> Regards,
> Hans

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira