~unifield-team/unifield-web/us-2156

« back to all changes in this revision

Viewing changes to addons/openerp/controllers/templates/expxml.mako

  • Committer: jf
  • Date: 2016-11-09 09:53:49 UTC
  • mfrom: (4807.5.13 unifield-web)
  • Revision ID: jfb@tempo-consulting.fr-20161109095349-u8x1q3ygjhh8678s
US-1364 [IMP] Standard Export: generate file on server side to speed up process and remove limit of 2000 records

lp:~fabien-morin/unifield-web/fm-us-1364

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0"?>
2
 
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
3
 
xmlns:o="urn:schemas-microsoft-com:office:office"
4
 
xmlns:x="urn:schemas-microsoft-com:office:excel"
5
 
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
6
 
xmlns:html="http://www.w3.org/TR/REC-html40">
7
 
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
8
 
<Title>${title}</Title>
9
 
</DocumentProperties>
10
 
<Styles>
11
 
<Style ss:ID="ssH">
12
 
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
13
 
<Font ss:Bold="1" />
14
 
<Borders>
15
 
  <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
16
 
  <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
17
 
  <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
18
 
  <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
19
 
</Borders>
20
 
</Style>
21
 
<Style ss:ID="ssBorder">
22
 
<NumberFormat ss:Format="Standard"/>
23
 
<Alignment ss:Vertical="Center" ss:WrapText="1"/>
24
 
<Borders>
25
 
  <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
26
 
  <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
27
 
  <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
28
 
  <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
29
 
</Borders>
30
 
</Style>
31
 
<Style ss:ID="sShortDate">
32
 
    <NumberFormat ss:Format="Short Date"/>
33
 
    <Alignment ss:Vertical="Center" ss:WrapText="1"/>
34
 
    <Borders>
35
 
        <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
36
 
        <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
37
 
        <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
38
 
        <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
39
 
    </Borders>
40
 
</Style>
41
 
<Style ss:ID="sDate">
42
 
    <NumberFormat ss:Format="General Date"/>
43
 
    <Alignment ss:Vertical="Center" ss:WrapText="1"/>
44
 
    <Borders>
45
 
        <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" />
46
 
        <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" />
47
 
        <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" />
48
 
        <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" />
49
 
    </Borders>
50
 
</Style>
51
 
</Styles>
52
 
<Worksheet ss:Name="Sheet">
53
 
<Table ss:ExpandedColumnCount="${len(fields)}" ss:ExpandedRowCount="${len(result)+1}" x:FullColumns="1"
54
 
x:FullRows="1">
55
 
% for x in fields:
56
 
<Column ss:AutoFitWidth="1" ss:Width="70" />
57
 
% endfor
58
 
<Row>
59
 
% for header in fields:
60
 
<Cell ss:StyleID="ssH"><Data ss:Type="String">${header}</Data></Cell>
61
 
% endfor
62
 
</Row>
63
 
% for row in result:
64
 
<Row>
65
 
  % for k in row:
66
 
     <% d = '%s'%k %>
67
 
     % if d in ('True', 'False'):
68
 
       <Cell ss:StyleID="ssBorder">
69
 
        <Data ss:Type="Boolean">${d=='True' and '1' or '0'}</Data>
70
 
     % elif d and re.match('^[0-9]{4}-[0-9]{2}-[0-9]{2}$', d):
71
 
       <Cell ss:StyleID="sShortDate">
72
 
        <Data ss:Type="DateTime">${d}T00:00:00.000</Data>
73
 
     % elif d and re.match('^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$', d):
74
 
       <Cell ss:StyleID="sDate">
75
 
        <Data ss:Type="DateTime">${d.replace(' ','T')}.000</Data>
76
 
     % elif d and re.match('^-?[0-9]+\.?[0-9]*$', d):
77
 
       <Cell ss:StyleID="ssBorder">
78
 
        <Data ss:Type="Number">${d}</Data>
79
 
     % else:
80
 
       <Cell ss:StyleID="ssBorder">
81
 
        <Data ss:Type="String">${d or ''}</Data>
82
 
    % endif
83
 
</Cell>
84
 
  % endfor
85
 
</Row>
86
 
% endfor
87
 
</Table>
88
 
<AutoFilter x:Range="R1C1:R1C${len(fields)}" xmlns="urn:schemas-microsoft-com:office:excel">
89
 
</AutoFilter>
90
 
</Worksheet>
91
 
</Workbook>