Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008941Openbravo ERPZ. Otherspublic2009-05-07 10:082009-05-26 00:00
shor123 
mtaal 
normalcriticalalways
closedfixed 
20rPath Linux
 
 
Core
No
0008941: Importing (via DAL) MaterialMgmtMaterialTransaction with AttributeSet id=0 fails
When POSTing a MaterialMgmtMaterialTransaction to the corresponding resource of the DAL, the AttributeSet Element is mandatory. If the AttributeSet is defined using "id=0" the import fails. This may be due to the fact that the STANDARD attribute set is not made active (according to gorkaion, mtaal). When a MaterialMgmtMaterialTransaction is GET using the corresponding resource, is has an AttributeSet Element with id=0.
Post the following XMLs (IDs of business objects (e.g. businessPartner/Products etc.) need to exist):

<ns0:Openbravo xmlns:ns0="http://www.openbravo.com"><MaterialMgmtShipmentInOut [^] id="2009050101AT">
        <id>2009050101AT</id>
        <active>true</active>
        <salesTransaction>false</salesTransaction>
        <documentNo>LIAT0905-01</documentNo>
        <documentAction>--</documentAction>
        <documentStatus>CO</documentStatus>
        <posted>N</posted>
        <processNow>false</processNow>
        <processed>false</processed>
        <documentType id="1000001" />
        <description />
        <salesOrder />
        <orderDate />
        <print>false</print>
        <movementType>V+</movementType>
        <movementDate>2009-05-01T00:00:00.0Z</movementDate>
        <accountingDate>2009-05-01T00:00:00.0Z</accountingDate>
        <businessPartner id="1000000" />
        <partnerAddress id="1000000" />
        <warehouse id="1000000" />
        <orderReference />
        <deliveryTerms>A</deliveryTerms>
        <freightCostRule>I</freightCostRule>
        <freightAmount>0.00</freightAmount>
        <deliveryMethod>P</deliveryMethod>
        <shippingCompany />
        <charge />
        <chargeAmount>0.00</chargeAmount>
        <priority>5</priority>
        <datePrinted />
        <invoice />
        <createLinesFrom>false</createLinesFrom>
        <generateTo>false</generateTo>
        <userContact />
        <salesRepresentative />
        <numberOfPackages />
        <pickDate />
        <shipDate />
        <trackingNo />
        <trxOrganization />
        <project />
        <salesCampaign />
        <activity />
        <stDimension />
        <ndDimension />
        <updateLines>false</updateLines>
        <logistic>false</logistic>
        <generateLines>false</generateLines>
        <calculateFreight>false</calculateFreight>
        <deliveryLocation />
        <freightCategory />
        <freightCurrency />
    </MaterialMgmtShipmentInOut>
</ns0:Openbravo>






<ns0:Openbravo xmlns:ns0="http://www.openbravo.com"><MaterialMgmtShipmentInOutLine [^] id="2009050101AT">
        <id>2009050101AT</id>
        <active>true</active>
        <lineNo>10</lineNo>
        <description />
        <shipmentReceipt id="2009050101AT" />
        <salesOrderLine />
        <storageBin id="1000000" />
        <product id="1000000" />
        <uOM id="100" />
        <movementQuantity>450</movementQuantity>
        <reinvoice>false</reinvoice>
        <attributeSetValue />
        <descriptionOnly>false</descriptionOnly>
        <orderQuantity />
        <orderUOM />
    </MaterialMgmtShipmentInOutLine>
</ns0:Openbravo>



<ns0:Openbravo xmlns:ns0="http://www.openbravo.com"><MaterialMgmtMaterialTransaction [^] id="2009050101AT">
        <id>2009050101AT</id>
        <active>true</active>
        <movementType>V+</movementType>
        <storageBin id="1000000" />
        <product id="1000000" />
        <movementDate>2009-05-01T00:00:00.0Z</movementDate>
        <movementQuantity>450</movementQuantity>
        <physicalInventoryLine />
        <movementLine />
        <goodsShipmentLine id="2009050101AT" />
        <productionLine />
        <projectIssue />
        <attributeSetValue id="0" />
        <orderUOM />
        <orderQuantity />
        <uOM id="100" />
        <internalConsumptionLine />
    </MaterialMgmtMaterialTransaction>
</ns0:Openbravo>



This leads to the following response (The XMLs were POSTes using the Poster Firefox plug-in):

<error><message>org.openbravo.service.web.InvalidContentException: Exception when parsing entity MaterialMgmtMaterialTransaction (2009050101AT):Entity AttributeSetInstance with id 0 not found
Referenced object MaterialMgmtMaterialTransaction (id: 2009050101AT) not present in the xml or in the database.
Caused by: Exception when parsing entity MaterialMgmtMaterialTransaction (2009050101AT):Entity AttributeSetInstance with id 0 not found
Referenced object MaterialMgmtMaterialTransaction (id: 2009050101AT) not present in the xml or in the database.</message></error>
Making STANDARD attribute set active? I do not know if this has any side-effects...
No tags attached.
patch mt_trans.patch (540) 2009-05-07 15:33
https://issues.openbravo.com/file_download.php?file_id=1272&type=bug
Issue History
2009-05-07 10:08shor123New Issue
2009-05-07 10:08shor123Assigned To => rafaroda
2009-05-07 10:11rafarodaAssigned Torafaroda => mtaal
2009-05-07 10:29psarobeStatusnew => scheduled
2009-05-07 10:29psarobefix_in_branch => pi
2009-05-07 11:49mtaalNote Added: 0016124
2009-05-07 15:30shor123Note Added: 0016135
2009-05-07 15:33mtaalFile Added: mt_trans.patch
2009-05-07 15:33mtaalNote Added: 0016137
2009-05-07 16:06shor123Note Added: 0016139
2009-05-08 07:06hgbotCheckin
2009-05-08 07:06hgbotNote Added: 0016163
2009-05-08 07:06hgbotStatusscheduled => resolved
2009-05-08 07:06hgbotResolutionopen => fixed
2009-05-08 07:06hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5f951b4350446c027e97acff7530d64f89fe4d1e [^]
2009-05-25 19:27psarobeStatusresolved => closed
2009-05-26 00:00anonymoussf_bug_id0 => 2796602

Notes
(0016124)
mtaal   
2009-05-07 11:49   
To give an update
I debugged this further, the issue is the following:
attributesetinstance is a table with accesslevel client/organization
when importing xml the REST/XML entityresolver therefore searches on client != 0 and org != 0
but not on system level (client=0, org=0)

This special record however has client=0 and org=0.

The solution is a oneliner, which means that the entityresolver will also search on system level in case of client/org accesslevel.

I will probably check in the solution in the afternoon, after some open minor questions have been discussed internally.
(0016135)
shor123   
2009-05-07 15:30   
Hi Martin,

thank you for your work! If you fixed the issue could you upload a diff file (or send it to me by e-Mail?) so that I can apply the patch to my Openbravo?

Regards,
shor123
(0016137)
mtaal   
2009-05-07 15:33   
The patch is attached, note that I did not yet commit this to Mercurial, the eventual solution may differ from this one (but not much).

gr. Martin
(0016139)
shor123   
2009-05-07 16:06   
Cool! :-) Thanks!
(0016163)
hgbot   
2009-05-08 07:06   
Repository: erp/devel/pi
Changeset: 5f951b4350446c027e97acff7530d64f89fe4d1e
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri May 08 07:06:16 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5f951b4350446c027e97acff7530d64f89fe4d1e [^]

fixes issue 8941: Importing (via DAL) MaterialMgmtMaterialTransaction with AttributeSet id=0 fails

---
M src/org/openbravo/dal/xml/EntityResolver.java
---