Merge lp:~odossmann/unifield-addons/UFTP_312 into lp:unifield-addons
- UFTP_312
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4638 |
Proposed branch: | lp:~odossmann/unifield-addons/UFTP_312 |
Merge into: | lp:unifield-addons |
Diff against target: |
791 lines (+204/-225) 9 files modified
account/report/account_partner_balance.py (+10/-4) account/report/account_partner_balance.rml (+48/-48) account/report/account_partner_ledger.py (+47/-105) account/report/account_partner_ledger_other.rml (+63/-32) account/report/account_profit_horizontal.rml (+18/-17) account/report/account_profit_loss.py (+2/-4) account/report/account_profit_loss.rml (+10/-10) account/wizard/account_report_partner_ledger.py (+4/-4) account/wizard/account_report_partner_ledger_view.xml (+2/-1) |
To merge this branch: | bzr merge lp:~odossmann/unifield-addons/UFTP_312 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+239965@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 4639. By Olivier DOSSMANN
-
UFTP-312 [IMP] Point 17 - Partner Ledger: Some modifications:
* Change title to "Partner Ledger"
* Untick by default the "initial balance" field - 4640. By Olivier DOSSMANN
-
UFTP-312 [ADD] Point 18 - Partner Ledger: Add a new criteria that permit to exclude tax accounts from the report
- 4641. By Olivier DOSSMANN
-
UFTP-312 [IMP] Point 18 - Partner balance (pdf): Exclude tax from result if user asked for it
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account/report/account_partner_balance.py' |
2 | --- account/report/account_partner_balance.py 2014-09-24 09:16:10 +0000 |
3 | +++ account/report/account_partner_balance.py 2014-11-03 08:53:50 +0000 |
4 | @@ -62,11 +62,18 @@ |
5 | else: |
6 | self.ACCOUNT_TYPE = ('payable', 'receivable') |
7 | |
8 | + # UFTP-312: Permit to exclude tax accounts from the report |
9 | + self.exclude_tax = data['form'].get('tax', False) |
10 | + self.TAX_REQUEST = '' |
11 | + if self.exclude_tax is True: |
12 | + self.TAX_REQUEST = "AND t.code != 'tax'" |
13 | + |
14 | self.cr.execute("SELECT a.id " \ |
15 | "FROM account_account a " \ |
16 | "LEFT JOIN account_account_type t " \ |
17 | - "ON (a.type = t.code) " \ |
18 | + "ON (a.user_type = t.id) " \ |
19 | "WHERE a.type IN %s " \ |
20 | + " " + self.TAX_REQUEST + " " \ |
21 | "AND a.active", (self.ACCOUNT_TYPE,)) |
22 | self.account_ids = [a for (a,) in self.cr.fetchall()] |
23 | res = super(partner_balance, self).set_context(objects, data, ids, report_type=report_type) |
24 | @@ -98,15 +105,14 @@ |
25 | "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \ |
26 | "JOIN account_account ac ON (l.account_id = ac.id)" \ |
27 | "JOIN account_move am ON (am.id = l.move_id)" \ |
28 | - "WHERE ac.type IN %s " \ |
29 | + "WHERE ac.id IN %s " \ |
30 | "AND am.state IN %s " \ |
31 | "AND " + self.query + "" \ |
32 | "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \ |
33 | "ORDER BY l.account_id,p.name", |
34 | - (self.ACCOUNT_TYPE, tuple(move_state))) |
35 | + (tuple(self.account_ids), tuple(move_state))) |
36 | res = self.cr.dictfetchall() |
37 | |
38 | - |
39 | if self.display_partner == 'non-zero_balance': |
40 | full_account = [r for r in res if r['sdebit'] > 0 or r['scredit'] > 0] |
41 | else: |
42 | |
43 | === modified file 'account/report/account_partner_balance.rml' |
44 | --- account/report/account_partner_balance.rml 2011-01-14 00:11:01 +0000 |
45 | +++ account/report/account_partner_balance.rml 2014-11-03 08:53:50 +0000 |
46 | @@ -31,30 +31,30 @@ |
47 | </blockTableStyle> |
48 | <blockTableStyle id="Table2"> |
49 | <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/> |
50 | - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/> |
51 | - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,2" stop="-1,2"/> |
52 | - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,3" stop="-1,-1"/> |
53 | - <blockValign value="TOP"/> |
54 | - <blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/> |
55 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/> |
56 | + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,2" stop="-1,2"/> |
57 | + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,3" stop="-1,-1"/> |
58 | + <blockValign value="TOP"/> |
59 | + <blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/> |
60 | </blockTableStyle> |
61 | <blockTableStyle id="Table3"> |
62 | <blockAlignment value="LEFT"/> |
63 | <blockValign value="TOP"/> |
64 | - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/> |
65 | + <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/> |
66 | </blockTableStyle> |
67 | <blockTableStyle id="Table4"> |
68 | <blockAlignment value="LEFT"/> |
69 | <blockValign value="TOP"/> |
70 | <lineStyle kind="GRID" colorName="black"/> |
71 | </blockTableStyle> |
72 | - <blockTableStyle id="Tableau3"> |
73 | + <blockTableStyle id="Tableau3"> |
74 | <blockAlignment value="LEFT"/> |
75 | <blockValign value="TOP"/> |
76 | <lineStyle kind="LINEBELOW" colorName="#e6e6e6" /> |
77 | <lineStyle kind="OUTLINE" colorName="#e6e6e6" /> |
78 | <blockBackground colorName="white" start="0,0" stop="-1,0"/> |
79 | </blockTableStyle> |
80 | - <blockTableStyle id="Table_Sub_Header_Content"> |
81 | + <blockTableStyle id="Table_Sub_Header_Content"> |
82 | <blockAlignment value="LEFT"/> |
83 | <blockValign value="TOP"/> |
84 | <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/> |
85 | @@ -81,7 +81,7 @@ |
86 | <blockTableStyle id="Table2_header"> |
87 | <blockAlignment value="LEFT"/> |
88 | <blockValign value="TOP"/> |
89 | - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/> |
90 | + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/> |
91 | <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/> |
92 | <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/> |
93 | <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> |
94 | @@ -124,7 +124,7 @@ |
95 | <lineStyle kind="LINEAFTER" colorName="#cccccc" start="2,0" stop="2,-1"/> |
96 | <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/> |
97 | <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> |
98 | - <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/> |
99 | + <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/> |
100 | <lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/> |
101 | <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/> |
102 | <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> |
103 | @@ -165,9 +165,9 @@ |
104 | <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="11" spaceBefore="6.0" spaceAfter="6.0"/> |
105 | <paraStyle name="Index" fontName="Helvetica"/> |
106 | <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> |
107 | - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> |
108 | - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> |
109 | - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> |
110 | + <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> |
111 | + <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> |
112 | + <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> |
113 | </stylesheet> |
114 | |
115 | <story> |
116 | @@ -182,52 +182,52 @@ |
117 | <para style="terp_default_8"> |
118 | <font color="white"> </font> |
119 | </para> |
120 | - <blockTable colWidths="90.0,80.0,80.0,130.0,80.0,80.0" style="Table2_header"> |
121 | + <blockTable colWidths="90.0,80.0,80.0,130.0,80.0,80.0" style="Table2_header"> |
122 | <tr> |
123 | - <td><para style="terp_tblheader_General_Centre">Chart of Account</para></td> |
124 | + <td><para style="terp_tblheader_General_Centre">Chart of Account</para></td> |
125 | <td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td> |
126 | - <td><para style="terp_tblheader_General_Centre">Journals</para></td> |
127 | - <td><para style="terp_tblheader_General_Centre">Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]</para></td> |
128 | - <td><para style="terp_tblheader_General_Centre">Partner's</para></td> |
129 | + <td><para style="terp_tblheader_General_Centre">Journals</para></td> |
130 | + <td><para style="terp_tblheader_General_Centre">Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]]</para></td> |
131 | + <td><para style="terp_tblheader_General_Centre">Partner's</para></td> |
132 | <td><para style="terp_tblheader_General_Centre">Target Moves</para></td> |
133 | </tr> |
134 | - <tr> |
135 | - <td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td> |
136 | - <td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td> |
137 | - <td> <para style="terp_default_Centre_8">[[', '.join([ lt or '' for lt in get_journal(data) ]) ]] </para></td> |
138 | + <tr> |
139 | + <td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td> |
140 | + <td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td> |
141 | + <td> <para style="terp_default_Centre_8">[[', '.join([ lt or '' for lt in get_journal(data) ]) ]] </para></td> |
142 | |
143 | <td><para style="terp_default_Centre_8">[[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] </para> |
144 | - <blockTable colWidths="60.0,60.0" style="Table3">[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] |
145 | - <tr> |
146 | - <td><para style="terp_tblheader_General_Centre">Start Date</para></td> |
147 | - <td><para style="terp_tblheader_General_Centre">End Date</para></td> |
148 | - </tr> |
149 | - <tr> |
150 | - <td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td> |
151 | - <td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td> |
152 | - </tr> |
153 | - </blockTable> |
154 | - <blockTable colWidths="60.0,60.0" style="Table3">[[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] |
155 | - <tr> |
156 | - <td><para style="terp_tblheader_General_Centre">Start Period</para></td> |
157 | - <td><para style="terp_tblheader_General_Centre">End Period</para></td> |
158 | - </tr> |
159 | - <tr> |
160 | - <td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td> |
161 | - <td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td> |
162 | - </tr> |
163 | - </blockTable> |
164 | - </td> |
165 | - <td> <para style="terp_default_Centre_9">[[ get_partners() ]]</para></td> |
166 | - <td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td> |
167 | - </tr> |
168 | - </blockTable> |
169 | + <blockTable colWidths="60.0,60.0" style="Table3">[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] |
170 | + <tr> |
171 | + <td><para style="terp_tblheader_General_Centre">Start Date</para></td> |
172 | + <td><para style="terp_tblheader_General_Centre">End Date</para></td> |
173 | + </tr> |
174 | + <tr> |
175 | + <td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td> |
176 | + <td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td> |
177 | + </tr> |
178 | + </blockTable> |
179 | + <blockTable colWidths="60.0,60.0" style="Table3">[[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] |
180 | + <tr> |
181 | + <td><para style="terp_tblheader_General_Centre">Start Period</para></td> |
182 | + <td><para style="terp_tblheader_General_Centre">End Period</para></td> |
183 | + </tr> |
184 | + <tr> |
185 | + <td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td> |
186 | + <td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td> |
187 | + </tr> |
188 | + </blockTable> |
189 | + </td> |
190 | + <td> <para style="terp_default_Centre_9">[[ get_partners() ]]</para></td> |
191 | + <td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td> |
192 | + </tr> |
193 | + </blockTable> |
194 | |
195 | <para style="terp_default_8"> |
196 | <font color="white"> </font> |
197 | </para> |
198 | <para style="P12a"></para> |
199 | - <blockTable colWidths="80.0,140.0,80.0,80.0,80.0,80.0" repeatRows="1" style="Table2"> |
200 | + <blockTable colWidths="80.0,140.0,80.0,80.0,80.0,80.0" repeatRows="1" style="Table2"> |
201 | <tr> |
202 | <td><para style="P12a">Code</para></td> |
203 | <td><para style="P12a">(Account/Partner) Name</para></td> |
204 | |
205 | === modified file 'account/report/account_partner_ledger.py' |
206 | --- account/report/account_partner_ledger.py 2014-09-24 09:16:10 +0000 |
207 | +++ account/report/account_partner_ledger.py 2014-11-03 08:53:50 +0000 |
208 | @@ -23,6 +23,7 @@ |
209 | import re |
210 | from report import report_sxw |
211 | from common_report_header import common_report_header |
212 | +import pooler |
213 | |
214 | class third_party_ledger(report_sxw.rml_parse, common_report_header): |
215 | |
216 | @@ -65,11 +66,44 @@ |
217 | self.result_selection = data['form'].get('result_selection', 'customer') |
218 | self.amount_currency = data['form'].get('amount_currency', False) |
219 | self.target_move = data['form'].get('target_move', 'all') |
220 | + self.fiscalyear_id = data['form'].get('fiscalyear_id', False) |
221 | + self.period_id = data['form'].get('period_from', False) |
222 | + self.date_from = data['form'].get('date_from', False) |
223 | + self.exclude_tax = data['form'].get('tax', False) |
224 | PARTNER_REQUEST = '' |
225 | move_state = ['draft','posted'] |
226 | if self.target_move == 'posted': |
227 | move_state = ['posted'] |
228 | |
229 | + # UFTP-312, UFTP-63: To have right initial balance, we have to fetch previous lines before a specific date. |
230 | + #+ To have right partner balance, we have to take all next lines after a specific date. |
231 | + #+ To do that, we need to make requests regarding a date. So first we take date_from |
232 | + #+ then period_from (if no date_from) |
233 | + #+ finally fisalyear_id (if no period) |
234 | + #+ If no date, the report is wrong. |
235 | + self.DATE_TO = ' ' |
236 | + self.DATE_FROM = ' ' |
237 | + pool = pooler.get_pool(self.cr.dbname) |
238 | + if self.fiscalyear_id or self.period_id or self.date_from: |
239 | + if self.date_from: |
240 | + self.DATE_TO = "AND l.date < '%s'" % self.date_from |
241 | + self.DATE_FROM = "AND l.date >= '%s'" % self.date_from |
242 | + elif self.period_id: |
243 | + period_obj = pool.get('account.period') |
244 | + period = period_obj.read(self.cr, self.uid, [self.period_id], ['date_start']) |
245 | + self.DATE_TO = "AND l.date < '%s'" % period[0].get('date_start') |
246 | + self.DATE_FROM = "AND l.date >= '%s'" % period[0].get('date_start') |
247 | + elif self.fiscalyear_id: |
248 | + fy_obj = pool.get('account.fiscalyear') |
249 | + fy = fy_obj.read(self.cr, self.uid, [self.fiscalyear_id], ['date_start']) |
250 | + self.DATE_TO = "AND l.date < '%s'" % fy[0].get('date_start') |
251 | + self.DATE_FROM = "AND l.date >= '%s'" % fy[0].get('date_start') |
252 | + |
253 | + # UFTP-312: Exclude tax if user ask it |
254 | + self.TAX_REQUEST = ' ' |
255 | + if self.exclude_tax is True: |
256 | + self.TAX_REQUEST = "AND t.code != 'tax'" |
257 | + |
258 | if (data['model'] == 'res.partner'): |
259 | ## Si on imprime depuis les partenaires |
260 | if ids: |
261 | @@ -85,8 +119,9 @@ |
262 | "SELECT a.id " \ |
263 | "FROM account_account a " \ |
264 | "LEFT JOIN account_account_type t " \ |
265 | - "ON (a.type=t.code) " \ |
266 | + "ON (a.user_type=t.id) " \ |
267 | 'WHERE a.type IN %s' \ |
268 | + " " + self.TAX_REQUEST + " " \ |
269 | "AND a.active", (tuple(self.ACCOUNT_TYPE), )) |
270 | self.account_ids = [a for (a,) in self.cr.fetchall()] |
271 | partner_to_use = [] |
272 | @@ -151,6 +186,7 @@ |
273 | "AND l.account_id IN %s AND " + self.query +" " \ |
274 | "AND m.state IN %s " \ |
275 | " " + RECONCILE_TAG + " "\ |
276 | + " " + self.DATE_FROM + " "\ |
277 | "ORDER BY l.date", |
278 | (partner.id, tuple(self.account_ids), tuple(move_state))) |
279 | res = self.cr.dictfetchall() |
280 | @@ -175,13 +211,14 @@ |
281 | self.cr.execute( |
282 | "SELECT COALESCE(SUM(l.debit),0.0), COALESCE(SUM(l.credit),0.0), COALESCE(sum(debit-credit), 0.0) " \ |
283 | "FROM account_move_line AS l, " \ |
284 | - "account_move AS m " |
285 | + "account_move AS m " \ |
286 | "WHERE l.partner_id = %s " \ |
287 | "AND m.id = l.move_id " \ |
288 | - "AND m.state IN %s " |
289 | + "AND m.state IN %s " \ |
290 | "AND account_id IN %s" \ |
291 | " " + RECONCILE_TAG + " "\ |
292 | - "AND " + self.init_query + " ", |
293 | + "AND " + self.init_query + " "\ |
294 | + " " + self.DATE_TO + " ", |
295 | (partner.id, tuple(move_state), tuple(self.account_ids))) |
296 | res = self.cr.fetchall() |
297 | self.init_bal_sum = res[0][2] |
298 | @@ -202,12 +239,13 @@ |
299 | self.cr.execute( |
300 | "SELECT sum(debit) " \ |
301 | "FROM account_move_line AS l, " \ |
302 | - "account_move AS m " |
303 | + "account_move AS m "\ |
304 | "WHERE l.partner_id = %s" \ |
305 | "AND m.id = l.move_id " \ |
306 | - "AND m.state IN %s " |
307 | + "AND m.state IN %s "\ |
308 | "AND account_id IN %s" \ |
309 | " " + RECONCILE_TAG + " " \ |
310 | + " " + self.DATE_TO + " "\ |
311 | "AND " + self.init_query + " ", |
312 | (partner.id, tuple(move_state), tuple(self.account_ids))) |
313 | contemp = self.cr.fetchone() |
314 | @@ -225,6 +263,7 @@ |
315 | "AND m.state IN %s " |
316 | "AND account_id IN %s" \ |
317 | " " + RECONCILE_TAG + " " \ |
318 | + " " + self.DATE_FROM + " " \ |
319 | "AND " + self.query + " ", |
320 | (partner.id, tuple(move_state), tuple(self.account_ids),)) |
321 | |
322 | @@ -257,6 +296,7 @@ |
323 | "AND m.state IN %s " |
324 | "AND account_id IN %s" \ |
325 | " " + RECONCILE_TAG + " " \ |
326 | + " " + self.DATE_TO + " " \ |
327 | "AND " + self.init_query + " ", |
328 | (partner.id, tuple(move_state), tuple(self.account_ids))) |
329 | contemp = self.cr.fetchone() |
330 | @@ -274,6 +314,7 @@ |
331 | "AND m.state IN %s " |
332 | "AND account_id IN %s" \ |
333 | " " + RECONCILE_TAG + " " \ |
334 | + " " + self.DATE_FROM + " " \ |
335 | "AND " + self.query + " ", |
336 | (partner.id, tuple(move_state), tuple(self.account_ids),)) |
337 | |
338 | @@ -284,105 +325,6 @@ |
339 | result_tmp = result_tmp + 0.0 |
340 | return result_tmp + result_init |
341 | |
342 | - # code is deprecated |
343 | -# def _sum_debit(self): |
344 | -# move_state = ['draft','posted'] |
345 | -# if self.target_move == 'posted': |
346 | -# move_state = ['posted'] |
347 | -# |
348 | -# if not self.ids: |
349 | -# return 0.0 |
350 | -# result_tmp = 0.0 |
351 | -# result_init = 0.0 |
352 | -# if self.reconcil: |
353 | -# RECONCILE_TAG = " " |
354 | -# else: |
355 | -# RECONCILE_TAG = "AND reconcile_id IS NULL" |
356 | -# if self.initial_balance: |
357 | -# self.cr.execute( |
358 | -# "SELECT sum(debit) " \ |
359 | -# "FROM account_move_line AS l, " \ |
360 | -# "account_move AS m " |
361 | -# "WHERE partner_id IN %s" \ |
362 | -# "AND m.id = l.move_id " \ |
363 | -# "AND m.state IN %s " |
364 | -# "AND account_id IN %s" \ |
365 | -# "AND reconcile_id IS NULL " \ |
366 | -# "AND " + self.init_query + " ", |
367 | -# (tuple(self.partner_ids), tuple(move_state), tuple(self.account_ids))) |
368 | -# contemp = self.cr.fetchone() |
369 | -# if contemp != None: |
370 | -# result_init = contemp[0] or 0.0 |
371 | -# else: |
372 | -# result_init = result_tmp + 0.0 |
373 | -# |
374 | -# self.cr.execute( |
375 | -# "SELECT sum(debit) " \ |
376 | -# "FROM account_move_line AS l, " \ |
377 | -# "account_move AS m " |
378 | -# "WHERE partner_id IN %s" \ |
379 | -# "AND m.id = l.move_id " \ |
380 | -# "AND m.state IN %s " |
381 | -# "AND account_id IN %s" \ |
382 | -# " " + RECONCILE_TAG + " " \ |
383 | -# "AND " + self.query + " ", |
384 | -# (tuple(self.partner_ids), tuple(move_state) ,tuple(self.account_ids),)) |
385 | -# contemp = self.cr.fetchone() |
386 | -# if contemp != None: |
387 | -# result_tmp = contemp[0] or 0.0 |
388 | -# else: |
389 | -# result_tmp = result_tmp + 0.0 |
390 | -# return result_tmp + result_init |
391 | -# |
392 | -# def _sum_credit(self): |
393 | -# move_state = ['draft','posted'] |
394 | -# if self.target_move == 'posted': |
395 | -# move_state = ['posted'] |
396 | -# |
397 | -# if not self.ids: |
398 | -# return 0.0 |
399 | -# result_tmp = 0.0 |
400 | -# result_init = 0.0 |
401 | -# if self.reconcil: |
402 | -# RECONCILE_TAG = " " |
403 | -# else: |
404 | -# RECONCILE_TAG = "AND reconcile_id IS NULL" |
405 | -# if self.initial_balance: |
406 | -# self.cr.execute( |
407 | -# "SELECT sum(credit) " \ |
408 | -# "FROM account_move_line AS l, " \ |
409 | -# "account_move AS m " |
410 | -# "WHERE partner_id IN %s" \ |
411 | -# "AND m.id = l.move_id " \ |
412 | -# "AND m.state IN %s " |
413 | -# "AND account_id IN %s" \ |
414 | -# "AND reconcile_id IS NULL " \ |
415 | -# "AND " + self.init_query + " ", |
416 | -# (tuple(self.partner_ids), tuple(move_state), tuple(self.account_ids))) |
417 | -# contemp = self.cr.fetchone() |
418 | -# if contemp != None: |
419 | -# result_init = contemp[0] or 0.0 |
420 | -# else: |
421 | -# result_init = result_tmp + 0.0 |
422 | -# |
423 | -# self.cr.execute( |
424 | -# "SELECT sum(credit) " \ |
425 | -# "FROM account_move_line AS l, " \ |
426 | -# "account_move AS m " |
427 | -# "WHERE partner_id IN %s" \ |
428 | -# "AND m.id = l.move_id " \ |
429 | -# "AND m.state IN %s " |
430 | -# "AND account_id IN %s" \ |
431 | -# " " + RECONCILE_TAG + " " \ |
432 | -# "AND " + self.query + " ", |
433 | -# (tuple(self.partner_ids), tuple(move_state), tuple(self.account_ids),)) |
434 | -# contemp = self.cr.fetchone() |
435 | -# if contemp != None: |
436 | -# result_tmp = contemp[0] or 0.0 |
437 | -# else: |
438 | -# result_tmp = result_tmp + 0.0 |
439 | -# return result_tmp + result_init |
440 | - |
441 | def _get_partners(self): |
442 | if self.result_selection == 'customer': |
443 | return 'Receivable Accounts' |
444 | |
445 | === modified file 'account/report/account_partner_ledger_other.rml' |
446 | --- account/report/account_partner_ledger_other.rml 2014-01-14 09:49:15 +0000 |
447 | +++ account/report/account_partner_ledger_other.rml 2014-11-03 08:53:50 +0000 |
448 | @@ -339,7 +339,7 @@ |
449 | <blockTable colWidths="58.0,58.0" style="Table7"> |
450 | <tr> |
451 | <td> |
452 | - <para style="terp_tblheader_General_Centre">[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] Start Date</para> |
453 | + <para style="terp_tblheader_General_Centre">[[ get_filter(data)=='Date' and "Start Date" or removeParentNode('blockTable') ]]</para> |
454 | </td> |
455 | <td> |
456 | <para style="terp_tblheader_General_Centre">End Date</para> |
457 | @@ -349,7 +349,7 @@ |
458 | <blockTable colWidths="58.0,58.0" style="Table9"> |
459 | <tr> |
460 | <td> |
461 | - <para style="terp_default_Centre_8">[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] [[ formatLang(get_start_date(data),date=True) ]]</para> |
462 | + <para style="terp_default_Centre_8">[[ get_filter(data)=='Date' and ' ' or removeParentNode('blockTable') ]] [[ formatLang(get_start_date(data),date=True) ]]</para> |
463 | </td> |
464 | <td> |
465 | <para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para> |
466 | @@ -359,7 +359,7 @@ |
467 | <blockTable colWidths="58.0,58.0" style="Table10"> |
468 | <tr> |
469 | <td> |
470 | - <para style="terp_tblheader_General_Centre">[[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] Start Period</para> |
471 | + <para style="terp_tblheader_General_Centre">[[ get_filter(data)=='Periods' and "Start Period" or removeParentNode('blockTable') ]]</para> |
472 | </td> |
473 | <td> |
474 | <para style="terp_tblheader_General_Centre">End Period</para> |
475 | @@ -369,7 +369,7 @@ |
476 | <blockTable colWidths="58.0,58.0" style="Table11"> |
477 | <tr> |
478 | <td> |
479 | - <para style="terp_default_Centre_8">[[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] [[ get_start_period(data) or removeParentNode('para') ]]</para> |
480 | + <para style="terp_default_Centre_8">[[ get_filter(data)=='Periods' and ' ' or removeParentNode('blockTable') ]] [[ get_start_period(data) or removeParentNode('para') ]]</para> |
481 | </td> |
482 | <td> |
483 | <para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para> |
484 | @@ -397,34 +397,65 @@ |
485 | <blockTable colWidths="59.0,24.0,91.0,56.0,103.0,64.0,64.0,79.0" style="Table15"> |
486 | <tr> |
487 | <td> |
488 | - <para style="terp_tblheader_Details">[[ display_currency(data) == False or removeParentNode('blockTable') ]] Date</para> |
489 | - </td> |
490 | - <td> |
491 | - <para style="terp_tblheader_Details">JNRL</para> |
492 | - </td> |
493 | - <td> |
494 | - <para style="terp_tblheader_Details_Centre">Ref</para> |
495 | - </td> |
496 | - <td> |
497 | - <para style="terp_tblheader_Details_Centre">Account</para> |
498 | - </td> |
499 | - <td> |
500 | - <para style="terp_tblheader_Details">Entry Label</para> |
501 | - </td> |
502 | - <td> |
503 | - <para style="terp_tblheader_Details_Right">Debit</para> |
504 | - </td> |
505 | - <td> |
506 | - <para style="terp_tblheader_Details_Right">Credit</para> |
507 | - </td> |
508 | - <td> |
509 | - <para style="terp_tblheader_Details_Right">Balance</para> |
510 | + <para style="terp_tblheader_Details">[[ display_currency(data) == False and "Date" or removeParentNode('blockTable') ]]</para> |
511 | + </td> |
512 | + <td> |
513 | + <para style="terp_tblheader_Details">JNRL</para> |
514 | + </td> |
515 | + <td> |
516 | + <para style="terp_tblheader_Details_Centre">Ref</para> |
517 | + </td> |
518 | + <td> |
519 | + <para style="terp_tblheader_Details_Centre">Account</para> |
520 | + </td> |
521 | + <td> |
522 | + <para style="terp_tblheader_Details">Entry Label</para> |
523 | + </td> |
524 | + <td> |
525 | + <para style="terp_tblheader_Details_Right">Debit</para> |
526 | + </td> |
527 | + <td> |
528 | + <para style="terp_tblheader_Details_Right">Credit</para> |
529 | + </td> |
530 | + <td> |
531 | + <para style="terp_tblheader_Details_Right">Balance</para> |
532 | + </td> |
533 | + </tr> |
534 | + </blockTable> |
535 | + <blockTable colWidths="59.0,35.0,62.0,43.0,62.0,64.0,64.0,79.0,71.0" style="Table2"> |
536 | + <tr> |
537 | + <td> |
538 | + <para style="terp_tblheader_Details">[[ display_currency(data) == True and "Date" or removeParentNode('blockTable') ]]</para> |
539 | + </td> |
540 | + <td> |
541 | + <para style="terp_tblheader_Details">JNRL</para> |
542 | + </td> |
543 | + <td> |
544 | + <para style="terp_tblheader_Details_Centre">Ref</para> |
545 | + </td> |
546 | + <td> |
547 | + <para style="terp_tblheader_Details_Centre">Account</para> |
548 | + </td> |
549 | + <td> |
550 | + <para style="terp_tblheader_Details">Entry Label</para> |
551 | + </td> |
552 | + <td> |
553 | + <para style="terp_tblheader_Details_Right">Debit</para> |
554 | + </td> |
555 | + <td> |
556 | + <para style="terp_tblheader_Details_Right">Credit</para> |
557 | + </td> |
558 | + <td> |
559 | + <para style="terp_tblheader_Details_Right">Balance</para> |
560 | + </td> |
561 | + <td> |
562 | + <para style="terp_tblheader_Details_Right">Func. Cur.</para> |
563 | </td> |
564 | </tr> |
565 | </blockTable> |
566 | <section> |
567 | <para style="terp_default_2"> |
568 | - <font face="Helvetica">[[ display_currency(data) == False or removeParentNode('section') ]]</font> |
569 | + <font face="Helvetica">[[ display_currency(data) == False and ' ' or removeParentNode('section') ]]</font> |
570 | </para> |
571 | <para style="terp_default_8">[[ repeatIn(objects, 'p') ]]</para> |
572 | <para style="terp_default_8">[[ setLang(p.lang) ]]</para> |
573 | @@ -446,7 +477,7 @@ |
574 | </blockTable> |
575 | <section> |
576 | <para style="terp_default_2"> |
577 | - <font face="Helvetica">[[data['form']['initial_balance']==True or removeParentNode('section') ]]</font> |
578 | + <font face="Helvetica">[[data['form']['initial_balance'] == True and ' ' or removeParentNode('section') ]]</font> |
579 | </para> |
580 | <blockTable colWidths="332.0,64.0,64.0,79.0" style="Table5"> |
581 | <tr> |
582 | @@ -508,7 +539,7 @@ |
583 | <blockTable colWidths="59.0,35.0,62.0,43.0,62.0,64.0,64.0,79.0,71.0" style="Table2"> |
584 | <tr> |
585 | <td> |
586 | - <para style="terp_tblheader_Details">[[ display_currency(data) == True or removeParentNode('blockTable') ]]Date</para> |
587 | + <para style="terp_tblheader_Details">[[ display_currency(data) == True and Date or removeParentNode('blockTable') ]]</para> |
588 | </td> |
589 | <td> |
590 | <para style="terp_tblheader_Details">JNRL</para> |
591 | @@ -539,7 +570,7 @@ |
592 | </section> |
593 | <section> |
594 | <para style="terp_default_2"> |
595 | - <font face="Helvetica">[[ display_currency(data) == True or removeParentNode('section') ]]</font> |
596 | + <font face="Helvetica">[[ display_currency(data) == True and ' ' or removeParentNode('section') ]]</font> |
597 | </para> |
598 | <para style="terp_default_8">[[ repeatIn(objects, 'p') ]]</para> |
599 | <para style="terp_default_8">[[ setLang(p.lang) ]]</para> |
600 | @@ -614,7 +645,7 @@ |
601 | </tr> |
602 | </blockTable> |
603 | <section> |
604 | - <para style="terp_default_2">[[ data['form']['initial_balance']==True or removeParentNode('section') ]] </para> |
605 | + <para style="terp_default_2">[[ data['form']['initial_balance'] == True and ' ' or removeParentNode('section') ]]</para> |
606 | <blockTable colWidths="261.0,64.0,64.0,79.0,71.0" style="Table13"> |
607 | <tr> |
608 | <td> |
609 | @@ -666,7 +697,7 @@ |
610 | <para style="P9">[[ formatLang((line['progress'])) ]] [[ company.currency_id.symbol ]]</para> |
611 | </td> |
612 | <td> |
613 | - <para style="P1">[[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] </para> |
614 | + <para style="P1">[[ (line['currency_id'] == None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] </para> |
615 | </td> |
616 | </tr> |
617 | </blockTable> |
618 | |
619 | === modified file 'account/report/account_profit_horizontal.rml' |
620 | --- account/report/account_profit_horizontal.rml 2011-06-29 05:29:28 +0000 |
621 | +++ account/report/account_profit_horizontal.rml 2014-11-03 08:53:50 +0000 |
622 | @@ -239,6 +239,23 @@ |
623 | </td> |
624 | </tr> |
625 | </blockTable> |
626 | + <blockTable colWidths="290.16,100.32,290.16,100.32" style="Table_Net_Profit_Loss"> |
627 | + <tr> |
628 | + <td> |
629 | + <para style="terp_default_Bold_9">Total:</para> |
630 | + </td> |
631 | + <td> |
632 | + <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]]</u></para> |
633 | + </td> |
634 | + <td> |
635 | + <para style="terp_default_Bold_9">Total:</para> |
636 | + </td> |
637 | + <td> |
638 | + <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]</u></para> |
639 | + </td> |
640 | + </tr> |
641 | + </blockTable> |
642 | + |
643 | <blockTable colWidths="80.0,210.16,100.32,80.0,210.16,100.32" style="Table_Net_Profit_Loss"> |
644 | <tr> |
645 | <td> |
646 | @@ -248,7 +265,7 @@ |
647 | <para style="terp_default_Bold_9">[[ final_result()['type'] == 'Net Profit' and final_result()['type'] or '' ]]</para> |
648 | </td> |
649 | <td> |
650 | - <para style="terp_default_Right_9_Bold">[[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance'])) ]] [[ company.currency_id.symbol ]]</para> |
651 | + <para style="terp_default_Right_9_Bold">[[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance'])) ]] [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and company.currency_id.symbol ]]</para> |
652 | </td> |
653 | <td> |
654 | <para style="terp_default_Bold_9"></para> |
655 | @@ -262,22 +279,6 @@ |
656 | </tr> |
657 | </blockTable> |
658 | |
659 | - <blockTable colWidths="290.16,100.32,290.16,100.32" style="Table_Net_Profit_Loss"> |
660 | - <tr> |
661 | - <td> |
662 | - <para style="terp_default_Bold_9">Total:</para> |
663 | - </td> |
664 | - <td> |
665 | - <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_dr())) ]] [[ company.currency_id.symbol ]]</u></para> |
666 | - </td> |
667 | - <td> |
668 | - <para style="terp_default_Bold_9">Total:</para> |
669 | - </td> |
670 | - <td> |
671 | - <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]</u></para> |
672 | - </td> |
673 | - </tr> |
674 | - </blockTable> |
675 | </story> |
676 | </document> |
677 | |
678 | |
679 | === modified file 'account/report/account_profit_loss.py' |
680 | --- account/report/account_profit_loss.py 2014-09-25 12:03:56 +0000 |
681 | +++ account/report/account_profit_loss.py 2014-11-03 08:53:50 +0000 |
682 | @@ -72,13 +72,11 @@ |
683 | return self.res_pl |
684 | |
685 | def sum_dr(self): |
686 | - if self.res_pl['type'] == _('Net Profit'): |
687 | - self.result_sum_dr += self.res_pl['balance'] |
688 | + # UFTP-312: If this fucking method is "sum_dr", we except it returns the sum of debit. That's all |
689 | return self.result_sum_dr |
690 | |
691 | def sum_cr(self): |
692 | - if self.res_pl['type'] == _('Net Loss'): |
693 | - self.result_sum_cr += self.res_pl['balance'] |
694 | + # UFTP-312: If this fucking method is "sum_cr", we except it returns the sum of credit. That's all |
695 | return self.result_sum_cr |
696 | |
697 | def get_data(self, data): |
698 | |
699 | === modified file 'account/report/account_profit_loss.rml' |
700 | --- account/report/account_profit_loss.rml 2011-06-29 05:29:28 +0000 |
701 | +++ account/report/account_profit_loss.rml 2014-11-03 08:53:50 +0000 |
702 | @@ -278,6 +278,16 @@ |
703 | </td> |
704 | </tr> |
705 | </blockTable> |
706 | + <blockTable colWidths="426.0,113.0" style="Table4"> |
707 | + <tr> |
708 | + <td> |
709 | + <para style="terp_default_Bold_9">Total:</para> |
710 | + </td> |
711 | + <td> |
712 | + <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]</u></para> |
713 | + </td> |
714 | + </tr> |
715 | + </blockTable> |
716 | <blockTable colWidths="100.0,326.0,113.0" style="Table4"> |
717 | <tr> |
718 | <td> |
719 | @@ -291,16 +301,6 @@ |
720 | </td> |
721 | </tr> |
722 | </blockTable> |
723 | - <blockTable colWidths="426.0,113.0" style="Table4"> |
724 | - <tr> |
725 | - <td> |
726 | - <para style="terp_default_Bold_9">Total:</para> |
727 | - </td> |
728 | - <td> |
729 | - <para style="terp_default_Right_9_Bold"><u>[[ formatLang(abs(sum_cr())) ]] [[ company.currency_id.symbol ]]</u></para> |
730 | - </td> |
731 | - </tr> |
732 | - </blockTable> |
733 | <para style="Standard"> |
734 | <font color="white"> </font> |
735 | </para> |
736 | |
737 | === modified file 'account/wizard/account_report_partner_ledger.py' |
738 | --- account/wizard/account_report_partner_ledger.py 2014-01-10 09:34:50 +0000 |
739 | +++ account/wizard/account_report_partner_ledger.py 2014-11-03 08:53:50 +0000 |
740 | @@ -35,20 +35,21 @@ |
741 | 'reconcil': fields.boolean('Include Reconciled Entries', help='Consider reconciled entries'), |
742 | 'page_split': fields.boolean('One Partner Per Page', help='Display Ledger Report with One partner per page'), |
743 | 'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"), |
744 | - |
745 | + 'tax': fields.boolean('Exclude tax', help="Exclude tax accounts from process"), |
746 | } |
747 | _defaults = { |
748 | 'reconcil': True, |
749 | - 'initial_balance': True, |
750 | + 'initial_balance': False, |
751 | 'page_split': False, |
752 | 'result_selection': 'supplier', # UF-1715: 'Payable Accounts' by default instead of 'Receivable' |
753 | + 'tax': False, # UFTP-312: Add an exclude tax account possibility |
754 | } |
755 | |
756 | def _print_report(self, cr, uid, ids, data, context=None): |
757 | if context is None: |
758 | context = {} |
759 | data = self.pre_print_report(cr, uid, ids, data, context=context) |
760 | - data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency'])[0]) |
761 | + data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency', 'tax'])[0]) |
762 | if data['form']['page_split']: |
763 | return { |
764 | 'type': 'ir.actions.report.xml', |
765 | @@ -62,5 +63,4 @@ |
766 | } |
767 | |
768 | account_partner_ledger() |
769 | - |
770 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
771 | |
772 | === modified file 'account/wizard/account_report_partner_ledger_view.xml' |
773 | --- account/wizard/account_report_partner_ledger_view.xml 2011-01-14 00:11:01 +0000 |
774 | +++ account/wizard/account_report_partner_ledger_view.xml 2014-11-03 08:53:50 +0000 |
775 | @@ -19,6 +19,7 @@ |
776 | <field name="reconcil"/> |
777 | <field name="amount_currency"/> |
778 | <field name="page_split"/> |
779 | + <field name="tax"/> |
780 | <newline/> |
781 | </xpath> |
782 | </data> |
783 | @@ -26,7 +27,7 @@ |
784 | </record> |
785 | |
786 | <record id="action_account_partner_ledger" model="ir.actions.act_window"> |
787 | - <field name="name">Select Period</field> |
788 | + <field name="name">Partner Ledger</field> |
789 | <field name="res_model">account.partner.ledger</field> |
790 | <field name="type">ir.actions.act_window</field> |
791 | <field name="view_type">form</field> |