Group data when condition is met - xslt

I'm working on a XSL solution to convert a XML file to CSV. The end product need me to read set of invoices from the XML and then group them according to the invoice number and then list the items below the invoice number.
I'm not a fluent in XSL but I wrote the entire thing but I'm stuck on creating the tables. Below is the out put I'm required to create.
I tried to find away to make it work but only way I came close with this posts second answer. Following that I came up with the below code. Also like to mention I'm using XSL v 2.0
<!-- Line items -->
<!-- Full path for the elemnts I'm just lazy to tye the same thing again and again -->
<xsl:variable name="fullPath" select="/BatchObject/BaseTypeContainerList/BaseTypeContainer/BaseTypeObject/Metadata"/>
<!-- Full path for line items. I'm just too lazy -->
<xsl:variable name="fullPathLine" select="/BatchObject/BaseTypeContainerList/BaseTypeContainer/BaseTypeObject/Metadata/LineItemRows/LineItemRow"/>
<xsl:for-each-group select="$fullPath" group-by="$fullPath/Fields/Field[#Label = 'Invoice Number']/Value" >
<xsl:text>
</xsl:text>
<xsl:value-of select="current-grouping-key()"/>
<xsl:text>
</xsl:text>
<xsl:for-each select="$fullPath/Fields/Field[#Label = 'Invoice Number']/Value = current-grouping-key()">
<xsl:value-of select="('
',$fullPathLine/Fields/Field[#Label = 'Line']/Value,';')"/>
<xsl:value-of select="($fullPathLine/Fields/Field[#Label = 'Description']/Value,';')"/>
<xsl:text>
</xsl:text>
<xsl:if test="position() != last()">
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
But the out put is looks like this,
01108840
1 2 3 4 1 2 3 4 5 6 7 1 2 3 4 5 6 ;Ekstra lang Høy skillevegg, ekstra Gummimatte, ekstra Pallet 1200x800 Hylle 1458x216x54 Hylle 1296x216x54 Forhøyningsramme med Bakdeksel 486x270 Bakdeksel 648x378 Pallet 1200x800 Pallet frame 1200X800 Skuff 486x486x216 Hylle 486x486x54 Hyllestige med kortere Verktøyplate 486x270 Bakdeksel 486x270 Gummimatte, hylle ;
01108849
1 2 3 4 1 2 3 4 5 6 7 1 2 3 4 5 6 ;Ekstra lang Høy skillevegg, ekstra Gummimatte, ekstra Pallet 1200x800 Hylle 1458x216x54 Hylle 1296x216x54 Forhøyningsramme med Bakdeksel 486x270 Bakdeksel 648x378 Pallet 1200x800 Pallet frame 1200X800 Skuff 486x486x216 Hylle 486x486x54 Hyllestige med kortere Verktøyplate 486x270 Bakdeksel 486x270 Gummimatte, hylle ;
But out put I want to create is
01108840
1;Ekstra lang Høy
2;skillevegg,
3;ekstra Gummimatte,
4;ekstra Pallet 1200x800
XML data sheet.
<BaseTypeContainerList>
<BaseTypeContainer ID="2292be4cbac2405097d8b40fdbe0068b" DBID="0" Archived="0001-01-01T00:00:00" Destroy="0001-01-01T00:00:00" Created="2020-03-31T12:12:00.2302687+02:00" Modified="2020-03-31T12:12:00.2302687+02:00" CreatedOrder="0" Status="Complete" RejectionMailSendt="false">
<BaseTypeObject xsi:type="Email" ID="5885e93bfc8e404187bc274417ee4ac5">
<Metadata>
<Fields>
<Field ID="186e155a1fb6442b872a88dc5f6e8a7f" Type="Text" Status="Complete" Label="Master">
<Value>KGH_Modulsystem</Value>
</Field>
<Field ID="4911c6aa66864547b5e81ae92e1241af" MappedFieldID="04672b33e6f14285abc11a866c2a993e" Type="Text" Status="Complete" Label="Agreement Number">
<Value>130</Value>
</Field>
<Field ID="6941c04028f149b4b48cd3eb659bb71d" Type="Text" Status="Complete" Label="Seller">
<Value>112885</Value>
</Field>
<Field ID="90236e52a3194885b4812e4d84afda76" Type="Text" Status="Complete" Label="Buyer">
<Value>Modul-System AS</Value>
</Field>
<Field ID="c03844760c5342caab89253570eb6af9" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Customer Number">
<Value>9095</Value>
</Field>
<Field ID="510fe5c44e1d4e9d8499a83cfae92802" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Invoice Number">
<Value>01108840</Value>
</Field>
<Field ID="d34638d12dd64e519bbb5da0b92d1f0b" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Date" Status="Complete" Label="Invoice Date">
<Value>28.11.2019</Value>
</Field>
<Field ID="c121fadca3d34278a68aa2feb26fc969" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Invoice Type">
<Value>CI</Value>
</Field>
<Field ID="2d489e9bb66b49559ee634e140df33b0" MappedFieldID="d9f08184ff57469cb9bb37fa28014249" Type="Text" Status="Complete" Label="Delivery Term">
<Value>DDP</Value>
</Field>
<Field ID="ee9cd176f29245b0978de6d0706dc478" Type="Text" Status="Complete" Label="Delivery Term Location">
<Value>Skjetten</Value>
</Field>
<Field ID="6c23fea43499495590efebb0b4cea541" Type="Text" Status="Complete" Label="Packages">
<Value>1</Value>
</Field>
<Field ID="66fdcc37d3ae4eafa21523a7ec1937d9" Type="Text" Status="Complete" Label="Package Type">
<Value>PX</Value>
</Field>
<Field ID="e6d8303294a8400e933ee622196dbcc3" Type="Text" Status="Complete" Label="Pallet Weight">
<Value>23</Value>
</Field>
<Field ID="a4548889d35d44159c1f19d55017412f" MappedFieldID="04672b33e6f14285abc11a866c2a993e" Type="Text" Status="Complete" Label="Batch Gross Weight">
<Value>3000</Value>
</Field>
<Field ID="05ce757f80a14c1182c59f070be06522" MappedFieldID="04672b33e6f14285abc11a866c2a993e" Type="Text" Status="Complete" Label="Batch Net Weight">
<Value>2500</Value>
</Field>
<Field ID="fce2f65786314fc2ae466639b8c4a7f9" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Over-Head Cost">
<Value>45,22</Value>
</Field>
<Field ID="160f608391854226a6e3fc3d363a5490" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Total Amount">
<Value>452,23</Value>
</Field>
<Field ID="0cd4d1027d9d44b490e306f0e04e36e6" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Currency">
<Value>EUR</Value>
</Field>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line" />
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity" />
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description" />
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number" />
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin" />
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount" />
<Field ID="bc54c6e2147949899ed875c189753846" Type="Text" Status="Complete" Label="Table Amount">
<Value>452,23</Value>
</Field>
<Field ID="e182f943a4694123b7f7182b2b017fca" Type="Text" Status="Complete" Label="Country Sender Receiver">
<Value>SE;NO</Value>
</Field>
<Field ID="e3136a0631c346149a3cfd48e7824f85" MappedFieldID="ce76fa9ee7c74b1aa4367e2eac8de23b" Type="Text" Status="Complete" Label="Email">
<Value>stian.svarholt#kghcustoms.com</Value>
</Field>
</Fields>
<LineItemRows>
<LineItemRow ID="0" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>1</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>1,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Ekstra lang</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>406,74</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="1" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>2</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>2,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Høy skillevegg, ekstra</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>24,90</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="2" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>3</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>3,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Gummimatte, ekstra</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>13,38</Value>
</Field>
</Fields>
</LineItemRow>
</LineItemRows>
<BaseTypeContainer ID="1320da9c026b4b6ead49f7a736676570" DBID="0" Archived="0001-01-01T00:00:00" Destroy="0001-01-01T00:00:00" Created="2020-03-31T12:12:01.9314102+02:00" Modified="2020-03-31T12:12:01.9314102+02:00" CreatedOrder="1" Status="Complete" RejectionMailSendt="false">
<BaseTypeObject xsi:type="Email" ID="b77a7d029687426cb9e60d017df5bb58">
<Metadata>
<Fields>
<Field ID="186e155a1fb6442b872a88dc5f6e8a7f" Type="Text" Status="Complete" Label="Master">
<Value>KGH_Modulsystem</Value>
</Field>
<Field ID="4911c6aa66864547b5e81ae92e1241af" MappedFieldID="04672b33e6f14285abc11a866c2a993e" Type="Text" Status="Complete" Label="Agreement Number">
<Value>130</Value>
</Field>
<Field ID="6941c04028f149b4b48cd3eb659bb71d" Type="Text" Status="Complete" Label="Seller">
<Value>112885</Value>
</Field>
<Field ID="90236e52a3194885b4812e4d84afda76" Type="Text" Status="Complete" Label="Buyer">
<Value>Modul-System AS</Value>
</Field>
<Field ID="c03844760c5342caab89253570eb6af9" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Customer Number">
<Value>9095</Value>
</Field>
<Field ID="510fe5c44e1d4e9d8499a83cfae92802" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Invoice Number">
<Value>01108849</Value>
</Field>
<Field ID="d34638d12dd64e519bbb5da0b92d1f0b" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Date" Status="Complete" Label="Invoice Date">
<Value>28.11.2019</Value>
</Field>
<Field ID="c121fadca3d34278a68aa2feb26fc969" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Invoice Type">
<Value>CI</Value>
</Field>
<Field ID="2d489e9bb66b49559ee634e140df33b0" MappedFieldID="d9f08184ff57469cb9bb37fa28014249" Type="Text" Status="Complete" Label="Delivery Term">
<Value>DDP</Value>
</Field>
<Field ID="ee9cd176f29245b0978de6d0706dc478" Type="Text" Status="Complete" Label="Delivery Term Location">
<Value>Skjetten</Value>
</Field>
<Field ID="6c23fea43499495590efebb0b4cea541" Type="Text" Status="Complete" Label="Packages">
<Value>3</Value>
</Field>
<Field ID="66fdcc37d3ae4eafa21523a7ec1937d9" Type="Text" Status="Complete" Label="Package Type">
<Value>PX</Value>
</Field>
<Field ID="e6d8303294a8400e933ee622196dbcc3" Type="Text" Status="Complete" Label="Pallet Weight">
<Value>23</Value>
</Field>
<Field ID="a4548889d35d44159c1f19d55017412f" MappedFieldID="04672b33e6f14285abc11a866c2a993e" Type="Text" Status="Complete" Label="Batch Gross Weight">
<Value>3000</Value>
</Field>
<Field ID="05ce757f80a14c1182c59f070be06522" MappedFieldID="04672b33e6f14285abc11a866c2a993e" Type="Text" Status="Complete" Label="Batch Net Weight">
<Value>2500</Value>
</Field>
<Field ID="fce2f65786314fc2ae466639b8c4a7f9" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Over-Head Cost">
<Value>19,27</Value>
</Field>
<Field ID="160f608391854226a6e3fc3d363a5490" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Total Amount">
<Value>192,72</Value>
</Field>
<Field ID="0cd4d1027d9d44b490e306f0e04e36e6" MappedFieldID="e05d5ee159484e81b071b8bd85cca134" Type="Text" Status="Complete" Label="Currency">
<Value>EUR</Value>
</Field>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line" />
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity" />
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description" />
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number" />
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin" />
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount" />
<Field ID="bc54c6e2147949899ed875c189753846" Type="Text" Status="Complete" Label="Table Amount">
<Value>192,72</Value>
</Field>
<Field ID="e182f943a4694123b7f7182b2b017fca" Type="Text" Status="Complete" Label="Country Sender Receiver">
<Value>SE;NO</Value>
</Field>
<Field ID="e3136a0631c346149a3cfd48e7824f85" MappedFieldID="ce76fa9ee7c74b1aa4367e2eac8de23b" Type="Text" Status="Complete" Label="Email">
<Value>stian.svarholt#kghcustoms.com</Value>
</Field>
</Fields>
<LineItemRows>
<LineItemRow ID="0" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>1</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>1,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Hylle 1458x216x54</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>33,92</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="1" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>2</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>1,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Hylle 1296x216x54</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>33,44</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="2" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>3</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>1,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Forhøyningsramme med</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>19,20</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="3" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>4</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>2,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Bakdeksel 486x270</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>31,82</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="4" FromPage="1">
<Fields>
<Field ID="26fc88ba67cf4f8fb8e5a25383e9403f" Type="Text" Status="Complete" Label="Line">
<Value>5</Value>
</Field>
<Field ID="86381702799b4265a48d7d96eba3abbf" Type="Text" Status="Complete" Label="Quantity">
<Value>3,00</Value>
</Field>
<Field ID="2d42106344c54189a9045ee0dedb51b6" Type="Text" Status="Complete" Label="Description">
<Value>Bakdeksel 648x378</Value>
</Field>
<Field ID="55d85303fa4c4c37bc51ac0562d887f1" Type="Text" Status="Complete" Label="HS Code">
<Value>94032009</Value>
</Field>
<Field ID="6caaa2a60bc842c193ac8590550108b0" Type="Text" Status="Complete" Label="Article Number">
<Value>94032009</Value>
</Field>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="64cd6620ab5a456997694c8592b9e87b" Type="Text" Status="Complete" Label="Colli" />
<Field ID="c43102102ce64a1db469408a5b131f4d" Type="Text" Status="Complete" Label="Net Weight" />
<Field ID="0565320a98c84652963ce0732cac7ad9" Type="Text" Status="Complete" Label="Origin">
<Value>SE</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>53,07</Value>
</Field>
</Fields>
</LineItemRow>
</LineItemRows>
I know the data set is big but wanted show you what I've to work with. So hope some can shed some light on what I'm doing wrong.

I think instead of
<xsl:for-each select="$fullPath/Fields/Field[#Label = 'Invoice Number']/Value = current-grouping-key()">
you want
<xsl:for-each select="current-group()">

Related

Sum function not working when selecting value after matching condition

I'm trying to extract and sum values from a XML file. The data set have an element called "Pallets" which contains "Y" or "N". So if the "Pallets" value equals "Y" then I want to get the value in "Amount". I went through lot of XSL codes here and on the internet then I came up with the below code part.
<xsl:value-of select=
"('
Pallet Amount',
$fullPath/LineItemRows/LineItemRow/Fields
[Field[#Label = 'Pallets']/Value = 'Y']
/sum(number(translate(Field[#Label = 'Amount']/Value,
',',
'.')
)
)
)"/>
Which is producing the below out put,
Pallet Amount 7.21 7.21 14.06
As you guys can see I do get the values but they're not summing up. My desired out put is 28.48.
Below is a sample set of data which is similar to the XML I'm using (the actual file is too big and it generated by a software we use).
<LineItemRows>
<LineItemRow ID="0" FromPage="1">
<Fields>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>406,74</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="3" FromPage="1">
<Fields>
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>Y</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>7,21</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="0" FromPage="1">
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>N</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>33,92</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="5" FromPage="1">
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>Y</Value>
</Field>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>7,21</Value>
</Field>
</Fields>
</LineItemRow>
<LineItemRow ID="6" FromPage="1">
<Field ID="a16255ad1e9549b48a9a31d001629b36" Type="Text" Status="Complete" Label="Pallets">
<Value>Y</Value>
<Field ID="252a9390778540edac6520d3f9f260b8" Type="Text" Status="Complete" Label="Amount">
<Value>14,06</Value>
</Field>
</Fields>
</LineItemRow>
</LinItemRows>
I also tried some other ways but those literally didn't work. Hope I made my question clear. Also I'm using xsl version 2.0 but system is compatible with version 1.0 as well.
The XPath 2 expression
sum(LineItemRows/LineItemRow/Fields[Field[#Label='Pallets' and Value='Y']]/Field[#Label='Amount']/xs:decimal(translate(Value,',','.')))
If there is any risk that the Y or N value could be padded with whitespace then use normalize-space(Value)='Y' for that value test.
Your original expression was applying the summing within the LineItemRow which would only have found a single value and so you were outputting a sequence of those single-value sums.
The expression here also performs the sum using the XMLSchema Decimal type (declare the namespace xmlns:xs="http://www.w3.org/2001/XMLSchema" for the prefix used in that expression) rather than the default double precision number representation which should avoid inaccuracies and the need to round the sums to two digits.

Not able to add columns to Document Library from Visual Studio template

I am trying to create new document library from SharePoint project template from Visual Studio 2015.
While doing so I am able to create Document Library Template and Instance. Also if I deploy solution to one of my site it creates list as well. Strange thing is if I add a column to the template and then deploy it creates the list but does not create new custom column.
Below is the schema file for the template.
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="SharedDocuments" Direction="$Resources:Direction;" Url="SharedDocuments" BaseType="1" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
<MetaData>
<ContentTypes>
<ContentType ID="0x0101000dba2955561e4de0a115152637e9f8e2" Name="ListFieldsContentType">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
<FieldRef ID="{4b1bf6c6-4f39-45ac-acd5-16fe7a214e5e}" Name="TemplateUrl" />
<FieldRef ID="{cd1ecb9f-dd4e-4f29-ab9e-e9ff40048d64}" Name="xd_ProgID" />
<FieldRef ID="{fbf29b2d-cae5-49aa-8e0a-29955b540122}" Name="xd_Signature" />
<FieldRef ID="{e52012a0-51eb-4c0c-8dfb-9b8a0ebedcb6}" Name="Combine" />
<FieldRef ID="{5d36727b-bcb2-47d2-a231-1f0bc63b7439}" Name="RepairDocument" />
<FieldRef ID="{8f838bdc-4b95-4b26-b86f-3025d2df964f}" Name="TestColumn" />
</FieldRefs>
</ContentType>
<ContentTypeRef ID="0x0101">
<Folder TargetName="Forms/Document" />
</ContentTypeRef>
<ContentTypeRef ID="0x0120" />
</ContentTypes>
<Fields>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="$Resources:core,Title;" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title"></Field>
<Field ID="{4b1bf6c6-4f39-45ac-acd5-16fe7a214e5e}" Type="Text" Name="TemplateUrl" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Template_Link;" XName="TemplateUrl" Filterable="TRUE" Sortable="TRUE" Hidden="TRUE" FromBaseType="TRUE" PITarget="mso-infoPathSolution" PIAttribute="href" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="TemplateUrl"></Field>
<Field ID="{cd1ecb9f-dd4e-4f29-ab9e-e9ff40048d64}" Type="Text" Name="xd_ProgID" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Html_File_Link;" XName="ProgID" Filterable="TRUE" Sortable="TRUE" Hidden="TRUE" FromBaseType="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="xd_ProgID"></Field>
<Field ID="{fbf29b2d-cae5-49aa-8e0a-29955b540122}" Type="Boolean" Group="_Hidden" Name="xd_Signature" DisplaceOnUpgrade="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="xd_Signature" DisplayName="$Resources:core,Xml_signed;" XName="{FBF29B2D-CAE5-49aa-8E0A-29955B540122}" Filterable="TRUE" Sortable="TRUE" Sealed="TRUE" Hidden="TRUE" FromBaseType="TRUE" ReadOnly="TRUE"></Field>
<Field ID="{e52012a0-51eb-4c0c-8dfb-9b8a0ebedcb6}" ReadOnly="TRUE" Type="Computed" Name="Combine" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Merge;" Filterable="FALSE" Sortable="FALSE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Combine">
<FieldRefs>
<FieldRef Name="FSObjType" Key="Primary" />
<FieldRef Name="EncodedAbsUrl" />
<FieldRef Name="TemplateUrl" />
</FieldRefs>
</Field>
<Field ID="{5d36727b-bcb2-47d2-a231-1f0bc63b7439}" ReadOnly="TRUE" Type="Computed" Name="RepairDocument" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Relink;" Filterable="FALSE" Sortable="FALSE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="RepairDocument">
<FieldRefs>
<FieldRef Name="FSObjType" Key="Primary" />
<FieldRef Name="ID" />
</FieldRefs>
</Field>
<Field Name="TestColumn" ID="{8f838bdc-4b95-4b26-b86f-3025d2df964f}" DisplayName="TestColumn" Type="Text" />
</Fields>
<Views>
--Removed--
</Views>
<Forms>
<Form Type="DisplayForm" SetupPath="pages\form.aspx" Url="Forms/DispForm.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" SetupPath="pages\form.aspx" Url="Forms/EditForm.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="Forms/Upload.aspx" WebPartZoneID="Main" />
--Removed--
</Forms>
</MetaData>
</List>
When you upload a document in a Document Library there's an option for you to choose the Content Type, choose your custom Content Type and you'll see the fields you defined.

Why Wizard view cannot find the model?

i make a simple wizard in odoo and i want to show the wizard but, my model can't found of my view . what wrong with my simple code?
This my wizard
class RequestReceiveWizard(models.TransientModel):
_name ='estate.nursery.requestreceivewizard'
# def _default_session(self):
# return self.env['estate.nursery.requestline'].browse(self._context.get('request_id'))
name=fields.Char("Wizard name")
request_id=fields.Many2one('estate.nursery.request')
requestline_ids = fields.Many2many("estate.nursery.requestline")
And this my view :
<!--request Wizard -->
<record model="ir.ui.view" id="request_view_wizard">
<field name="name">Request receive wizard</field>
<field name="model">estate.nursery.requestreceivewizard</field>
<field name="arch" type="xml">
<form string="Wizard For Request Received">
<group collspan="2" col="2">
<field name="name"/>
<field name="requestline_ids"/>
</group>
<footer>
<button name="Apply" type="Action" string="Apply" >Apply</button>
<button special="cancel" string="Cancel">Cancel</button>
</footer>
</form>
</field>
</record>
<act_window id="received_request_wizard" name="Request Wizard"
src_model="estate.nursery.request"
res_model="estate.nursery.requestreceivewizard"
view_mode="form"
target="new"
multi="True" key2="client_action_multi"/>
What wrong with my simple code? And this my error
Model not found: estate.nursery.requestreceivewizard
act_window replace to this record and try this code:
<record id="received_request_wizard" model="ir.actions.act_window">
<field name="name">estate.nursery.request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">estate.nursery.request</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="request_view_wizard"/>
<field name="target">new</field>
</record>
May be It's work for you...

except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')

i created a wizard and now its giving me the above error , it took me ages but couldn't sorted it , between am doing wizard for the first time in Openerp . please help thanks in advance . here is my code
class test_wizard(osv.osv_memory):
_name="test.wizard"
_description="will generate dynamic views, that's all"
_columns={
'age_text': fields.text('text age'),
}
def next(self,cr,uid,ids,contet=None):
test_obj=self.pool.get('test.chbc')
for wiz in self.browse(cr,uid,ids):
if wiz.age_text <=5:
raise osv.except_osv('user error, please slect something , know what')
limit= datetime.date.today()-datetime.timedelta(days=wiz.age_text)
ids_to_del=test_obj.search(cr,uid,[('create_date','<',
limit.striftime('%y-%m-%d 00:00:00'))],context=context)
test_obj.unlink(cr,uid,ids_to_del)
return{}
test_wizard()
here is my xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="test_wizard" model="ir.ui.view">
<field name="name">test.wizard.form</field>
<field name="model">test.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test wizard ">
<label colspan="4" string="select age please , am in a hurry "/>
<field name="age_text" string="Age(days)"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="next" string="Next" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_test_wizard" model="ir.actions.act_window">
<field name="name">Next</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">test.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>
Change you model name mean give the name of the class where you want to put it
<field name="model">test.wizard</field>

Django deserialiser throwing KeyError

Currently, i'm working on deserializing an object model, using the built in django deserialiser and i'm stuck with this KeyError exception, which i can't get more information about which key is the issue. I'm not sure how to progress with debugging as it stands. Anyone have any ideas?
Note: I cannot use the builtin Django debug page.
This is a cut down version of my code:
try:
# loop over deserialised objects returned from 'deserializer'
print "serialise 123"
for obj in serializers.deserialize(format, data):
print "serialise 125"
return True
except DeserializationError:
return -1
except Exception as e:
print "===================="
print type(e)
print "********************"
print e.args
print "!!!!!!!!!!!!!!!!!!!!"
print e
return False
This is the Input XML:
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
<object pk="D5202F00-A8C7-11E1-B68A-00219B15530E" model="contacts.company">
<field type="CharField" name="name">Company Name</field>
<field type="CharField" name="internal_name">ComName</field>
<field type="CharField" name="reference">NoRef</field>
<field to="contacts.companystatus" name="company_status" rel="ManyToOneRel">9FBC97A3-2179-11E0-AEB7-005056C00008</field>
<field type="CharField" name="vat_number">248053</field>
<field type="CharField" name="registration_number">43905309</field>
<field type="FloatField" name="discount">4.0</field>
<field type="TextField" name="notes">gfhdfghdfghdfghdfgh</field>
<field type="TextField" name="jms_code"><None></None></field>
<field type="TextField" name="logo"><None></None></field>
</object>
<object pk="D53368E1-A8C7-11E1-AF74-00219B15530E" model="contacts.address">
<field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>
<field type="CharField" name="group_name">Company Name</field>
<field type="CharField" name="line1">Address 1</field>
<field type="CharField" name="line2">Address 2</field>
<field type="CharField" name="line3">Address 3</field>
<field type="CharField" name="town">Town</field>
<field type="CharField" name="county">Country</field>
<field type="CharField" name="postcode">BA13 3WQ</field>
<field type="CharField" name="country_iso">GB</field>
<field type="CharField" name="telephone">01225555555</field>
<field type="CharField" name="fax">01225555555</field>
<field type="CharField" name="email">Email#Addre.ss</field>
<field type="CharField" name="website">www.si.te</field>
<field type="CharField" name="description">Main</field>
<field type="CharField" name="jms_code"><None></None></field>
<field type="CharField" name="notes">Notes</field>
</object>
<object pk="D53D7B00-A8C7-11E1-A34B-00219B15530E" model="contacts.contact">
<field to="contacts.address" name="address" rel="ManyToOneRel">D53368E1-A8C7-11E1-AF74-00219B15530E</field>
<field to="generic.title" name="title" rel="ManyToOneRel">04CD69A1-7FD4-11E0-A8A3-7071BCB8D2AB</field>
<field type="CharField" name="forename">Forename</field>
<field type="CharField" name="surname">Surname</field>
<field type="CharField" name="position">Position</field>
<field type="CharField" name="mobile">07912345064</field>
<field type="CharField" name="direct_line">01225555555</field>
<field type="CharField" name="email">Email#Addre.ss</field>
<field type="IntegerField" name="origin">1</field>
<field type="IntegerField" name="lead_source">1</field>
<field type="TextField" name="notes">Notes</field>
<field to="contacts.contactstatus" name="contact_status" rel="ManyToOneRel">10293BF4-217A-11E0-AEB7-005056C00008</field>
<field to="contacts.contactmethod" name="contact_method" rel="ManyToOneRel">C240965A-2179-11E0-AEB7-005056C00008</field>
<field type="CharField" name="jms_code"><None></None></field>
</object>
<object pk="89E270EE-A8D3-11E1-AC38-00219B15530E" model="contacts.supplies">
<field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>
<field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">4</field>
</object>
<object pk="89F0539E-A8D3-11E1-A7EE-00219B15530E" model="contacts.supplies">
<field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>
<field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">5</field>
</object>
<object pk="43D00F61-A8C8-11E1-ACFE-00219B15530E" model="contacts.supplier">
<field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>
<field to="contacts.customercategory" name="category" rel="ManyToOneRel"><None></None></field>
<field type="CharField" name="account_number">1</field>
<field type="CharField" name="reference">NoRef</field>
<field type="TextField" name="notes"><None></None></field>
<field type="DateTimeField" name="date_created">2012-05-28 14:23:08</field>
<field type="DateTimeField" name="date_modified">2012-05-28 15:43:50</field>
<field to="auth.user" name="user" rel="ManyToOneRel">1</field>
<field type="CharField" name="jms_code"><None></None></field>
</object>
</django-objects>
This is the codes output:
serialise 123
====================
<type 'exceptions.KeyError'>
********************
(u'<?xml version="1.0" encoding="utf-8"?>\n<django-objects version="1.0">\n <object pk="D5202F00-A8C7-11E1-B68A-00219B15530E" model="contacts.company">\n <field type="CharField" name="name">Compan
y Name</field>\n <field type="CharField" name="internal_name">ComName</field>\n <field type="CharField" name="reference">NoRef</field>\n <field to="contacts.companystatus" name="company_statu
s" rel="ManyToOneRel">9FBC97A3-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="vat_number">248053</field>\n <field type="CharField" name="registration_number">43905309</field
>\n <field type="FloatField" name="discount">4.0</field>\n <field type="TextField" name="notes">gfhdfghdfghdfghdfgh</field>\n <field type="TextField" name="jms_code"><None></None></field>\n
<field type="TextField" name="logo"><None></None></field>\n </object>\n <object pk="D53368E1-A8C7-11E1-AF74-00219B15530E" model="contacts.address">\n <field to="contacts.company" name="company"
rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>\n <field type="CharField" name="group_name">Company Name</field>\n <field type="CharField" name="line1">Address 1</field>\n <f
ield type="CharField" name="line2">Address 2</field>\n <field type="CharField" name="line3">Address 3</field>\n <field type="CharField" name="town">Town</field>\n <field type="CharField" name
="county">Country</field>\n <field type="CharField" name="postcode">BA13 3WQ</field>\n <field type="CharField" name="country_iso">GB</field>\n <field type="CharField" name="telephone">0122555
5555</field>\n <field type="CharField" name="fax">01225555555</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="CharField" name="website">www.si.te</field>\
n <field type="CharField" name="description">Main</field>\n <field type="CharField" name="jms_code"><None></None></field>\n <field type="CharField" name="notes">Notes</field>\n </object>\n
<object pk="D53D7B00-A8C7-11E1-A34B-00219B15530E" model="contacts.contact">\n <field to="contacts.address" name="address" rel="ManyToOneRel">D53368E1-A8C7-11E1-AF74-00219B15530E</field>\n <field
to="generic.title" name="title" rel="ManyToOneRel">04CD69A1-7FD4-11E0-A8A3-7071BCB8D2AB</field>\n <field type="CharField" name="forename">Forename</field>\n <field type="CharField" name="surnam
e">Surname</field>\n <field type="CharField" name="position">Position</field>\n <field type="CharField" name="mobile">07912345064</field>\n <field type="CharField" name="direct_line">01225555
555</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="IntegerField" name="origin">1</field>\n <field type="IntegerField" name="lead_source">1</field>\n <
field type="TextField" name="notes">Notes</field>\n <field to="contacts.contactstatus" name="contact_status" rel="ManyToOneRel">10293BF4-217A-11E0-AEB7-005056C00008</field>\n <field to="contacts
.contactmethod" name="contact_method" rel="ManyToOneRel">C240965A-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>\n <object pk="89E
270EE-A8D3-11E1-AC38-00219B15530E" model="contacts.supplies">\n <field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughti
n.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">4</field>\n </object>\n <object pk="89F0539E-A8D3-11E1-A7EE-00219B15530E" model="contacts.supplies">\n <field to="contact
s.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">5</field>\n
</object>\n <object pk="43D00F61-A8C8-11E1-ACFE-00219B15530E" model="contacts.supplier">\n <field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</fi
eld>\n <field to="contacts.customercategory" name="category" rel="ManyToOneRel"><None></None></field>\n <field type="CharField" name="account_number">1</field>\n <field type="CharField" name=
"reference">NoRef</field>\n <field type="TextField" name="notes"><None></None></field>\n <field type="DateTimeField" name="date_created">2012-05-28 14:23:08</field>\n <field type="DateTimeFie
ld" name="date_modified">2012-05-28 15:43:50</field>\n <field to="auth.user" name="user" rel="ManyToOneRel">1</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>
\n</django-objects>',)
!!!!!!!!!!!!!!!!!!!!
u'<?xml version="1.0" encoding="utf-8"?>\n<django-objects version="1.0">\n <object pk="D5202F00-A8C7-11E1-B68A-00219B15530E" model="contacts.company">\n <field type="CharField" name="name">Company
Name</field>\n <field type="CharField" name="internal_name">ComName</field>\n <field type="CharField" name="reference">NoRef</field>\n <field to="contacts.companystatus" name="company_status
" rel="ManyToOneRel">9FBC97A3-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="vat_number">248053</field>\n <field type="CharField" name="registration_number">43905309</field>
\n <field type="FloatField" name="discount">4.0</field>\n <field type="TextField" name="notes">gfhdfghdfghdfghdfgh</field>\n <field type="TextField" name="jms_code"><None></None></field>\n
<field type="TextField" name="logo"><None></None></field>\n </object>\n <object pk="D53368E1-A8C7-11E1-AF74-00219B15530E" model="contacts.address">\n <field to="contacts.company" name="company"
rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>\n <field type="CharField" name="group_name">Company Name</field>\n <field type="CharField" name="line1">Address 1</field>\n <fi
eld type="CharField" name="line2">Address 2</field>\n <field type="CharField" name="line3">Address 3</field>\n <field type="CharField" name="town">Town</field>\n <field type="CharField" name=
"county">Country</field>\n <field type="CharField" name="postcode">BA13 3WQ</field>\n <field type="CharField" name="country_iso">GB</field>\n <field type="CharField" name="telephone">01225555
555</field>\n <field type="CharField" name="fax">01225555555</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="CharField" name="website">www.si.te</field>\n
<field type="CharField" name="description">Main</field>\n <field type="CharField" name="jms_code"><None></None></field>\n <field type="CharField" name="notes">Notes</field>\n </object>\n <
object pk="D53D7B00-A8C7-11E1-A34B-00219B15530E" model="contacts.contact">\n <field to="contacts.address" name="address" rel="ManyToOneRel">D53368E1-A8C7-11E1-AF74-00219B15530E</field>\n <field
to="generic.title" name="title" rel="ManyToOneRel">04CD69A1-7FD4-11E0-A8A3-7071BCB8D2AB</field>\n <field type="CharField" name="forename">Forename</field>\n <field type="CharField" name="surname
">Surname</field>\n <field type="CharField" name="position">Position</field>\n <field type="CharField" name="mobile">07912345064</field>\n <field type="CharField" name="direct_line">012255555
55</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="IntegerField" name="origin">1</field>\n <field type="IntegerField" name="lead_source">1</field>\n <f
ield type="TextField" name="notes">Notes</field>\n <field to="contacts.contactstatus" name="contact_status" rel="ManyToOneRel">10293BF4-217A-11E0-AEB7-005056C00008</field>\n <field to="contacts.
contactmethod" name="contact_method" rel="ManyToOneRel">C240965A-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>\n <object pk="89E2
70EE-A8D3-11E1-AC38-00219B15530E" model="contacts.supplies">\n <field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughtin
.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">4</field>\n </object>\n <object pk="89F0539E-A8D3-11E1-A7EE-00219B15530E" model="contacts.supplies">\n <field to="contacts
.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">5</field>\n
</object>\n <object pk="43D00F61-A8C8-11E1-ACFE-00219B15530E" model="contacts.supplier">\n <field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</fie
ld>\n <field to="contacts.customercategory" name="category" rel="ManyToOneRel"><None></None></field>\n <field type="CharField" name="account_number">1</field>\n <field type="CharField" name="
reference">NoRef</field>\n <field type="TextField" name="notes"><None></None></field>\n <field type="DateTimeField" name="date_created">2012-05-28 14:23:08</field>\n <field type="DateTimeFiel
d" name="date_modified">2012-05-28 15:43:50</field>\n <field to="auth.user" name="user" rel="ManyToOneRel">1</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>\
n</django-objects>'
Your exception handling code is actually what prevents you from getting at the useful debugging informations. Just remove all this useless exception handling, and you'll get the full error message and a nice traceback.