Merge lp:~vauxoo/account-financial-report/7.0-mig_account_financial_report-linealization into lp:~account-report-core-editor/account-financial-report/7.0
- 7.0-mig_account_financial_report-linealization
- Merge into 7.0
Proposed by
Yanina Aular (Vauxoo)
Status: | Merged |
---|---|
Merged at revision: | 41 |
Proposed branch: | lp:~vauxoo/account-financial-report/7.0-mig_account_financial_report-linealization |
Merge into: | lp:~account-report-core-editor/account-financial-report/7.0 |
Diff against target: |
1110 lines (+393/-312) 10 files modified
account_financial_report/model/__init__.py (+3/-3) account_financial_report/report/__init__.py (+1/-1) account_financial_report/report/balance_full.rml (+1/-1) account_financial_report/report/balance_full_13_cols.rml (+81/-76) account_financial_report/report/balance_full_4_cols.rml (+2/-2) account_financial_report/report/balance_full_4_cols_analytic_ledger.rml (+3/-3) account_financial_report/report/balance_full_qtr_cols.rml (+25/-25) account_financial_report/report/parser.py (+149/-93) account_financial_report/wizard/__init__.py (+1/-1) account_financial_report/wizard/wizard.py (+127/-107) |
To merge this branch: | bzr merge lp:~vauxoo/account-financial-report/7.0-mig_account_financial_report-linealization |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Yanina Aular (Vauxoo) (community) | Approve | ||
hbto [Vauxoo] http://www.vauxoo.com | Pending | ||
Nhomar - Vauxoo | Pending | ||
Review via email: mp+170830@code.launchpad.net |
This proposal supersedes a proposal from 2013-06-21.
Commit message
Description of the change
Optimization and linearization of compute process to improve the time, now from 29 minutes to 90 secs, great improvement!
To post a comment you must log in.
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote : Posted in a previous version of this proposal | # |
review:
Needs Fixing
Revision history for this message
Yanina Aular (Vauxoo) (yanina-aular) wrote : Posted in a previous version of this proposal | # |
Understood Nhomar : )
Revision history for this message
Yanina Aular (Vauxoo) (yanina-aular) wrote : | # |
Commented, cleaned, tested and ready to go. ; )
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account_financial_report/model/__init__.py' |
2 | --- account_financial_report/model/__init__.py 2012-08-06 06:40:23 +0000 |
3 | +++ account_financial_report/model/__init__.py 2013-06-21 14:36:28 +0000 |
4 | @@ -4,8 +4,8 @@ |
5 | # Module Writen to OpenERP, Open Source Management Solution |
6 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
7 | # All Rights Reserved |
8 | -###############Credits###################################################### |
9 | -# Coded by: Humberto Arocha <hbto@vauxoo.com> |
10 | +# Credits###################################################### |
11 | +# Coded by: Humberto Arocha <hbto@vauxoo.com> |
12 | # Planified by: Rafael Silva <rsilvam@vauxoo.com> |
13 | # Audited by: Nhomar Hernandez <nhomar@vauxoo.com> |
14 | ############################################################################# |
15 | @@ -21,7 +21,7 @@ |
16 | # |
17 | # You should have received a copy of the GNU Affero General Public License |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | -################################################################################ |
20 | +########################################################################## |
21 | |
22 | import account_financial_report |
23 | import res_company |
24 | |
25 | === modified file 'account_financial_report/report/__init__.py' |
26 | --- account_financial_report/report/__init__.py 2012-07-27 05:27:31 +0000 |
27 | +++ account_financial_report/report/__init__.py 2013-06-21 14:36:28 +0000 |
28 | @@ -3,7 +3,7 @@ |
29 | # Module Writen to OpenERP, Open Source Management Solution |
30 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
31 | # All Rights Reserved |
32 | -###############Credits###################################################### |
33 | +# Credits###################################################### |
34 | # Coded by: Humberto Arocha humberto@openerp.com.ve |
35 | # Angelica Barrios angelicaisabelb@gmail.com |
36 | # Jordi Esteve <jesteve@zikzakmedia.com> |
37 | |
38 | === modified file 'account_financial_report/report/balance_full.rml' |
39 | --- account_financial_report/report/balance_full.rml 2013-06-17 22:11:44 +0000 |
40 | +++ account_financial_report/report/balance_full.rml 2013-06-21 14:36:28 +0000 |
41 | @@ -121,7 +121,7 @@ |
42 | <td> |
43 | <para style="TITLE_LEFT_ALIGN"> |
44 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
45 | - <font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
46 | + <font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
47 | </para> |
48 | </td> |
49 | </tr> |
50 | |
51 | === modified file 'account_financial_report/report/balance_full_13_cols.rml' |
52 | --- account_financial_report/report/balance_full_13_cols.rml 2013-06-17 22:11:44 +0000 |
53 | +++ account_financial_report/report/balance_full_13_cols.rml 2013-06-21 14:36:28 +0000 |
54 | @@ -4,7 +4,7 @@ |
55 | <pageTemplate id="first"> |
56 | <frame id="first" x1="0.5cm" y1="1.0cm" width="41.0cm" height="23cm"/> |
57 | <pageGraphics> |
58 | - <setFont name="Helvetica" size="9"/> |
59 | + <setFont name="Helvetica" size="6"/> |
60 | |
61 | <image x="1.0cm" y="24.0cm" width="5.0cm">[[company.logo and company.logo or removeParentNode('image')]]</image> |
62 | <!-- |
63 | @@ -34,7 +34,7 @@ |
64 | </tr> |
65 | </blockTable> |
66 | </place> |
67 | - <drawRightString x="192mm" y="5mm">[[ get_informe_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> |
68 | + <drawRightString x="410.9mm" y="5mm">[[ get_informe_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString> |
69 | </pageGraphics> |
70 | |
71 | </pageTemplate> |
72 | @@ -64,7 +64,12 @@ |
73 | </blockTableStyle> |
74 | |
75 | <initialize> |
76 | - <paraStyle name="all" alignment="justify"/> |
77 | + <paraStyle |
78 | + name="all" |
79 | + alignment="justify" |
80 | + fontName="Helvetica" |
81 | + fontSize="6.0" |
82 | + /> |
83 | </initialize> |
84 | <paraStyle |
85 | name="TITLE_LEFT_ALIGN" |
86 | @@ -149,79 +154,79 @@ |
87 | <td> |
88 | <para style="TITLE_LEFT_ALIGN"> |
89 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
90 | - <font>[[ (a['total']==True) and formatLang(a['bal1'] and a['bal1'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
91 | - </para> |
92 | - </td> |
93 | - <td> |
94 | - <para style="TITLE_LEFT_ALIGN"> |
95 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
96 | - <font>[[ (a['total']==True) and formatLang(a['bal2'] and a['bal2'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
97 | - </para> |
98 | - </td> |
99 | - <td> |
100 | - <para style="TITLE_LEFT_ALIGN"> |
101 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
102 | - <font>[[ (a['total']==True) and formatLang(a['bal3'] and a['bal3'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
103 | - </para> |
104 | - </td> |
105 | - <td> |
106 | - <para style="TITLE_LEFT_ALIGN"> |
107 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
108 | - <font>[[ (a['total']==True) and formatLang(a['bal4'] and a['bal4'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
109 | - </para> |
110 | - </td> |
111 | - <td> |
112 | - <para style="TITLE_LEFT_ALIGN"> |
113 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
114 | - <font>[[ (a['total']==True) and formatLang(a['bal5'] and a['bal5'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
115 | - </para> |
116 | - </td> |
117 | - <td> |
118 | - <para style="TITLE_LEFT_ALIGN"> |
119 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
120 | - <font>[[ (a['total']==True) and formatLang(a['bal6'] and a['bal6'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
121 | - </para> |
122 | - </td> |
123 | - <td> |
124 | - <para style="TITLE_LEFT_ALIGN"> |
125 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
126 | - <font>[[ (a['total']==True) and formatLang(a['bal7'] and a['bal7'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
127 | - </para> |
128 | - </td> |
129 | - <td> |
130 | - <para style="TITLE_LEFT_ALIGN"> |
131 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
132 | - <font>[[ (a['total']==True) and formatLang(a['bal8'] and a['bal8'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
133 | - </para> |
134 | - </td> |
135 | - <td> |
136 | - <para style="TITLE_LEFT_ALIGN"> |
137 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
138 | - <font>[[ (a['total']==True) and formatLang(a['bal9'] and a['bal9'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
139 | - </para> |
140 | - </td> |
141 | - <td> |
142 | - <para style="TITLE_LEFT_ALIGN"> |
143 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
144 | - <font>[[ (a['total']==True) and formatLang(a['bal10'] and a['bal10'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
145 | - </para> |
146 | - </td> |
147 | - <td> |
148 | - <para style="TITLE_LEFT_ALIGN"> |
149 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
150 | - <font>[[ (a['total']==True) and formatLang(a['bal11'] and a['bal11'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
151 | - </para> |
152 | - </td> |
153 | - <td> |
154 | - <para style="TITLE_LEFT_ALIGN"> |
155 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
156 | - <font>[[ (a['total']==True) and formatLang(a['bal12'] and a['bal12'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
157 | - </para> |
158 | - </td> |
159 | - <td> |
160 | - <para style="TITLE_LEFT_ALIGN"> |
161 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
162 | - <font>[[ (a['total']==True) and formatLang(a['bal13'] and a['bal13'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
163 | + <font>[[ (a['total']==True) and formatLang(a['bal1'] and a['bal1'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
164 | + </para> |
165 | + </td> |
166 | + <td> |
167 | + <para style="TITLE_LEFT_ALIGN"> |
168 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
169 | + <font>[[ (a['total']==True) and formatLang(a['bal2'] and a['bal2'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
170 | + </para> |
171 | + </td> |
172 | + <td> |
173 | + <para style="TITLE_LEFT_ALIGN"> |
174 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
175 | + <font>[[ (a['total']==True) and formatLang(a['bal3'] and a['bal3'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
176 | + </para> |
177 | + </td> |
178 | + <td> |
179 | + <para style="TITLE_LEFT_ALIGN"> |
180 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
181 | + <font>[[ (a['total']==True) and formatLang(a['bal4'] and a['bal4'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
182 | + </para> |
183 | + </td> |
184 | + <td> |
185 | + <para style="TITLE_LEFT_ALIGN"> |
186 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
187 | + <font>[[ (a['total']==True) and formatLang(a['bal5'] and a['bal5'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
188 | + </para> |
189 | + </td> |
190 | + <td> |
191 | + <para style="TITLE_LEFT_ALIGN"> |
192 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
193 | + <font>[[ (a['total']==True) and formatLang(a['bal6'] and a['bal6'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
194 | + </para> |
195 | + </td> |
196 | + <td> |
197 | + <para style="TITLE_LEFT_ALIGN"> |
198 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
199 | + <font>[[ (a['total']==True) and formatLang(a['bal7'] and a['bal7'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
200 | + </para> |
201 | + </td> |
202 | + <td> |
203 | + <para style="TITLE_LEFT_ALIGN"> |
204 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
205 | + <font>[[ (a['total']==True) and formatLang(a['bal8'] and a['bal8'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
206 | + </para> |
207 | + </td> |
208 | + <td> |
209 | + <para style="TITLE_LEFT_ALIGN"> |
210 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
211 | + <font>[[ (a['total']==True) and formatLang(a['bal9'] and a['bal9'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
212 | + </para> |
213 | + </td> |
214 | + <td> |
215 | + <para style="TITLE_LEFT_ALIGN"> |
216 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
217 | + <font>[[ (a['total']==True) and formatLang(a['bal10'] and a['bal10'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
218 | + </para> |
219 | + </td> |
220 | + <td> |
221 | + <para style="TITLE_LEFT_ALIGN"> |
222 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
223 | + <font>[[ (a['total']==True) and formatLang(a['bal11'] and a['bal11'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
224 | + </para> |
225 | + </td> |
226 | + <td> |
227 | + <para style="TITLE_LEFT_ALIGN"> |
228 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
229 | + <font>[[ (a['total']==True) and formatLang(a['bal12'] and a['bal12'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
230 | + </para> |
231 | + </td> |
232 | + <td> |
233 | + <para style="TITLE_LEFT_ALIGN"> |
234 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
235 | + <font>[[ (a['total']==True) and formatLang(a['bal13'] and a['bal13'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
236 | </para> |
237 | </td> |
238 | </tr> |
239 | |
240 | === modified file 'account_financial_report/report/balance_full_4_cols.rml' |
241 | --- account_financial_report/report/balance_full_4_cols.rml 2013-06-17 22:11:44 +0000 |
242 | +++ account_financial_report/report/balance_full_4_cols.rml 2013-06-21 14:36:28 +0000 |
243 | @@ -122,7 +122,7 @@ |
244 | <td> |
245 | <para style="TITLE_LEFT_ALIGN"> |
246 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
247 | - <font>[[ (a['total']==True) and formatLang(a['balanceinit'] and a['balanceinit'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
248 | + <font>[[ (a['total']==True) and formatLang(a['balanceinit'] and a['balanceinit'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
249 | </para> |
250 | </td> |
251 | <td> |
252 | @@ -140,7 +140,7 @@ |
253 | <td> |
254 | <para style="TITLE_LEFT_ALIGN"> |
255 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
256 | - <font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
257 | + <font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
258 | </para> |
259 | </td> |
260 | </tr> |
261 | |
262 | === modified file 'account_financial_report/report/balance_full_4_cols_analytic_ledger.rml' |
263 | --- account_financial_report/report/balance_full_4_cols_analytic_ledger.rml 2013-06-17 22:11:44 +0000 |
264 | +++ account_financial_report/report/balance_full_4_cols_analytic_ledger.rml 2013-06-21 14:36:28 +0000 |
265 | @@ -205,7 +205,7 @@ |
266 | <td> |
267 | <para style="TITLE_LEFT_ALIGN"> |
268 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier-Bold"}) or removeParentNode('font') ]]</font> |
269 | - <font>[[ (a['total']==True) and formatLang(a['balanceinit'] and a['balanceinit'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
270 | + <font>[[ (a['total']==True) and formatLang(a['balanceinit'] and a['balanceinit'] * a.get('change_sign',1.0) or 0.0, digits=2, grouping=True) or '']]</font> |
271 | </para> |
272 | </td> |
273 | <td> |
274 | @@ -223,7 +223,7 @@ |
275 | <td> |
276 | <para style="TITLE_LEFT_ALIGN"> |
277 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier-Bold"}) or removeParentNode('font') ]]</font> |
278 | - <font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
279 | + <font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign',1.0) or 0.0, digits=2, grouping=True) or '']]</font> |
280 | </para> |
281 | </td> |
282 | </tr> |
283 | @@ -281,7 +281,7 @@ |
284 | <td> |
285 | <para style="TITLE_LEFT_ALIGN"> |
286 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
287 | - <font>[[ (a['total']==True) and formatLang(m['balance'] and m['balance'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
288 | + <font>[[ (a['total']==True) and formatLang(m['balance'] and m['balance'] * a.get('change_sign',1.0) or 0.0, digits=2, grouping=True) or '']]</font> |
289 | </para> |
290 | </td> |
291 | </tr> |
292 | |
293 | === modified file 'account_financial_report/report/balance_full_qtr_cols.rml' |
294 | --- account_financial_report/report/balance_full_qtr_cols.rml 2013-06-17 22:11:44 +0000 |
295 | +++ account_financial_report/report/balance_full_qtr_cols.rml 2013-06-21 14:36:28 +0000 |
296 | @@ -125,31 +125,31 @@ |
297 | <td> |
298 | <para style="TITLE_LEFT_ALIGN"> |
299 | <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
300 | - <font>[[ (a['total']==True) and formatLang(a['bal1'] and a['bal1'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
301 | - </para> |
302 | - </td> |
303 | - <td> |
304 | - <para style="TITLE_LEFT_ALIGN"> |
305 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
306 | - <font>[[ (a['total']==True) and formatLang(a['bal2'] and a['bal2'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
307 | - </para> |
308 | - </td> |
309 | - <td> |
310 | - <para style="TITLE_LEFT_ALIGN"> |
311 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
312 | - <font>[[ (a['total']==True) and formatLang(a['bal3'] and a['bal3'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
313 | - </para> |
314 | - </td> |
315 | - <td> |
316 | - <para style="TITLE_LEFT_ALIGN"> |
317 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
318 | - <font>[[ (a['total']==True) and formatLang(a['bal4'] and a['bal4'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
319 | - </para> |
320 | - </td> |
321 | - <td> |
322 | - <para style="TITLE_LEFT_ALIGN"> |
323 | - <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
324 | - <font>[[ (a['total']==True) and formatLang(a['bal5'] and a['bal5'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font> |
325 | + <font>[[ (a['total']==True) and formatLang(a['bal1'] and (a['bal1'] * a.get('change_sign',1)) or 0.0, digits=2, grouping=True) or '']]</font> |
326 | + </para> |
327 | + </td> |
328 | + <td> |
329 | + <para style="TITLE_LEFT_ALIGN"> |
330 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
331 | + <font>[[ (a['total']==True) and formatLang(a['bal2'] and a['bal2'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
332 | + </para> |
333 | + </td> |
334 | + <td> |
335 | + <para style="TITLE_LEFT_ALIGN"> |
336 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
337 | + <font>[[ (a['total']==True) and formatLang(a['bal3'] and a['bal3'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
338 | + </para> |
339 | + </td> |
340 | + <td> |
341 | + <para style="TITLE_LEFT_ALIGN"> |
342 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
343 | + <font>[[ (a['total']==True) and formatLang(a['bal4'] and a['bal4'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
344 | + </para> |
345 | + </td> |
346 | + <td> |
347 | + <para style="TITLE_LEFT_ALIGN"> |
348 | + <font>[[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> |
349 | + <font>[[ (a['total']==True) and formatLang(a['bal5'] and a['bal5'] * a.get('change_sign',1) or 0.0, digits=2, grouping=True) or '']]</font> |
350 | </para> |
351 | </td> |
352 | </tr> |
353 | |
354 | === modified file 'account_financial_report/report/parser.py' |
355 | --- account_financial_report/report/parser.py 2013-06-18 00:53:21 +0000 |
356 | +++ account_financial_report/report/parser.py 2013-06-21 14:36:28 +0000 |
357 | @@ -35,6 +35,8 @@ |
358 | from tools import config |
359 | from tools.translate import _ |
360 | from osv import osv |
361 | +import pdb |
362 | +from openerp.tools.safe_eval import safe_eval as eval |
363 | |
364 | |
365 | class account_balance(report_sxw.rml_parse): |
366 | @@ -347,6 +349,8 @@ |
367 | ################################################################ |
368 | # Get the accounts # |
369 | ################################################################ |
370 | + all_account_ids = _get_children_and_consol( |
371 | + self.cr, self.uid, account_ids, 100, self.context) |
372 | |
373 | account_ids = _get_children_and_consol(self.cr, self.uid, account_ids, form[ |
374 | 'display_account_level'] and form['display_account_level'] or 100, self.context) |
375 | @@ -359,7 +363,6 @@ |
376 | |
377 | credit_account_ids = list(set( |
378 | credit_account_ids) - set(debit_account_ids)) |
379 | - |
380 | # |
381 | # Generate the report lines (checking each account) |
382 | # |
383 | @@ -388,21 +391,15 @@ |
384 | p.append(l) |
385 | l = [] |
386 | a = 0 |
387 | - |
388 | - #~ period_ids = p |
389 | - |
390 | + tot_bal1 = 0.0 |
391 | + tot_bal2 = 0.0 |
392 | + tot_bal3 = 0.0 |
393 | + tot_bal4 = 0.0 |
394 | + tot_bal5 = 0.0 |
395 | elif form['columns'] == 'thirteen': |
396 | period_ids = period_obj.search(self.cr, self.uid, [( |
397 | 'fiscalyear_id', '=', fiscalyear.id), ('special', '=', False)], order='date_start asc') |
398 | - |
399 | - if form['columns'] == 'qtr': |
400 | tot_bal1 = 0.0 |
401 | - tot_bal2 = 0.0 |
402 | - tot_bal3 = 0.0 |
403 | - tot_bal4 = 0.0 |
404 | - tot_bal5 = 0.0 |
405 | - |
406 | - elif form['columns'] == 'thirteen': |
407 | tot_bal1 = 0.0 |
408 | tot_bal2 = 0.0 |
409 | tot_bal3 = 0.0 |
410 | @@ -416,12 +413,8 @@ |
411 | tot_bal11 = 0.0 |
412 | tot_bal12 = 0.0 |
413 | tot_bal13 = 0.0 |
414 | - |
415 | else: |
416 | - |
417 | - ctx_init = _ctx_init(self.context.copy()) |
418 | ctx_end = _ctx_end(self.context.copy()) |
419 | - |
420 | tot_bin = 0.0 |
421 | tot_deb = 0.0 |
422 | tot_crd = 0.0 |
423 | @@ -432,6 +425,117 @@ |
424 | result_acc = [] |
425 | tot = {} |
426 | |
427 | + ############################################################### |
428 | + # Calculations of credit, debit and balance, |
429 | + # without repeating operations. |
430 | + ############################################################### |
431 | + |
432 | + account_black_ids = account_obj.search(self.cr, self.uid, ( |
433 | + [('id', 'in', [i[0] for i in all_account_ids]), |
434 | + ('type', 'not in', |
435 | + ('view', 'consolidation'))])) |
436 | + |
437 | + account_not_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [ |
438 | + i[0] for i in all_account_ids]), ('type', 'in', ('view', 'consolidation'))])) |
439 | + |
440 | + # This could be done quickly with a sql sentence |
441 | + account_not_black = account_obj.browse( |
442 | + self.cr, self.uid, account_not_black_ids) |
443 | + account_not_black.sort(key=lambda x: x.level) |
444 | + account_not_black.reverse() |
445 | + account_not_black_ids = [i.id for i in account_not_black] |
446 | + |
447 | + all_account_period = {} # All accounts per period |
448 | + |
449 | + # Iteration limit depending on the number of columns |
450 | + if form['columns'] == 'thirteen': |
451 | + limit = 13 |
452 | + elif form['columns'] == 'qtr': |
453 | + limit = 5 |
454 | + else: |
455 | + limit = 1 |
456 | + |
457 | + for p_act in range(limit): |
458 | + if limit != 1: |
459 | + if p_act == limit-1: |
460 | + form['periods'] = period_ids |
461 | + else: |
462 | + if form['columns'] == 'thirteen': |
463 | + form['periods'] = [period_ids[p_act]] |
464 | + elif form['columns'] == 'qtr': |
465 | + form['periods'] = p[p_act] |
466 | + |
467 | + if form['inf_type'] == 'IS': |
468 | + ctx_to_use = _ctx_end(self.context.copy()) |
469 | + else: |
470 | + ctx_i = _ctx_init(self.context.copy()) |
471 | + ctx_to_use = _ctx_end(self.context.copy()) |
472 | + |
473 | + account_black = account_obj.browse( |
474 | + self.cr, self.uid, account_black_ids, ctx_to_use) |
475 | + |
476 | + if form['inf_type'] == 'BS': |
477 | + account_black_init = account_obj.browse( |
478 | + self.cr, self.uid, account_black_ids, ctx_i) |
479 | + |
480 | + #~ Black |
481 | + dict_black = {} |
482 | + for i in account_black: |
483 | + d = i.debit |
484 | + c = i.credit |
485 | + dict_black[i.id] = { |
486 | + 'obj': i, |
487 | + 'debit': d, |
488 | + 'credit': c, |
489 | + 'balance': d-c |
490 | + } |
491 | + if form['inf_type'] == 'BS': |
492 | + dict_black.get(i.id)['balanceinit'] = 0.0 |
493 | + |
494 | + # If the report is a balance sheet |
495 | + # Balanceinit values are added to the dictionary |
496 | + if form['inf_type'] == 'BS': |
497 | + for i in account_black_init: |
498 | + dict_black.get(i.id)['balanceinit'] = i.balance |
499 | + |
500 | + #~ Not black |
501 | + dict_not_black = {} |
502 | + for i in account_not_black: |
503 | + dict_not_black[i.id] = { |
504 | + 'obj': i, 'debit': 0.0, 'credit': 0.0, 'balance': 0.0} |
505 | + if form['inf_type'] == 'BS': |
506 | + dict_not_black.get(i.id)['balanceinit'] = 0.0 |
507 | + |
508 | + all_account = dict_black.copy( |
509 | + ) #It makes a copy because they modify |
510 | + |
511 | + for acc_id in account_not_black_ids: |
512 | + acc_childs = dict_not_black.get(acc_id).get('obj').child_id |
513 | + for child_id in acc_childs: |
514 | + dict_not_black.get(acc_id)['debit'] += all_account.get( |
515 | + child_id.id).get('debit') |
516 | + dict_not_black.get(acc_id)['credit'] += all_account.get( |
517 | + child_id.id).get('credit') |
518 | + dict_not_black.get(acc_id)['balance'] += all_account.get( |
519 | + child_id.id).get('balance') |
520 | + if form['inf_type'] == 'BS': |
521 | + dict_not_black.get(acc_id)['balanceinit'] += all_account.get( |
522 | + child_id.id).get('balanceinit') |
523 | + all_account[acc_id] = dict_not_black[acc_id] |
524 | + |
525 | + if p_act == limit-1: |
526 | + all_account_period['all'] = all_account |
527 | + else: |
528 | + if form['columns'] == 'thirteen': |
529 | + all_account_period[p_act] = all_account |
530 | + elif form['columns'] == 'qtr': |
531 | + all_account_period[p_act] = all_account |
532 | + |
533 | + ############################################################### |
534 | + # End of the calculations of credit, debit and balance |
535 | + # |
536 | + ############################################################### |
537 | + |
538 | for aa_id in account_ids: |
539 | id = aa_id[0] |
540 | |
541 | @@ -452,21 +556,11 @@ |
542 | } |
543 | |
544 | if form['columns'] == 'qtr': |
545 | - pn = 1 |
546 | - for p_id in p: |
547 | - form['periods'] = p_id |
548 | - |
549 | - ctx_init = _ctx_init(self.context.copy()) |
550 | - aa_brw_init = account_obj.browse( |
551 | - self.cr, self.uid, id, ctx_init) |
552 | - |
553 | - ctx_end = _ctx_end(self.context.copy()) |
554 | - aa_brw_end = account_obj.browse( |
555 | - self.cr, self.uid, id, ctx_end) |
556 | + for pn in range(1, 5): |
557 | |
558 | if form['inf_type'] == 'IS': |
559 | d, c, b = map(z, [ |
560 | - aa_brw_end.debit, aa_brw_end.credit, aa_brw_end.balance]) |
561 | + all_account_period.get(pn-1).get(id).get('debit', 0.0), all_account_period.get(pn-1).get(id).get('credit', 0.0), all_account_period.get(pn-1).get(id).get('balance', 0.0)]) |
562 | res.update({ |
563 | 'dbr%s' % pn: self.exchange(d), |
564 | 'cdr%s' % pn: self.exchange(c), |
565 | @@ -474,7 +568,7 @@ |
566 | }) |
567 | else: |
568 | i, d, c = map(z, [ |
569 | - aa_brw_init.balance, aa_brw_end.debit, aa_brw_end.credit]) |
570 | + all_account_period.get(pn-1).get(id).get('balanceinit', 0.0), all_account_period.get(pn-1).get(id).get('debit', 0.0), all_account_period.get(pn-1).get(id).get('credit', 0.0)]) |
571 | b = z(i+d-c) |
572 | res.update({ |
573 | 'dbr%s' % pn: self.exchange(d), |
574 | @@ -482,21 +576,9 @@ |
575 | 'bal%s' % pn: self.exchange(b), |
576 | }) |
577 | |
578 | - pn += 1 |
579 | - |
580 | - form['periods'] = period_ids |
581 | - |
582 | - ctx_init = _ctx_init(self.context.copy()) |
583 | - aa_brw_init = account_obj.browse( |
584 | - self.cr, self.uid, id, ctx_init) |
585 | - |
586 | - ctx_end = _ctx_end(self.context.copy()) |
587 | - aa_brw_end = account_obj.browse( |
588 | - self.cr, self.uid, id, ctx_end) |
589 | - |
590 | if form['inf_type'] == 'IS': |
591 | d, c, b = map(z, [ |
592 | - aa_brw_end.debit, aa_brw_end.credit, aa_brw_end.balance]) |
593 | + all_account_period.get('all').get(id).get('debit', 0.0), all_account_period.get('all').get(id).get('credit',0.0), all_account_period.get('all').get(id).get('balance')]) |
594 | res.update({ |
595 | 'dbr5': self.exchange(d), |
596 | 'cdr5': self.exchange(c), |
597 | @@ -504,7 +586,7 @@ |
598 | }) |
599 | else: |
600 | i, d, c = map(z, [ |
601 | - aa_brw_init.balance, aa_brw_end.debit, aa_brw_end.credit]) |
602 | + all_account_period.get('all').get(id).get('balanceinit', 0.0), all_account_period.get('all').get(id).get('debit', 0.0), all_account_period.get('all').get(id).get('credit',0.0)]) |
603 | b = z(i+d-c) |
604 | res.update({ |
605 | 'dbr5': self.exchange(d), |
606 | @@ -514,20 +596,11 @@ |
607 | |
608 | elif form['columns'] == 'thirteen': |
609 | pn = 1 |
610 | - for p_id in period_ids: |
611 | - form['periods'] = [p_id] |
612 | - |
613 | - ctx_init = _ctx_init(self.context.copy()) |
614 | - aa_brw_init = account_obj.browse( |
615 | - self.cr, self.uid, id, ctx_init) |
616 | - |
617 | - ctx_end = _ctx_end(self.context.copy()) |
618 | - aa_brw_end = account_obj.browse( |
619 | - self.cr, self.uid, id, ctx_end) |
620 | + for p_num in range(12): |
621 | |
622 | if form['inf_type'] == 'IS': |
623 | d, c, b = map(z, [ |
624 | - aa_brw_end.debit, aa_brw_end.credit, aa_brw_end.balance]) |
625 | + all_account_period.get(p_num).get(id).get('debit', 0.0), all_account_period.get(p_num).get(id).get('credit', 0.0), all_account_period.get(p_num).get(id).get('balance', 0.0)]) |
626 | res.update({ |
627 | 'dbr%s' % pn: self.exchange(d), |
628 | 'cdr%s' % pn: self.exchange(c), |
629 | @@ -535,7 +608,7 @@ |
630 | }) |
631 | else: |
632 | i, d, c = map(z, [ |
633 | - aa_brw_init.balance, aa_brw_end.debit, aa_brw_end.credit]) |
634 | + all_account_period.get(p_num).get(id).get('balanceinit', 0.0), all_account_period.get(p_num).get(id).get('debit', 0.0), all_account_period.get(p_num).get(id).get('credit', 0.0)]) |
635 | b = z(i+d-c) |
636 | res.update({ |
637 | 'dbr%s' % pn: self.exchange(d), |
638 | @@ -545,19 +618,9 @@ |
639 | |
640 | pn += 1 |
641 | |
642 | - form['periods'] = period_ids |
643 | - |
644 | - ctx_init = _ctx_init(self.context.copy()) |
645 | - aa_brw_init = account_obj.browse( |
646 | - self.cr, self.uid, id, ctx_init) |
647 | - |
648 | - ctx_end = _ctx_end(self.context.copy()) |
649 | - aa_brw_end = account_obj.browse( |
650 | - self.cr, self.uid, id, ctx_end) |
651 | - |
652 | if form['inf_type'] == 'IS': |
653 | d, c, b = map(z, [ |
654 | - aa_brw_end.debit, aa_brw_end.credit, aa_brw_end.balance]) |
655 | + all_account_period.get('all').get(id).get('debit', 0.0), all_account_period.get('all').get(id).get('credit', 0.0), all_account_period.get('all').get(id).get('balance', 0.0)]) |
656 | res.update({ |
657 | 'dbr13': self.exchange(d), |
658 | 'cdr13': self.exchange(c), |
659 | @@ -565,7 +628,7 @@ |
660 | }) |
661 | else: |
662 | i, d, c = map(z, [ |
663 | - aa_brw_init.balance, aa_brw_end.debit, aa_brw_end.credit]) |
664 | + all_account_period.get('all').get(id).get('balanceinit', 0.0), all_account_period.get('all').get(id).get('debit', 0.0), all_account_period.get('all').get(id).get('credit', 0.0)]) |
665 | b = z(i+d-c) |
666 | res.update({ |
667 | 'dbr13': self.exchange(d), |
668 | @@ -574,14 +637,8 @@ |
669 | }) |
670 | |
671 | else: |
672 | - |
673 | - aa_brw_init = account_obj.browse( |
674 | - self.cr, self.uid, id, ctx_init) |
675 | - aa_brw_end = account_obj.browse( |
676 | - self.cr, self.uid, id, ctx_end) |
677 | - |
678 | i, d, c = map(z, [ |
679 | - aa_brw_init.balance, aa_brw_end.debit, aa_brw_end.credit]) |
680 | + all_account_period.get('all').get(id).get('balanceinit', 0.0), all_account_period.get('all').get(id).get('debit', 0.0), all_account_period.get('all').get(id).get('credit', 0.0)]) |
681 | b = z(i+d-c) |
682 | res.update({ |
683 | 'balanceinit': self.exchange(i), |
684 | @@ -695,7 +752,6 @@ |
685 | tot_bal11 += res.get('bal11', 0.0) |
686 | tot_bal12 += res.get('bal12', 0.0) |
687 | tot_bal13 += res.get('bal13', 0.0) |
688 | - |
689 | else: |
690 | tot_check = True |
691 | #~ tot[res['id']] = True |
692 | @@ -715,26 +771,26 @@ |
693 | } |
694 | if form['columns'] == 'qtr': |
695 | res2.update(dict( |
696 | - bal1=tot_bal1, |
697 | - bal2=tot_bal2, |
698 | - bal3=tot_bal3, |
699 | - bal4=tot_bal4, |
700 | - bal5=tot_bal5,)) |
701 | + bal1=z(tot_bal1), |
702 | + bal2=z(tot_bal2), |
703 | + bal3=z(tot_bal3), |
704 | + bal4=z(tot_bal4), |
705 | + bal5=z(tot_bal5),)) |
706 | elif form['columns'] == 'thirteen': |
707 | res2.update(dict( |
708 | - bal1=tot_bal1, |
709 | - bal2=tot_bal2, |
710 | - bal3=tot_bal3, |
711 | - bal4=tot_bal4, |
712 | - bal5=tot_bal5, |
713 | - bal6=tot_bal6, |
714 | - bal7=tot_bal7, |
715 | - bal8=tot_bal8, |
716 | - bal9=tot_bal9, |
717 | - bal10=tot_bal10, |
718 | - bal11=tot_bal11, |
719 | - bal12=tot_bal12, |
720 | - bal13=tot_bal13,)) |
721 | + bal1=z(tot_bal1), |
722 | + bal2=z(tot_bal2), |
723 | + bal3=z(tot_bal3), |
724 | + bal4=z(tot_bal4), |
725 | + bal5=z(tot_bal5), |
726 | + bal6=z(tot_bal6), |
727 | + bal7=z(tot_bal7), |
728 | + bal8=z(tot_bal8), |
729 | + bal9=z(tot_bal9), |
730 | + bal10=z(tot_bal10), |
731 | + bal11=z(tot_bal11), |
732 | + bal12=z(tot_bal12), |
733 | + bal13=z(tot_bal13),)) |
734 | |
735 | else: |
736 | res2.update({ |
737 | |
738 | === modified file 'account_financial_report/wizard/__init__.py' |
739 | --- account_financial_report/wizard/__init__.py 2012-07-27 23:03:42 +0000 |
740 | +++ account_financial_report/wizard/__init__.py 2013-06-21 14:36:28 +0000 |
741 | @@ -3,7 +3,7 @@ |
742 | # Module Writen to OpenERP, Open Source Management Solution |
743 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
744 | # All Rights Reserved |
745 | -###############Credits###################################################### |
746 | +# Credits###################################################### |
747 | # Coded by: Humberto Arocha humberto@openerp.com.ve |
748 | # Angelica Barrios angelicaisabelb@gmail.com |
749 | # Jordi Esteve <jesteve@zikzakmedia.com> |
750 | |
751 | === modified file 'account_financial_report/wizard/wizard.py' |
752 | --- account_financial_report/wizard/wizard.py 2012-08-15 07:44:40 +0000 |
753 | +++ account_financial_report/wizard/wizard.py 2013-06-21 14:36:28 +0000 |
754 | @@ -3,7 +3,7 @@ |
755 | # Module Writen to OpenERP, Open Source Management Solution |
756 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
757 | # All Rights Reserved |
758 | -###############Credits###################################################### |
759 | +# Credits###################################################### |
760 | # Coded by: Humberto Arocha humberto@openerp.com.ve |
761 | # Angelica Barrios angelicaisabelb@gmail.com |
762 | # Jordi Esteve <jesteve@zikzakmedia.com> |
763 | @@ -26,138 +26,153 @@ |
764 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
765 | ############################################################################## |
766 | |
767 | -from osv import osv,fields |
768 | +from osv import osv, fields |
769 | import pooler |
770 | import time |
771 | from tools.translate import _ |
772 | |
773 | + |
774 | class wizard_report(osv.osv_memory): |
775 | _name = "wizard.report" |
776 | |
777 | _columns = { |
778 | - 'afr_id': fields.many2one('afr','Custom Report', help='If you have already set a Custom Report, Select it Here.'), |
779 | - 'company_id': fields.many2one('res.company','Company',required=True), |
780 | + 'afr_id': fields.many2one('afr', 'Custom Report', help='If you have already set a Custom Report, Select it Here.'), |
781 | + 'company_id': fields.many2one('res.company', 'Company', required=True), |
782 | 'currency_id': fields.many2one('res.currency', 'Currency', help="Currency at which this report will be expressed. If not selected will be used the one set in the company"), |
783 | - 'inf_type': fields.selection([('BS','Balance Sheet'),('IS','Income Statement')],'Type',required=True), |
784 | - 'columns': fields.selection([('one','End. Balance'),('two','Debit | Credit'), ('four','Initial | Debit | Credit | YTD'), ('five','Initial | Debit | Credit | Period | YTD'),('qtr',"4 QTR's | YTD"),('thirteen','12 Months | YTD')],'Columns',required=True), |
785 | - 'display_account': fields.selection([('all','All Accounts'),('bal', 'With Balance'),('mov','With movements'),('bal_mov','With Balance / Movements')],'Display accounts'), |
786 | - 'display_account_level': fields.integer('Up to level',help='Display accounts up to this level (0 to show all)'), |
787 | - |
788 | - 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), |
789 | - |
790 | - 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Fiscal Year for this report',required=True), |
791 | - 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), |
792 | - |
793 | + 'inf_type': fields.selection([('BS', 'Balance Sheet'), ('IS', 'Income Statement')], 'Type', required=True), |
794 | + 'columns': fields.selection([('one', 'End. Balance'), ('two', 'Debit | Credit'), ('four', 'Initial | Debit | Credit | YTD'), ('five', 'Initial | Debit | Credit | Period | YTD'), ('qtr', "4 QTR's | YTD"), ('thirteen', '12 Months | YTD')], 'Columns', required=True), |
795 | + 'display_account': fields.selection([('all', 'All Accounts'), ('bal', 'With Balance'), ('mov', 'With movements'), ('bal_mov', 'With Balance / Movements')], 'Display accounts'), |
796 | + 'display_account_level': fields.integer('Up to level', help='Display accounts up to this level (0 to show all)'), |
797 | + |
798 | + 'account_list': fields.many2many('account.account', 'rel_wizard_account', 'account_list', 'account_id', 'Root accounts', required=True), |
799 | + |
800 | + 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Fiscal Year for this report', required=True), |
801 | + 'periods': fields.many2many('account.period', 'rel_wizard_period', 'wizard_id', 'period_id', 'Periods', help='All periods in the fiscal year if empty'), |
802 | + |
803 | 'analytic_ledger': fields.boolean('Analytic Ledger', help="Allows to Generate an Analytic Ledger for accounts with moves. Available when Balance Sheet and 'Initial | Debit | Credit | YTD' are selected"), |
804 | - |
805 | + |
806 | 'tot_check': fields.boolean('Summarize?', help='Checking will add a new line at the end of the Report which will Summarize Columns in Report'), |
807 | - 'lab_str': fields.char('Description', help='Description for the Summary', size= 128), |
808 | - |
809 | + 'lab_str': fields.char('Description', help='Description for the Summary', size=128), |
810 | + |
811 | #~ Deprecated fields |
812 | - 'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'), |
813 | + 'filter': fields.selection([('bydate', 'By Date'), ('byperiod', 'By Period'), ('all', 'By Date and Period'), ('none', 'No Filter')], 'Date/Period Filter'), |
814 | 'date_to': fields.date('End date'), |
815 | 'date_from': fields.date('Start date'), |
816 | } |
817 | - |
818 | + |
819 | _defaults = { |
820 | 'date_from': lambda *a: time.strftime('%Y-%m-%d'), |
821 | 'date_to': lambda *a: time.strftime('%Y-%m-%d'), |
822 | - 'filter': lambda *a:'byperiod', |
823 | + 'filter': lambda *a: 'byperiod', |
824 | 'display_account_level': lambda *a: 0, |
825 | - 'inf_type': lambda *a:'BS', |
826 | - 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c), |
827 | + 'inf_type': lambda *a: 'BS', |
828 | + 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c), |
829 | 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid), |
830 | - 'display_account': lambda *a:'bal_mov', |
831 | - 'columns': lambda *a:'five', |
832 | + 'display_account': lambda *a: 'bal_mov', |
833 | + 'columns': lambda *a: 'five', |
834 | } |
835 | |
836 | - def onchange_inf_type(self,cr,uid,ids,inf_type,context=None): |
837 | + def onchange_inf_type(self, cr, uid, ids, inf_type, context=None): |
838 | if context is None: |
839 | context = {} |
840 | - res = {'value':{}} |
841 | - |
842 | + res = {'value': {}} |
843 | + |
844 | if inf_type != 'BS': |
845 | - res['value'].update({'analytic_ledger':False}) |
846 | - |
847 | + res['value'].update({'analytic_ledger': False}) |
848 | + |
849 | return res |
850 | |
851 | - def onchange_columns(self,cr,uid,ids,columns,fiscalyear,periods,context=None): |
852 | + def onchange_columns(self, cr, uid, ids, columns, fiscalyear, periods, context=None): |
853 | if context is None: |
854 | context = {} |
855 | - res = {'value':{}} |
856 | - |
857 | + res = {'value': {}} |
858 | + |
859 | p_obj = self.pool.get("account.period") |
860 | - all_periods = p_obj.search(cr,uid,[('fiscalyear_id','=',fiscalyear),('special','=',False)],context=context) |
861 | + all_periods = p_obj.search(cr, uid, [('fiscalyear_id', '=', fiscalyear), ( |
862 | + 'special', '=', False)], context=context) |
863 | s = set(periods[0][2]) |
864 | t = set(all_periods) |
865 | go = periods[0][2] and s.issubset(t) or False |
866 | - |
867 | + |
868 | if columns != 'four': |
869 | - res['value'].update({'analytic_ledger':False}) |
870 | - |
871 | + res['value'].update({'analytic_ledger': False}) |
872 | + |
873 | if columns in ('qtr', 'thirteen'): |
874 | - res['value'].update({'periods':all_periods}) |
875 | + res['value'].update({'periods': all_periods}) |
876 | else: |
877 | if go: |
878 | - res['value'].update({'periods':periods}) |
879 | + res['value'].update({'periods': periods}) |
880 | else: |
881 | - res['value'].update({'periods':[]}) |
882 | - return res |
883 | - |
884 | - def onchange_analytic_ledger(self,cr,uid,ids,company_id,analytic_ledger,context=None): |
885 | - if context is None: |
886 | - context = {} |
887 | - context['company_id']=company_id |
888 | - res = {'value':{}} |
889 | - cur_id = self.pool.get('res.company').browse(cr,uid,company_id,context=context).currency_id.id |
890 | - res['value'].update({'currency_id':cur_id}) |
891 | - return res |
892 | - |
893 | - def onchange_company_id(self,cr,uid,ids,company_id,context=None): |
894 | - if context is None: |
895 | - context = {} |
896 | - context['company_id']=company_id |
897 | - res = {'value':{}} |
898 | - |
899 | + res['value'].update({'periods': []}) |
900 | + return res |
901 | + |
902 | + def onchange_analytic_ledger(self, cr, uid, ids, company_id, analytic_ledger, context=None): |
903 | + if context is None: |
904 | + context = {} |
905 | + context['company_id'] = company_id |
906 | + res = {'value': {}} |
907 | + cur_id = self.pool.get('res.company').browse( |
908 | + cr, uid, company_id, context=context).currency_id.id |
909 | + res['value'].update({'currency_id': cur_id}) |
910 | + return res |
911 | + |
912 | + def onchange_company_id(self, cr, uid, ids, company_id, context=None): |
913 | + if context is None: |
914 | + context = {} |
915 | + context['company_id'] = company_id |
916 | + res = {'value': {}} |
917 | + |
918 | if not company_id: |
919 | return res |
920 | - |
921 | - cur_id = self.pool.get('res.company').browse(cr,uid,company_id,context=context).currency_id.id |
922 | - fy_id = self.pool.get('account.fiscalyear').find(cr, uid,context=context) |
923 | - res['value'].update({'fiscalyear':fy_id}) |
924 | - res['value'].update({'currency_id':cur_id}) |
925 | - res['value'].update({'account_list':[]}) |
926 | - res['value'].update({'periods':[]}) |
927 | - res['value'].update({'afr_id':None}) |
928 | + |
929 | + cur_id = self.pool.get('res.company').browse( |
930 | + cr, uid, company_id, context=context).currency_id.id |
931 | + fy_id = self.pool.get('account.fiscalyear').find( |
932 | + cr, uid, context=context) |
933 | + res['value'].update({'fiscalyear': fy_id}) |
934 | + res['value'].update({'currency_id': cur_id}) |
935 | + res['value'].update({'account_list': []}) |
936 | + res['value'].update({'periods': []}) |
937 | + res['value'].update({'afr_id': None}) |
938 | return res |
939 | |
940 | - def onchange_afr_id(self,cr,uid,ids,afr_id,context=None): |
941 | + def onchange_afr_id(self, cr, uid, ids, afr_id, context=None): |
942 | if context is None: |
943 | context = {} |
944 | - res = {'value':{}} |
945 | - if not afr_id: return res |
946 | - afr_brw = self.pool.get('afr').browse(cr,uid,afr_id,context=context) |
947 | - res['value'].update({'currency_id':afr_brw.currency_id and afr_brw.currency_id.id or afr_brw.company_id.currency_id.id}) |
948 | - res['value'].update({'inf_type':afr_brw.inf_type or 'BS'}) |
949 | - res['value'].update({'columns':afr_brw.columns or 'five'}) |
950 | - res['value'].update({'display_account':afr_brw.display_account or 'bal_mov'}) |
951 | - res['value'].update({'display_account_level':afr_brw.display_account_level or 0}) |
952 | - res['value'].update({'fiscalyear':afr_brw.fiscalyear_id and afr_brw.fiscalyear_id.id}) |
953 | - res['value'].update({'account_list':[acc.id for acc in afr_brw.account_ids]}) |
954 | - res['value'].update({'periods':[p.id for p in afr_brw.period_ids]}) |
955 | - res['value'].update({'analytic_ledger':afr_brw.analytic_ledger or False}) |
956 | - res['value'].update({'tot_check':afr_brw.tot_check or False}) |
957 | - res['value'].update({'lab_str':afr_brw.lab_str or _('Write a Description for your Summary Total')}) |
958 | + res = {'value': {}} |
959 | + if not afr_id: |
960 | + return res |
961 | + afr_brw = self.pool.get('afr').browse(cr, uid, afr_id, context=context) |
962 | + res['value'].update({ |
963 | + 'currency_id': afr_brw.currency_id and afr_brw.currency_id.id or afr_brw.company_id.currency_id.id}) |
964 | + res['value'].update({'inf_type': afr_brw.inf_type or 'BS'}) |
965 | + res['value'].update({'columns': afr_brw.columns or 'five'}) |
966 | + res['value'].update({ |
967 | + 'display_account': afr_brw.display_account or 'bal_mov'}) |
968 | + res['value'].update({ |
969 | + 'display_account_level': afr_brw.display_account_level or 0}) |
970 | + res['value'].update({ |
971 | + 'fiscalyear': afr_brw.fiscalyear_id and afr_brw.fiscalyear_id.id}) |
972 | + res['value'].update({'account_list': [ |
973 | + acc.id for acc in afr_brw.account_ids]}) |
974 | + res['value'].update({'periods': [p.id for p in afr_brw.period_ids]}) |
975 | + res['value'].update({ |
976 | + 'analytic_ledger': afr_brw.analytic_ledger or False}) |
977 | + res['value'].update({'tot_check': afr_brw.tot_check or False}) |
978 | + res['value'].update({'lab_str': afr_brw.lab_str or _( |
979 | + 'Write a Description for your Summary Total')}) |
980 | return res |
981 | - |
982 | + |
983 | def _get_defaults(self, cr, uid, data, context=None): |
984 | if context is None: |
985 | context = {} |
986 | - user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) |
987 | + user = pooler.get_pool(cr.dbname).get( |
988 | + 'res.users').browse(cr, uid, uid, context=context) |
989 | if user.company_id: |
990 | - company_id = user.company_id.id |
991 | + company_id = user.company_id.id |
992 | else: |
993 | - company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] |
994 | + company_id = pooler.get_pool(cr.dbname).get( |
995 | + 'res.company').search(cr, uid, [('parent_id', '=', False)])[0] |
996 | data['form']['company_id'] = company_id |
997 | fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') |
998 | data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) |
999 | @@ -168,49 +183,51 @@ |
1000 | if context is None: |
1001 | context = {} |
1002 | if data['form']['filter'] == 'bydate': |
1003 | - self._check_date(cr, uid, data, context) |
1004 | + self._check_date(cr, uid, data, context) |
1005 | return data['form'] |
1006 | - |
1007 | + |
1008 | def _check_date(self, cr, uid, data, context=None): |
1009 | if context is None: |
1010 | context = {} |
1011 | - |
1012 | + |
1013 | if data['form']['date_from'] > data['form']['date_to']: |
1014 | - raise osv.except_osv(_('Error !'),('La fecha final debe ser mayor a la inicial')) |
1015 | - |
1016 | + raise osv.except_osv(_('Error !'), ( |
1017 | + 'La fecha final debe ser mayor a la inicial')) |
1018 | + |
1019 | sql = """SELECT f.id, f.date_start, f.date_stop |
1020 | FROM account_fiscalyear f |
1021 | - WHERE '%s' = f.id """%(data['form']['fiscalyear']) |
1022 | + WHERE '%s' = f.id """ % (data['form']['fiscalyear']) |
1023 | cr.execute(sql) |
1024 | res = cr.dictfetchall() |
1025 | |
1026 | if res: |
1027 | if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_from'] < res[0]['date_start']): |
1028 | - raise osv.except_osv(_('UserError'),'Las fechas deben estar entre %s y %s' % (res[0]['date_start'], res[0]['date_stop'])) |
1029 | + raise osv.except_osv(_('UserError'), 'Las fechas deben estar entre %s y %s' % ( |
1030 | + res[0]['date_start'], res[0]['date_stop'])) |
1031 | else: |
1032 | return 'report' |
1033 | else: |
1034 | - raise osv.except_osv(_('UserError'),'No existe periodo fiscal') |
1035 | + raise osv.except_osv(_('UserError'), 'No existe periodo fiscal') |
1036 | |
1037 | def period_span(self, cr, uid, ids, fy_id, context=None): |
1038 | if context is None: |
1039 | context = {} |
1040 | ap_obj = self.pool.get('account.period') |
1041 | - fy_id = fy_id and type(fy_id) in (list,tuple) and fy_id[0] or fy_id |
1042 | + fy_id = fy_id and type(fy_id) in (list, tuple) and fy_id[0] or fy_id |
1043 | if not ids: |
1044 | #~ No hay periodos |
1045 | - return ap_obj.search(cr, uid, [('fiscalyear_id','=',fy_id),('special','=',False)],order='date_start asc') |
1046 | - |
1047 | + return ap_obj.search(cr, uid, [('fiscalyear_id', '=', fy_id), ('special', '=', False)], order='date_start asc') |
1048 | + |
1049 | ap_brws = ap_obj.browse(cr, uid, ids, context=context) |
1050 | date_start = min([period.date_start for period in ap_brws]) |
1051 | date_stop = max([period.date_stop for period in ap_brws]) |
1052 | - |
1053 | - return ap_obj.search(cr, uid, [('fiscalyear_id','=',fy_id),('special','=',False),('date_start','>=',date_start),('date_stop','<=',date_stop)],order='date_start asc') |
1054 | - |
1055 | + |
1056 | + return ap_obj.search(cr, uid, [('fiscalyear_id', '=', fy_id), ('special', '=', False), ('date_start', '>=', date_start), ('date_stop', '<=', date_stop)], order='date_start asc') |
1057 | + |
1058 | def print_report(self, cr, uid, ids, data, context=None): |
1059 | if context is None: |
1060 | context = {} |
1061 | - |
1062 | + |
1063 | data = {} |
1064 | data['ids'] = context.get('active_ids', []) |
1065 | data['model'] = context.get('active_model', 'ir.ui.menu') |
1066 | @@ -220,7 +237,8 @@ |
1067 | del data['form']['date_from'] |
1068 | del data['form']['date_to'] |
1069 | |
1070 | - data['form']['periods'] = self.period_span(cr, uid, data['form']['periods'], data['form']['fiscalyear']) |
1071 | + data['form']['periods'] = self.period_span(cr, uid, data[ |
1072 | + 'form']['periods'], data['form']['fiscalyear']) |
1073 | |
1074 | elif data['form']['filter'] == 'bydate': |
1075 | self._check_date(cr, uid, data) |
1076 | @@ -231,16 +249,18 @@ |
1077 | del data['form']['periods'] |
1078 | else: |
1079 | self._check_date(cr, uid, data) |
1080 | - lis2 = str(data['form']['periods']).replace("[","(").replace("]",")") |
1081 | - sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin |
1082 | - from account_period p |
1083 | - where p.id in %s"""%lis2 |
1084 | + lis2 = str(data['form']['periods']).replace( |
1085 | + "[", "(").replace("]", ")") |
1086 | + sqlmm = """select min(p.date_start) as inicio, max(p.date_stop) as fin |
1087 | + from account_period p |
1088 | + where p.id in %s""" % lis2 |
1089 | cr.execute(sqlmm) |
1090 | minmax = cr.dictfetchall() |
1091 | if minmax: |
1092 | if (data['form']['date_to'] < minmax[0]['inicio']) or (data['form']['date_from'] > minmax[0]['fin']): |
1093 | - raise osv.except_osv(_('Error !'),_('La interseccion entre el periodo y fecha es vacio')) |
1094 | - |
1095 | + raise osv.except_osv(_('Error !'), _( |
1096 | + 'La interseccion entre el periodo y fecha es vacio')) |
1097 | + |
1098 | if data['form']['columns'] == 'one': |
1099 | name = 'afr.1cols' |
1100 | if data['form']['columns'] == 'two': |
1101 | @@ -256,7 +276,7 @@ |
1102 | name = 'afr.qtrcols' |
1103 | if data['form']['columns'] == 'thirteen': |
1104 | name = 'afr.13cols' |
1105 | - |
1106 | + |
1107 | return {'type': 'ir.actions.report.xml', 'report_name': name, 'datas': data} |
1108 | - |
1109 | + |
1110 | wizard_report() |
Yanina.
Please can you:
1.- Run the autopep8 command to all your module.
2.- All comments in the code in english.
Great Job my darling