Merge lp:~serpentcs/account-financial-report/account-serpentcs into lp:~account-report-core-editor/account-financial-report/7.0

Proposed by Nishant Jogi (Serpent Consulting Services)
Status: Work in progress
Proposed branch: lp:~serpentcs/account-financial-report/account-serpentcs
Merge into: lp:~account-report-core-editor/account-financial-report/7.0
Diff against target: 10347 lines (+9879/-0)
86 files modified
account_analytic_plans_webkit/__init__.py (+26/-0)
account_analytic_plans_webkit/__openerp__.py (+42/-0)
account_analytic_plans_webkit/account_analytic_plans_report.xml (+147/-0)
account_analytic_plans_webkit/report/__init__.py (+25/-0)
account_analytic_plans_webkit/report/crossovered_analytic.mako (+114/-0)
account_analytic_plans_webkit/report/crossovered_analytic.py (+182/-0)
account_analytic_plans_webkit/wizard/__init__.py (+26/-0)
account_analytic_plans_webkit/wizard/account_crossovered_analytic.py (+70/-0)
account_bank_statement_extensions_webkit/__init__.py (+24/-0)
account_bank_statement_extensions_webkit/__openerp__.py (+41/-0)
account_bank_statement_extensions_webkit/account_bank_statement_report.xml (+113/-0)
account_bank_statement_extensions_webkit/report/__init__.py (+25/-0)
account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako (+56/-0)
account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py (+70/-0)
account_budget_webkit/__init__.py (+26/-0)
account_budget_webkit/__openerp__.py (+42/-0)
account_budget_webkit/account_budget_report.xml (+234/-0)
account_budget_webkit/report/__init__.py (+27/-0)
account_budget_webkit/report/analytic_account_budget_report.mako (+119/-0)
account_budget_webkit/report/analytic_account_budget_report.py (+173/-0)
account_budget_webkit/report/budget_report.mako (+131/-0)
account_budget_webkit/report/budget_report.py (+192/-0)
account_budget_webkit/report/crossovered_budget_report.mako (+128/-0)
account_budget_webkit/report/crossovered_budget_report.py (+197/-0)
account_budget_webkit/wizard/__init__.py (+27/-0)
account_budget_webkit/wizard/account_budget_analytic.py (+37/-0)
account_budget_webkit/wizard/account_budget_crossovered_report.py (+37/-0)
account_budget_webkit/wizard/account_budget_crossovered_summary_report.py (+40/-0)
account_budget_webkit/wizard/account_budget_report.py (+38/-0)
account_test_webkit/__init__.py (+22/-0)
account_test_webkit/__openerp__.py (+41/-0)
account_test_webkit/account_test_report.xml (+26/-0)
account_test_webkit/report/__init__.py (+24/-0)
account_test_webkit/report/account_test.mako (+53/-0)
account_test_webkit/report/account_test_report.py (+88/-0)
account_voucher_webkit/__init__.py (+25/-0)
account_voucher_webkit/__openerp__.py (+45/-0)
account_voucher_webkit/account_voucher_report.xml (+159/-0)
account_voucher_webkit/report/.~lock.account_voucher_print.sxw# (+1/-0)
account_voucher_webkit/report/__init__.py (+26/-0)
account_voucher_webkit/report/account_voucher.mako (+160/-0)
account_voucher_webkit/report/account_voucher.py (+77/-0)
account_voucher_webkit/report/account_voucher_print.mako (+140/-0)
account_voucher_webkit/report/account_voucher_print.py (+98/-0)
account_webkit/__init__.py (+24/-0)
account_webkit/__openerp__.py (+44/-0)
account_webkit/account_report.xml (+658/-0)
account_webkit/report/__init__.py (+40/-0)
account_webkit/report/account_aged_partner_balance.mako (+220/-0)
account_webkit/report/account_aged_partner_balance.py (+383/-0)
account_webkit/report/account_balance.mako (+132/-0)
account_webkit/report/account_balance.py (+136/-0)
account_webkit/report/account_central_journal.mako (+240/-0)
account_webkit/report/account_central_journal.py (+111/-0)
account_webkit/report/account_financial_report.mako (+181/-0)
account_webkit/report/account_financial_report.py (+113/-0)
account_webkit/report/account_general_journal.mako (+348/-0)
account_webkit/report/account_general_journal.py (+164/-0)
account_webkit/report/account_general_ledger.mako (+150/-0)
account_webkit/report/account_general_ledger.py (+304/-0)
account_webkit/report/account_general_ledger_landscape.mako (+178/-0)
account_webkit/report/account_journal.mako (+292/-0)
account_webkit/report/account_journal.py (+204/-0)
account_webkit/report/account_journal_sale_purchase.mako (+306/-0)
account_webkit/report/account_partner_balance.mako (+119/-0)
account_webkit/report/account_partner_balance.py (+309/-0)
account_webkit/report/account_partner_ledger.mako (+172/-0)
account_webkit/report/account_partner_ledger.py (+311/-0)
account_webkit/report/account_partner_ledger_other.mako (+175/-0)
account_webkit/report/account_print_invoice.mako (+164/-0)
account_webkit/report/account_print_invoice.py (+39/-0)
account_webkit/report/account_print_overdue.mako (+126/-0)
account_webkit/report/account_print_overdue.py (+72/-0)
account_webkit/report/account_tax_report.mako (+111/-0)
account_webkit/report/account_tax_report.py (+240/-0)
account_webkit/wizard/__init__.py (+33/-0)
account_webkit/wizard/account_financial_report.py (+34/-0)
account_webkit/wizard/account_report_account_balance.py (+33/-0)
account_webkit/wizard/account_report_aged_partner_balance.py (+39/-0)
account_webkit/wizard/account_report_central_journal.py (+40/-0)
account_webkit/wizard/account_report_general_journal.py (+34/-0)
account_webkit/wizard/account_report_general_ledger.py (+35/-0)
account_webkit/wizard/account_report_partner_balance.py (+38/-0)
account_webkit/wizard/account_report_partner_ledger.py (+52/-0)
account_webkit/wizard/account_report_print_journal.py (+44/-0)
account_webkit/wizard/account_vat.py (+37/-0)
To merge this branch: bzr merge lp:~serpentcs/account-financial-report/account-serpentcs
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Omar (Pexego) code review Needs Fixing
Review via email: mp+190320@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Omar (Pexego) (omar7r) wrote :

Could you take the time to bring this to the 7.0 community addons coding conventions. This includes:

* not using the shortcut imports (things in the openerp namespace need to be imported from openerp)
* using the from . import xxx for relative imports (typically in __init__.py files)
* using orm.Model and orm.TransientModel as base class rather than osv.osv and osv.osv_memory
* not instanciating the model classes
* following PEP8 for spacing, line wrapping, etc.

Thanks

review: Needs Fixing (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :
review: Needs Resubmitting

Unmerged revisions

54. By Nishant Jogi (Serpent Consulting Services)

[ADD] Added Accounting report modules with conversion from rml to webkit.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_analytic_plans_webkit'
2=== added file 'account_analytic_plans_webkit/__init__.py'
3--- account_analytic_plans_webkit/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_analytic_plans_webkit/__init__.py 2013-10-10 09:47:29 +0000
5@@ -0,0 +1,26 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+############################################################################
26+
27+import wizard
28+import report
29+
30+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
31+
32
33=== added file 'account_analytic_plans_webkit/__openerp__.py'
34--- account_analytic_plans_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ account_analytic_plans_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
36@@ -0,0 +1,42 @@
37+# -*- coding: utf-8 -*-
38+##############################################################################
39+#
40+# OpenERP, Open Source Management Solution
41+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
42+#
43+# This program is free software: you can redistribute it and/or modify
44+# it under the terms of the GNU Affero General Public License as
45+# published by the Free Software Foundation, either version 3 of the
46+# License, or (at your option) any later version.
47+#
48+# This program is distributed in the hope that it will be useful,
49+# but WITHOUT ANY WARRANTY; without even the implied warranty of
50+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51+# GNU Affero General Public License for more details.
52+#
53+# You should have received a copy of the GNU Affero General Public License
54+# along with this program. If not, see <http://www.gnu.org/licenses/>.
55+#
56+############################################################################
57+
58+{
59+ 'name': 'Multiple Analytic Plans Webkit',
60+ 'version': '1.0',
61+ 'category': 'Accounting & Finance',
62+ 'description': """
63+This module allows to use several analytic plans according to the general journal.
64+==================================================================================
65+ It is conversion of rml report to Webkit Report.
66+
67+ """,
68+ 'author': 'Serpent Consulting Services',
69+ 'website': 'http://www.serpentcs.com',
70+ 'depends': ['report_webkit', 'account_analytic_plans'],
71+ 'data': [
72+ 'account_analytic_plans_report.xml',
73+ ],
74+ 'installable': True,
75+ 'auto_install': False,
76+}
77+
78+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
79
80=== added file 'account_analytic_plans_webkit/account_analytic_plans_report.xml'
81--- account_analytic_plans_webkit/account_analytic_plans_report.xml 1970-01-01 00:00:00 +0000
82+++ account_analytic_plans_webkit/account_analytic_plans_report.xml 2013-10-10 09:47:29 +0000
83@@ -0,0 +1,147 @@
84+<?xml version="1.0"?>
85+<openerp>
86+ <data>
87+ <record id="account_webkit_header" model="ir.header_webkit">
88+ <field name="footer_html"><![CDATA[]]></field>
89+ <field name="orientation">Portrait</field>
90+ <field name="format">A4</field>
91+ <field name="html"><![CDATA[
92+<html>
93+ <head>
94+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
95+ <script>
96+ function subst() {
97+ var vars={};
98+ var x=document.location.search.substring(1).split('&');
99+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
100+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
101+ for(var i in x) {
102+ var y = document.getElementsByClassName(x[i]);
103+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
104+ }
105+ }
106+ </script>
107+ <style type="text/css">
108+
109+ ${css}
110+ </style>
111+ </head>
112+
113+ ${_debug or ''|n} </body>
114+</html>]]>
115+ </field>
116+ <field name="orientation">Portrait</field>
117+ <field name="format">A4</field>
118+ <field name="html"><![CDATA[
119+<html>
120+ <head>
121+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
122+ <script>
123+ function subst() {
124+ var vars={};
125+ var x=document.location.search.substring(1).split('&');
126+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
127+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
128+ for(var i in x) {
129+ var y = document.getElementsByClassName(x[i]);
130+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
131+ }
132+ }
133+ </script>
134+ <style type="text/css">
135+ ${css}
136+ </style>
137+ </head>
138+ <body style="border:0;" onload="subst()">
139+ <table style="border-bottom: 1px solid black; width: 100%">
140+ <tr >
141+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
142+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
143+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
144+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
145+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
146+ </tr>
147+ </table> ${_debug or ''|n} </body>
148+
149+</html>]]>
150+ </field>
151+ <field eval="15.0" name="margin_top"/>
152+ <field eval="5.0" name="margin_bottom"/>
153+ <field name="css"><![CDATA[
154+
155+ .cell_extended{
156+ border-spacing: 0;
157+ border-collapse: collapse;
158+ border-style:solid;
159+ border: 1px;
160+ border-style:solid;
161+ border-color:#C0C0C0;
162+ font-size:10px;
163+ }
164+
165+ tr.table_parent_data{
166+ font-family: Helvetica-Bold;
167+ font-size: 10px;
168+ caption-side: top;
169+ font-weight: bold;
170+}
171+ tr.table_child_data{
172+ font-family: Helvetica;
173+ font-size: 8px;
174+ caption-side: top;
175+}
176+
177+ .under_line1{
178+ border-bottom:2px solid black;
179+ font-size:10px;
180+}
181+
182+ td.under_line{
183+ border-bottom:2px solid black;
184+ font-size:10px;
185+}
186+ .under_line_gray{
187+ border-bottom:2px;
188+ border-style:solid;
189+ border-color:#C0C0C0;
190+ font-size:10px;
191+}
192+ .list_table1 {
193+border-color:#C0C0C0;
194+text-align:center;
195+font-size:8px;
196+margin-top:2px;
197+margin-bottom:2px;
198+border-collapse: collapse;
199+}
200+.list_table1 td {
201+border-color:gray;
202+border-bottom:1px solid gray;
203+text-align:left;
204+font-size:10;
205+padding-left:3px
206+padding-right:3px
207+padding-top:3px
208+padding-bottom:3px
209+}
210+
211+]]>
212+ </field>
213+ <field name="name">Account webkit Header</field>
214+ </record>
215+ <report
216+ id="account_analytic_account_crossovered_analytic"
217+ string="Crossovered Analytic"
218+ model="account.analytic.account"
219+ name="account.analytic.account.crossovered.analytic.webkit"
220+ file="account_analytic_plans_webkit/report/crossovered_analytic.mako"
221+ auto="False"
222+ menu="False"
223+ report_type="webkit"
224+ header="True"
225+ webkit_header="account_webkit_header"
226+ />
227+
228+ </data>
229+</openerp>
230+
231
232=== added directory 'account_analytic_plans_webkit/report'
233=== added file 'account_analytic_plans_webkit/report/__init__.py'
234--- account_analytic_plans_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
235+++ account_analytic_plans_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
236@@ -0,0 +1,25 @@
237+# -*- coding: utf-8 -*-
238+##############################################################################
239+#
240+# OpenERP, Open Source Management Solution
241+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
242+#
243+# This program is free software: you can redistribute it and/or modify
244+# it under the terms of the GNU Affero General Public License as
245+# published by the Free Software Foundation, either version 3 of the
246+# License, or (at your option) any later version.
247+#
248+# This program is distributed in the hope that it will be useful,
249+# but WITHOUT ANY WARRANTY; without even the implied warranty of
250+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
251+# GNU Affero General Public License for more details.
252+#
253+# You should have received a copy of the GNU Affero General Public License
254+# along with this program. If not, see <http://www.gnu.org/licenses/>.
255+#
256+############################################################################
257+
258+import crossovered_analytic
259+
260+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
261+
262
263=== added file 'account_analytic_plans_webkit/report/crossovered_analytic.mako'
264--- account_analytic_plans_webkit/report/crossovered_analytic.mako 1970-01-01 00:00:00 +0000
265+++ account_analytic_plans_webkit/report/crossovered_analytic.mako 2013-10-10 09:47:29 +0000
266@@ -0,0 +1,114 @@
267+<html>
268+<head>
269+ <style type="text/css">
270+ ${css}
271+ </style>
272+ <title>Crossoverred Analytic.pdf</title>
273+
274+</head>
275+<body>
276+ <table width="100%">
277+ <tr>
278+ <td style="text-align:center;">
279+ <h3><b> Crossovered Analytic</b></h3>
280+ </td>
281+ </tr>
282+ </table>
283+ <table width="100%" class="cell_extended">
284+ <tr>
285+ <td style="text-align:center;" class="cell_extended"><b>${ _('From Date') }</b></td>
286+ <td style="text-align:center;" class="cell_extended"><b>${ _('To Date') }</b></td>
287+ <td style="text-align:center;" class="cell_extended"><b>${ _('Company') }</b></td>
288+ <td style="text-align:center;" class="cell_extended"><b>${ _('Currency') }</b></td>
289+ <td style="text-align:center;" class="cell_extended"><b>${ _('Printing date') }</b></td>
290+ </tr>
291+ <tr>
292+ <td style="text-align:center;" class="cell_extended">${ data['form']['date1'] }</td>
293+ <td style="text-align:center;" class="cell_extended">${ data['form']['date2'] } </td>
294+ <td style="text-align:center;" class="cell_extended">${ company.name }</td>
295+ <td style="text-align:center;" class="cell_extended">${ company.currency_id.name }</td>
296+ <td style="text-align:center;" class="cell_extended">${ time.strftime('%Y-%m-%d')} at ${ time.strftime('%H:%M:%S') }</td>
297+ </tr>
298+ </table>
299+ <br/>
300+
301+ <table width="100%" >
302+ <tr>
303+ <td>
304+ <h4><b>Analytic Account Reference:</b></h4>
305+ </td>
306+ </tr>
307+ </table>
308+ <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">
309+ <tr>
310+ <td width="60%">
311+ ${_('Account Name') }
312+ </td>
313+ <td width="10%">
314+ ${_('Code') }
315+ </td>
316+ <td width="10%">
317+ ${_('Quantity') }
318+ </td>
319+ <td width="10%">
320+ ${_('Amount') }
321+ </td>
322+ <td width="10%">
323+ ${_('Perc(%)') }
324+ </td>
325+ </tr>
326+ </table>
327+ %for k in ref_lines(data['form']):
328+ <table width="100%" class="list_table1">
329+ <tr>
330+ <td width="60%">${k['ref_name']}</td>
331+ <td width="10%" >${k['ref_code']}</td>
332+ <td width="10%" style="text-align:right;">${k['ref_qty']}</td>
333+ <td width="10%" style="text-align:right;">${k['ref_amt']}</td>
334+ <td width="10%" style="text-align:right;">100.00%</td>
335+ </tr>
336+ </table>
337+ %endfor
338+
339+ <br/>
340+ <table width="100%" >
341+ <tr>
342+ <td>
343+ <h4><b>Analytic Account :</b></h4>
344+ </td>
345+ </tr>
346+ </table>
347+ <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">
348+ <tr>
349+ <td width="60%">
350+ ${_('Account Name') }
351+ </td>
352+ <td width="10%">
353+ ${_('Code') }
354+ </td>
355+ <td width="10%">
356+ ${_('Quantity') }
357+ </td>
358+ <td width="10%" >
359+ ${_('Amount') }
360+ </td>
361+ <td width="10%">
362+ ${_('Percentage') }
363+ </td>
364+ </tr>
365+ </table>
366+ %for account in lines(data['form']):
367+ <table width="100%" class="list_table1">
368+ <tr>
369+ <td width="60%" >${account['acc_name']}</td>
370+ <td width="10%" >${account['code']}</td>
371+ <td width="10%" style="text-align:right;">${account['qty']}</td>
372+ <td width="10%" style="text-align:right;">${account['amt']}</td>
373+ <td width="10%" style="text-align:right;">${account['perc']}%</td>
374+ </tr>
375+ </table>
376+ <p style="page-break-after:always">
377+ </p>
378+ %endfor
379+</body>
380+</html>
381\ No newline at end of file
382
383=== added file 'account_analytic_plans_webkit/report/crossovered_analytic.py'
384--- account_analytic_plans_webkit/report/crossovered_analytic.py 1970-01-01 00:00:00 +0000
385+++ account_analytic_plans_webkit/report/crossovered_analytic.py 2013-10-10 09:47:29 +0000
386@@ -0,0 +1,182 @@
387+# -*- coding: utf-8 -*-
388+##############################################################################
389+#
390+# OpenERP, Open Source Management Solution
391+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
392+#
393+# This program is free software: you can redistribute it and/or modify
394+# it under the terms of the GNU Affero General Public License as
395+# published by the Free Software Foundation, either version 3 of the
396+# License, or (at your option) any later version.
397+#
398+# This program is distributed in the hope that it will be useful,
399+# but WITHOUT ANY WARRANTY; without even the implied warranty of
400+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
401+# GNU Affero General Public License for more details.
402+#
403+# You should have received a copy of the GNU Affero General Public License
404+# along with this program. If not, see <http://www.gnu.org/licenses/>.
405+#
406+############################################################################
407+
408+
409+import time
410+
411+from openerp.report import report_sxw
412+
413+class crossovered_analytic(report_sxw.rml_parse):
414+ def __init__(self, cr, uid, name, context):
415+ super(crossovered_analytic, self).__init__(cr, uid, name, context = context)
416+ self.localcontext.update( {
417+ 'time': time,
418+ 'lines': self._lines,
419+ 'ref_lines': self._ref_lines,
420+ 'find_children': self.find_children,
421+ })
422+ self.base_amount = 0.00
423+
424+ def find_children(self, ref_ids):
425+ if not ref_ids: return []
426+ to_return_ids = []
427+ final_list = []
428+ parent_list = []
429+ set_list = []
430+ analytic_obj = self.pool.get('account.analytic.account')
431+ for id in ref_ids:
432+ # to avoid duplicate entries
433+ if id not in to_return_ids:
434+ to_return_ids.append(analytic_obj.search(self.cr,self.uid,[('parent_id','child_of',[id])]))
435+ data_accnt = analytic_obj.browse(self.cr,self.uid,to_return_ids[0])
436+ for data in data_accnt:
437+ if data.parent_id and data.parent_id.id == ref_ids[0]:
438+ parent_list.append(data.id)
439+ final_list.append(ref_ids[0])
440+ set_list = self.set_account(parent_list)
441+ final_list.extend(set_list)
442+ return final_list #to_return_ids[0]
443+
444+ def set_account(self, cats):
445+ lst = []
446+ category = self.pool.get('account.analytic.account').read(self.cr, self.uid, cats)
447+ for cat in category:
448+ lst.append(cat['id'])
449+ if cat['child_ids']:
450+ lst.extend(self.set_account(cat['child_ids']))
451+ return lst
452+
453+ def _ref_lines(self, form):
454+ result = []
455+ res = {}
456+ acc_pool = self.pool.get('account.analytic.account')
457+ line_pool = self.pool.get('account.analytic.line')
458+
459+ self.dict_acc_ref = {}
460+ if form['journal_ids']:
461+ journal = " in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")"
462+ else:
463+ journal = 'is not null'
464+
465+ query_general = "SELECT id FROM account_analytic_line WHERE (journal_id " + journal +") AND date>='"+ str(form['date1']) +"'"" AND date<='" + str(form['date2']) + "'"
466+
467+ self.cr.execute(query_general)
468+ l_ids = self.cr.fetchall()
469+ line_ids = [x[0] for x in l_ids]
470+
471+ obj_line = line_pool.browse(self.cr,self.uid,line_ids)
472+
473+ #this structure will be usefull for easily knowing the account_analytic_line that are related to the reference account. At this purpose, we save the move_id of analytic lines.
474+ self.dict_acc_ref[form['ref']] = []
475+ children_list = acc_pool.search(self.cr, self.uid, [('parent_id', 'child_of', [form['ref']])])
476+ for obj in obj_line:
477+ if obj.account_id.id in children_list:
478+ if obj.move_id and obj.move_id.id not in self.dict_acc_ref[form['ref']]:
479+ self.dict_acc_ref[form['ref']].append(obj.move_id.id)
480+
481+ res['ref_name'] = acc_pool.name_get(self.cr, self.uid, [form['ref']])[0][1]
482+ res['ref_code'] = acc_pool.browse(self.cr, self.uid, form['ref']).code
483+
484+ self.final_list = children_list
485+ selected_ids = line_pool.search(self.cr, self.uid, [('account_id', 'in' ,self.final_list)])
486+
487+ res['ref_qty'] = 0.0
488+ res['ref_amt'] = 0.0
489+ self.base_amount = 0.0
490+
491+ if selected_ids:
492+ query = "SELECT SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \
493+ WHERE aal.account_id = aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'"
494+
495+ self.cr.execute(query)
496+ info=self.cr.dictfetchall()
497+ res['ref_qty'] = info[0]['qty']
498+ res['ref_amt'] = info[0]['amt']
499+ self.base_amount = info[0]['amt']
500+ result.append(res)
501+ return result
502+
503+ def _lines(self, form, ids=None):
504+ print "\n\n :::::::lines",form
505+ if ids is None:
506+ ids = {}
507+ if not ids:
508+ ids = self.ids
509+
510+ if form['journal_ids']:
511+ journal=" in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")"
512+ else:
513+ journal= 'is not null'
514+
515+ acc_pool = self.pool.get('account.analytic.account')
516+ line_pool = self.pool.get('account.analytic.line')
517+ acc_id = []
518+ final = []
519+ self.list_ids = []
520+
521+ self.final_list = self.find_children(ids)
522+
523+ for acc_id in self.final_list:
524+ selected_ids = line_pool.search(self.cr, self.uid, [('account_id','=',acc_id), ('move_id', 'in', self.dict_acc_ref[form['ref']])])
525+ if selected_ids:
526+ query="SELECT aaa.code AS code, SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty, aaa.name AS acc_name, aal.account_id AS id FROM account_analytic_line AS aal, account_analytic_account AS aaa \
527+ WHERE aal.account_id=aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'"" GROUP BY aal.account_id,aaa.name,aaa.code ORDER BY aal.account_id"
528+
529+ self.cr.execute(query)
530+ res = self.cr.dictfetchall()
531+ if res:
532+ for element in res:
533+ if self.base_amount <> 0.00:
534+ element['perc'] = (element['amt'] / self.base_amount) * 100.00
535+ else:
536+ element['perc'] = 0.00
537+ else:
538+ result = {}
539+ res = []
540+ result['id'] = acc_id
541+ data_account = acc_pool.browse(self.cr, self.uid, acc_id)
542+ result['acc_name'] = data_account.name
543+ result['code'] = data_account.code
544+ result['amt'] = result['qty'] = result['perc'] = 0.00
545+ if not form['empty_line']:
546+ res.append(result)
547+ else:
548+ result = {}
549+ res = []
550+ result['id'] = acc_id
551+ data_account = acc_pool.browse(self.cr, self.uid, acc_id)
552+ result['acc_name'] = data_account.name
553+ result['code'] = data_account.code
554+ result['amt'] = result['qty'] = result['perc'] = 0.00
555+ if not form['empty_line']:
556+ res.append(result)
557+
558+ for item in res:
559+ obj_acc = acc_pool.name_get(self.cr,self.uid,[item['id']])
560+ item['acc_name'] = obj_acc[0][1]
561+ final.append(item)
562+ print final
563+ return final
564+
565+report_sxw.report_sxw('report.account.analytic.account.crossovered.analytic.webkit', 'account.analytic.account', 'addons/account_analytic_plans_webkit/report/crossovered_analytic.rml',parser = crossovered_analytic, header='internal')
566+
567+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
568+
569
570=== added directory 'account_analytic_plans_webkit/wizard'
571=== added file 'account_analytic_plans_webkit/wizard/__init__.py'
572--- account_analytic_plans_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
573+++ account_analytic_plans_webkit/wizard/__init__.py 2013-10-10 09:47:29 +0000
574@@ -0,0 +1,26 @@
575+# -*- coding: utf-8 -*-
576+##############################################################################
577+#
578+# OpenERP, Open Source Management Solution
579+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
580+#
581+# This program is free software: you can redistribute it and/or modify
582+# it under the terms of the GNU Affero General Public License as
583+# published by the Free Software Foundation, either version 3 of the
584+# License, or (at your option) any later version.
585+#
586+# This program is distributed in the hope that it will be useful,
587+# but WITHOUT ANY WARRANTY; without even the implied warranty of
588+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
589+# GNU Affero General Public License for more details.
590+#
591+# You should have received a copy of the GNU Affero General Public License
592+# along with this program. If not, see <http://www.gnu.org/licenses/>.
593+#
594+############################################################################
595+
596+
597+import account_crossovered_analytic
598+
599+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
600+
601
602=== added file 'account_analytic_plans_webkit/wizard/account_crossovered_analytic.py'
603--- account_analytic_plans_webkit/wizard/account_crossovered_analytic.py 1970-01-01 00:00:00 +0000
604+++ account_analytic_plans_webkit/wizard/account_crossovered_analytic.py 2013-10-10 09:47:29 +0000
605@@ -0,0 +1,70 @@
606+# -*- coding: utf-8 -*-
607+##############################################################################
608+#
609+# OpenERP, Open Source Management Solution
610+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
611+#
612+# This program is free software: you can redistribute it and/or modify
613+# it under the terms of the GNU Affero General Public License as
614+# published by the Free Software Foundation, either version 3 of the
615+# License, or (at your option) any later version.
616+#
617+# This program is distributed in the hope that it will be useful,
618+# but WITHOUT ANY WARRANTY; without even the implied warranty of
619+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
620+# GNU Affero General Public License for more details.
621+#
622+# You should have received a copy of the GNU Affero General Public License
623+# along with this program. If not, see <http://www.gnu.org/licenses/>.
624+#
625+############################################################################
626+
627+import time
628+
629+from openerp.osv import fields, osv
630+from openerp.tools.translate import _
631+
632+class account_crossovered_analytic(osv.osv_memory):
633+ _inherit = "account.crossovered.analytic"
634+
635+
636+
637+ def print_report(self, cr, uid, ids, context=None):
638+
639+ res = super(account_crossovered_analytic,self).print_report( cr, uid, ids, context=context)
640+ res['report_name']= 'account.analytic.account.crossovered.analytic.webkit'
641+ return res
642+# cr.execute('SELECT account_id FROM account_analytic_line')
643+# res = cr.fetchall()
644+# acc_ids = [x[0] for x in res]
645+#
646+# data = self.read(cr, uid, ids, [], context=context)[0]
647+# data['ref'] = data['ref'][0]
648+#
649+# obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context)
650+# name = obj_acc.name
651+#
652+# account_ids = self.pool.get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['ref']])], context=context)
653+#
654+# flag = True
655+# for acc in account_ids:
656+# if acc in acc_ids:
657+# flag = False
658+# break
659+# if flag:
660+# raise osv.except_osv(_('User Error!'),_('There are no analytic lines related to account %s.' % name))
661+#
662+# datas = {
663+# 'ids': [],
664+# 'model': 'account.analytic.account',
665+# 'form': data
666+# }
667+# return {
668+# 'type': 'ir.actions.report.xml',
669+# 'report_name': 'account.analytic.account.crossovered.analytic',
670+# 'datas': datas,
671+# }
672+
673+account_crossovered_analytic()
674+
675+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
676
677=== added directory 'account_bank_statement_extensions_webkit'
678=== added file 'account_bank_statement_extensions_webkit/__init__.py'
679--- account_bank_statement_extensions_webkit/__init__.py 1970-01-01 00:00:00 +0000
680+++ account_bank_statement_extensions_webkit/__init__.py 2013-10-10 09:47:29 +0000
681@@ -0,0 +1,24 @@
682+# -*- coding: utf-8 -*-
683+##############################################################################
684+#
685+# OpenERP, Open Source Management Solution
686+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
687+#
688+# This program is free software: you can redistribute it and/or modify
689+# it under the terms of the GNU Affero General Public License as
690+# published by the Free Software Foundation, either version 3 of the
691+# License, or (at your option) any later version.
692+#
693+# This program is distributed in the hope that it will be useful,
694+# but WITHOUT ANY WARRANTY; without even the implied warranty of
695+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
696+# GNU Affero General Public License for more details.
697+#
698+# You should have received a copy of the GNU Affero General Public License
699+# along with this program. If not, see <http://www.gnu.org/licenses/>.
700+#
701+############################################################################
702+
703+import report
704+
705+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
706
707=== added file 'account_bank_statement_extensions_webkit/__openerp__.py'
708--- account_bank_statement_extensions_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
709+++ account_bank_statement_extensions_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
710@@ -0,0 +1,41 @@
711+# -*- coding: utf-8 -*-
712+##############################################################################
713+#
714+# OpenERP, Open Source Management Solution
715+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
716+#
717+# This program is free software: you can redistribute it and/or modify
718+# it under the terms of the GNU Affero General Public License as
719+# published by the Free Software Foundation, either version 3 of the
720+# License, or (at your option) any later version.
721+#
722+# This program is distributed in the hope that it will be useful,
723+# but WITHOUT ANY WARRANTY; without even the implied warranty of
724+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
725+# GNU Affero General Public License for more details.
726+#
727+# You should have received a copy of the GNU Affero General Public License
728+# along with this program. If not, see <http://www.gnu.org/licenses/>.
729+#
730+############################################################################
731+{
732+ 'name': 'Bank Statement Extensions to Support e-banking Webkit',
733+ 'version': '1.1',
734+ 'author': 'Serpent Consulting Services',
735+ 'category': 'Generic Modules/Accounting',
736+ 'description': '''
737+Module that extends the standard account_bank_statement_line object for improved e-banking support.
738+===================================================================================================
739+
740+ It is conversion of rml report to Webkit Report.
741+
742+ ''',
743+ 'depends': ['account_bank_statement_extensions','report_webkit'],
744+ 'data' : [
745+ 'account_bank_statement_report.xml',
746+ ],
747+ 'auto_install': False,
748+ 'installable': True,
749+}
750+
751+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
752
753=== added file 'account_bank_statement_extensions_webkit/account_bank_statement_report.xml'
754--- account_bank_statement_extensions_webkit/account_bank_statement_report.xml 1970-01-01 00:00:00 +0000
755+++ account_bank_statement_extensions_webkit/account_bank_statement_report.xml 2013-10-10 09:47:29 +0000
756@@ -0,0 +1,113 @@
757+<?xml version="1.0" encoding="utf-8"?>
758+<openerp>
759+ <data>
760+ <record id="account_bank_statement_webkit_header" model="ir.header_webkit">
761+ <field name="footer_html"><![CDATA[]]></field>
762+ <field name="orientation">Portrait</field>
763+ <field name="format">A4</field>
764+ <field name="html"><![CDATA[
765+ <html>
766+ <head>
767+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
768+ <script>
769+ function subst() {
770+ var vars={};
771+ var x=document.location.search.substring(1).split('&');
772+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
773+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
774+ for(var i in x) {
775+ var y = document.getElementsByClassName(x[i]);
776+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
777+ }
778+ }
779+ </script>
780+ <style type="text/css">
781+
782+ ${css}
783+ </style>
784+ </head>
785+ <body style="border:0; margin: 0;" onload="subst()">
786+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
787+ <tr >
788+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
789+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
790+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
791+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
792+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
793+ </tr>
794+ </table> ${_debug or ''|n} </body>
795+ </html>]]>
796+ </field>
797+ <field eval="15.0" name="margin_top"/>
798+ <field eval="5.0" name="margin_bottom"/>
799+ <field name="css"><![CDATA[
800+
801+ body, table, td, span, div {
802+ font-family: Helvetica, Arial;
803+ }
804+
805+ body {
806+ font-family:Arial;
807+ font-size:12px;
808+
809+ }
810+
811+ .tr_bottom_line_dark_grey{
812+ border-bottom: thin solid grey;
813+ width:100%;
814+ font-size:12px;
815+
816+ }
817+ .tr_bottom_line_dark_black{
818+ border-bottom: thin solid black;
819+ width:100%;
820+ font-size:12px;
821+ font-weight:bold;
822+ }
823+ tr.report_header{
824+
825+ caption-side: top;
826+ font-family: Helvetica-Bold
827+ padding: 5px;
828+ border-bottom: 15px solid black;
829+ align: center;
830+ }
831+
832+
833+ .header {
834+ margin-left:0;
835+ text-align:left;
836+ width:300px;
837+ font-size:12;
838+ }
839+ .title {
840+ font-size:16;
841+ font-weight: bold;
842+
843+ }
844+
845+ .list_table {
846+ border-bottom:black;
847+ text-align:center;
848+ border-collapse: collapse;
849+
850+ }
851+
852+ ]]>
853+ </field>
854+ <field name="name">Account Bank Statment Webkit Header</field>
855+ </record>
856+
857+ <report
858+ auto="False"
859+ id="bank_statement_balance_report"
860+ model="account.bank.statement"
861+ name="bank.statement.balance.report.webkit"
862+ file="account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako"
863+ report_type="webkit"
864+ webkit_header="account_bank_statement_webkit_header"
865+ string="Bank Statement Balances Report"
866+ multi="True"/>
867+
868+ </data>
869+</openerp>
870
871=== added directory 'account_bank_statement_extensions_webkit/report'
872=== added file 'account_bank_statement_extensions_webkit/report/__init__.py'
873--- account_bank_statement_extensions_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
874+++ account_bank_statement_extensions_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
875@@ -0,0 +1,25 @@
876+# -*- coding: utf-8 -*-
877+##############################################################################
878+#
879+# OpenERP, Open Source Management Solution
880+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
881+#
882+# This program is free software: you can redistribute it and/or modify
883+# it under the terms of the GNU Affero General Public License as
884+# published by the Free Software Foundation, either version 3 of the
885+# License, or (at your option) any later version.
886+#
887+# This program is distributed in the hope that it will be useful,
888+# but WITHOUT ANY WARRANTY; without even the implied warranty of
889+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
890+# GNU Affero General Public License for more details.
891+#
892+# You should have received a copy of the GNU Affero General Public License
893+# along with this program. If not, see <http://www.gnu.org/licenses/>.
894+#
895+############################################################################
896+
897+
898+import bank_statement_balance_report
899+
900+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
901
902=== added file 'account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako'
903--- account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako 1970-01-01 00:00:00 +0000
904+++ account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako 2013-10-10 09:47:29 +0000
905@@ -0,0 +1,56 @@
906+<html>
907+ <head>
908+ <style type="text/css">
909+ ${css}
910+ </style>
911+ </head>
912+<body>
913+ <br/>
914+ <table width="100%">
915+ <tr class ="report_header">
916+ <td align="center">
917+ <h4><b>
918+ Bank Statement Balances Report
919+ </b></h4>
920+ </td>
921+ </tr>
922+ </table>
923+ <br/> <br/>
924+
925+ <table border="0" class="tr_bottom_line_dark_black" >
926+ <tr>
927+ <td width="30%">
928+ ${_('Name')}
929+ </td>
930+ <td width="30%">
931+ ${_('Date')}
932+ </td>
933+ <td width="20%">
934+ ${_('Journal')}
935+ </td>
936+ <td width="20%" align="right">
937+ ${_('Closing Balance')}
938+ </td>
939+ </tr>
940+ </table>
941+ %for l in lines:
942+ <table border="0" class="tr_bottom_line_dark_grey">
943+ <tr >
944+ <td width="30%">
945+ ${ l['s_name'] }
946+ </td>
947+ <td width="30%">
948+ ${ l['s_date'] }
949+ </td>
950+ <td width="20%">
951+ ${ l['j_code'] }
952+ </td>
953+ <td width="20%" align="right">
954+ ${ (l['s_balance']) }
955+ </td>
956+ </tr>
957+ %endfor
958+ </table>
959+ <p style="page-break-after:always"></p>
960+</body>
961+</html>
962\ No newline at end of file
963
964=== added file 'account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py'
965--- account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py 1970-01-01 00:00:00 +0000
966+++ account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py 2013-10-10 09:47:29 +0000
967@@ -0,0 +1,70 @@
968+# -*- coding: utf-8 -*-
969+##############################################################################
970+#
971+# OpenERP, Open Source Management Solution
972+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
973+#
974+# This program is free software: you can redistribute it and/or modify
975+# it under the terms of the GNU Affero General Public License as
976+# published by the Free Software Foundation, either version 3 of the
977+# License, or (at your option) any later version.
978+#
979+# This program is distributed in the hope that it will be useful,
980+# but WITHOUT ANY WARRANTY; without even the implied warranty of
981+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
982+# GNU Affero General Public License for more details.
983+#
984+# You should have received a copy of the GNU Affero General Public License
985+# along with this program. If not, see <http://www.gnu.org/licenses/>.
986+#
987+############################################################################
988+
989+
990+import time
991+from openerp.report import report_sxw
992+from openerp import pooler
993+import logging
994+_logger = logging.getLogger(__name__)
995+
996+class bank_statement_balance_report(report_sxw.rml_parse):
997+
998+ def set_context(self, objects, data, ids, report_type=None):
999+ #_logger.warning('addons.'+__name__, 'set_context, objects = %s, data = %s, ids = %s' % (objects, data, ids))
1000+ cr = self.cr
1001+ uid = self.uid
1002+ context = self.context
1003+
1004+ cr.execute('SELECT s.name as s_name, s.date AS s_date, j.code as j_code, s.balance_end_real as s_balance ' \
1005+ 'FROM account_bank_statement s ' \
1006+ 'INNER JOIN account_journal j on s.journal_id = j.id ' \
1007+ 'INNER JOIN ' \
1008+ '(SELECT journal_id, max(date) as max_date FROM account_bank_statement ' \
1009+ 'GROUP BY journal_id) d ' \
1010+ 'ON (s.journal_id = d.journal_id AND s.date = d.max_date) ' \
1011+ 'ORDER BY j.code')
1012+ lines = cr.dictfetchall()
1013+
1014+ self.localcontext.update( {
1015+ 'lines': lines,
1016+ })
1017+ super(bank_statement_balance_report, self).set_context(objects, data, ids, report_type=report_type)
1018+
1019+
1020+ def __init__(self, cr, uid, name, context):
1021+ if context is None:
1022+ context = {}
1023+ super(bank_statement_balance_report, self).__init__(cr, uid, name, context=context)
1024+ self.localcontext.update( {
1025+ 'time': time,
1026+ })
1027+ self.context = context
1028+
1029+report_sxw.report_sxw(
1030+ 'report.bank.statement.balance.report.webkit',
1031+ 'account.bank.statement',
1032+ 'addons/account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako',
1033+ parser=bank_statement_balance_report,
1034+ header='internal'
1035+)
1036+
1037+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1038
1039=== added directory 'account_budget_webkit'
1040=== added file 'account_budget_webkit/__init__.py'
1041--- account_budget_webkit/__init__.py 1970-01-01 00:00:00 +0000
1042+++ account_budget_webkit/__init__.py 2013-10-10 09:47:29 +0000
1043@@ -0,0 +1,26 @@
1044+# -*- coding: utf-8 -*-
1045+##############################################################################
1046+#
1047+# OpenERP, Open Source Management Solution
1048+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
1049+#
1050+# This program is free software: you can redistribute it and/or modify
1051+# it under the terms of the GNU Affero General Public License as
1052+# published by the Free Software Foundation, either version 3 of the
1053+# License, or (at your option) any later version.
1054+#
1055+# This program is distributed in the hope that it will be useful,
1056+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1057+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1058+# GNU Affero General Public License for more details.
1059+#
1060+# You should have received a copy of the GNU Affero General Public License
1061+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1062+#
1063+############################################################################
1064+
1065+import report
1066+import wizard
1067+
1068+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1069+
1070
1071=== added file 'account_budget_webkit/__openerp__.py'
1072--- account_budget_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
1073+++ account_budget_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
1074@@ -0,0 +1,42 @@
1075+# -*- coding: utf-8 -*-
1076+##############################################################################
1077+#
1078+# OpenERP, Open Source Management Solution
1079+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
1080+#
1081+# This program is free software: you can redistribute it and/or modify
1082+# it under the terms of the GNU Affero General Public License as
1083+# published by the Free Software Foundation, either version 3 of the
1084+# License, or (at your option) any later version.
1085+#
1086+# This program is distributed in the hope that it will be useful,
1087+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1088+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1089+# GNU Affero General Public License for more details.
1090+#
1091+# You should have received a copy of the GNU Affero General Public License
1092+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1093+#
1094+############################################################################
1095+
1096+{
1097+ 'name': 'Budgets Management',
1098+ 'version': '1.0',
1099+ 'category': 'Accounting & Finance',
1100+ 'description': """
1101+This module allows accountants to manage analytic and crossovered budgets.
1102+==========================================================================
1103+
1104+It is conversion of rml report to Webkit Report.
1105+
1106+""",
1107+ 'author': 'Serpent Consulting Services',
1108+ 'website': 'http://www.serpentcs.com',
1109+ 'depends': ['account_budget','report_webkit'],
1110+ 'data': [
1111+ 'account_budget_report.xml',
1112+ ],
1113+ 'installable': True,
1114+ 'auto_install': False,
1115+}
1116+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1117
1118=== added file 'account_budget_webkit/account_budget_report.xml'
1119--- account_budget_webkit/account_budget_report.xml 1970-01-01 00:00:00 +0000
1120+++ account_budget_webkit/account_budget_report.xml 2013-10-10 09:47:29 +0000
1121@@ -0,0 +1,234 @@
1122+<?xml version="1.0"?>
1123+<openerp>
1124+ <data>
1125+ <record id="account_budget_webkit_header" model="ir.header_webkit">
1126+ <field name="footer_html"><![CDATA[]]></field>
1127+ <field name="orientation">Portrait</field>
1128+ <field name="format">A4</field>
1129+ <field name="html"><![CDATA[
1130+ <html>
1131+ <head>
1132+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
1133+ <script>
1134+ function subst() {
1135+ var vars={};
1136+ var x=document.location.search.substring(1).split('&');
1137+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
1138+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
1139+ for(var i in x) {
1140+ var y = document.getElementsByClassName(x[i]);
1141+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
1142+ }
1143+ }
1144+ </script>
1145+ <style type="text/css">
1146+
1147+ ${css}
1148+ </style>
1149+ </head>
1150+ <body style="border:0; margin: 0;" onload="subst()">
1151+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
1152+ <tr >
1153+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
1154+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
1155+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
1156+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
1157+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
1158+ </tr>
1159+ </table> ${_debug or ''|n} </body>
1160+ </html>]]>
1161+ </field>
1162+ <field eval="15.0" name="margin_top"/>
1163+ <field eval="5.0" name="margin_bottom"/>
1164+ <field name="css"><![CDATA[
1165+
1166+ body, table, td, span, div {
1167+ font-family: Helvetica, Arial;
1168+ }
1169+
1170+ body {
1171+ font-family:Arial;
1172+ font-size:12;
1173+
1174+ }
1175+
1176+
1177+ .header {
1178+ margin-left:0;
1179+ text-align:left;
1180+ width:300px;
1181+ font-size:12;
1182+ }
1183+ .title {
1184+ font-size:16;
1185+ font-weight: bold;
1186+
1187+ }
1188+
1189+ .basic_table td
1190+ {
1191+ border:1px solid lightGrey;
1192+ font-size:12;
1193+
1194+ }
1195+
1196+ .list_table {
1197+ border-bottom:1px solid black;
1198+ border-right:border-bottom:1px solid #E5E4E2"
1199+ text-align:left;
1200+ font-size:12;
1201+ }
1202+ .list_table_grey{
1203+ font-size:12;
1204+ }
1205+ .list_table_grey tr{
1206+ border-bottom:1px solid #E5E4E2";
1207+
1208+ text-align:left;
1209+ font-size:12;
1210+ }
1211+ .basic_table{
1212+ text-align:center;
1213+ border:1px solid lightGrey;
1214+ border-collapse: collapse;
1215+ }
1216+
1217+ .list_tabe thead {
1218+ display:table-header-group;
1219+ }
1220+
1221+ .line{
1222+ font-size:12px;
1223+ border-top: 1px solid grey;
1224+ border-bottom: 1px solid #E5E4E2;
1225+
1226+ }
1227+
1228+ .tbl_header{
1229+ width:100%;
1230+ font-size:10px;
1231+ }
1232+ .tr_bottom_line{
1233+ border-bottom: thin solid black;
1234+ width:100%;
1235+ }
1236+ .tr_bottom_line_dark_grey{
1237+ border-bottom: thin solid grey;
1238+ width:100%;
1239+ }
1240+ .tr_bottom_line_light_grey{
1241+ border-bottom: thin solid #CCCCCC;
1242+ width:100%;
1243+ }
1244+ .td_f12{
1245+ font-size:12px;
1246+ }
1247+ .td_f10{
1248+ font-size:10px;
1249+ }
1250+ .td_f10_right{
1251+ font-size:10px;
1252+ text-align:right;
1253+ }
1254+ .td_f12{
1255+ font-size:12px;
1256+ }
1257+ .td_f12_right{
1258+ font-size:12px;
1259+ text-align:right;
1260+ }
1261+ table.head_border_style{
1262+ border:1px solid;
1263+ color: #cccccc;
1264+ }
1265+ tr.head_border_style{
1266+ border:1px solid;
1267+ color: #cccccc;
1268+ }
1269+ tr.table_header{
1270+ font-weight: bold;
1271+ font-family: sans-serif, serif;
1272+ font-size: 14px;
1273+ caption-side: top;
1274+ padding: 5px;
1275+ }
1276+ tr.table_parent_data{
1277+ font-family: Helvetica-Bold;
1278+ font-size: 12px;
1279+ caption-side: top;
1280+ font-weight: bold;
1281+ }
1282+ tr.table_child_data{
1283+ font-family: Helvetica;
1284+ font-size: 12px;
1285+ caption-side: top;
1286+ }
1287+ tr.report_header{
1288+ font-size: 30px;
1289+ caption-side: top;
1290+ font-family: Helvetica-Bold
1291+ padding: 5px;
1292+ border-bottom: 15px solid black;
1293+ align: center
1294+ }
1295+
1296+ .top{
1297+ border-top: thin solid black;
1298+
1299+ }
1300+ .bottom {
1301+ border-bottom:thin solid;
1302+ border-color:#cccccc;
1303+ }
1304+ .head_bottom_border{
1305+ border-bottom:thin solid;
1306+ border-color:black;
1307+ }
1308+ .left {
1309+ border-left:thin solid;
1310+ border-color:#cccccc;
1311+ }
1312+ .right {
1313+ border-right:thin solid;
1314+ border-color:#cccccc;
1315+ }
1316+
1317+ ]]>
1318+ </field>
1319+ <field name="name">Account Tax Webkit Header</field>
1320+ </record>
1321+
1322+ <!-- Reports on crossovered.budget -->
1323+ <report id="report_crossovered_budget"
1324+ string="Budgets"
1325+ model="crossovered.budget"
1326+ name="crossovered.budget.report.webkit"
1327+ file="account_budget_webkit/report/crossovered_budget_report.mako"
1328+ auto="False"
1329+ menu="False"
1330+ report_type="webkit"
1331+ webkit_header="account_budget_webkit_header"/>
1332+
1333+ <!-- moved from account module -->
1334+ <report auto="False"
1335+ id="account_budget"
1336+ menu="False"
1337+ model="account.budget.post"
1338+ name="account.budget.webkit"
1339+ file="account_budget_webkit/report/budget_report.mako"
1340+ string="Budget"
1341+ report_type="webkit"
1342+ webkit_header="account_budget_webkit_header"/>
1343+
1344+ <report
1345+ auto="False"
1346+ id="account_analytic_budget"
1347+ menu="False"
1348+ model="account.analytic.account"
1349+ name="account.analytic.account.budget.webkit"
1350+ file="account_budget_webkit/report/analytic_account_budget_report.mako"
1351+ string="Print Budget"
1352+ report_type="webkit"
1353+ webkit_header="account_budget_webkit_header" />
1354+ </data>
1355+</openerp>
1356\ No newline at end of file
1357
1358=== added directory 'account_budget_webkit/report'
1359=== added file 'account_budget_webkit/report/__init__.py'
1360--- account_budget_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
1361+++ account_budget_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
1362@@ -0,0 +1,27 @@
1363+# -*- coding: utf-8 -*-
1364+##############################################################################
1365+#
1366+# OpenERP, Open Source Management Solution
1367+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
1368+#
1369+# This program is free software: you can redistribute it and/or modify
1370+# it under the terms of the GNU Affero General Public License as
1371+# published by the Free Software Foundation, either version 3 of the
1372+# License, or (at your option) any later version.
1373+#
1374+# This program is distributed in the hope that it will be useful,
1375+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1376+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1377+# GNU Affero General Public License for more details.
1378+#
1379+# You should have received a copy of the GNU Affero General Public License
1380+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1381+#
1382+############################################################################
1383+
1384+import crossovered_budget_report
1385+import analytic_account_budget_report
1386+import budget_report
1387+
1388+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1389+
1390
1391=== added file 'account_budget_webkit/report/analytic_account_budget_report.mako'
1392--- account_budget_webkit/report/analytic_account_budget_report.mako 1970-01-01 00:00:00 +0000
1393+++ account_budget_webkit/report/analytic_account_budget_report.mako 2013-10-10 09:47:29 +0000
1394@@ -0,0 +1,119 @@
1395+<html>
1396+ <head>
1397+ <style type="text/css">
1398+ ${css}
1399+ .basic_table{
1400+ text-align:center;
1401+ border:1px solid lightGrey;
1402+ border-collapse: collapse;
1403+ }
1404+ </style>
1405+ </head>
1406+<body>
1407+</br>
1408+</br>
1409+</br>
1410+ %for o in objects:
1411+ </br>
1412+ <table width="100%">
1413+ <tr>
1414+ <td align="center">
1415+ <h4>
1416+ <b>Analytic Budget </b></h4>
1417+ </td>
1418+ </tr>
1419+ </table>
1420+<br/>
1421+ <table width="100%" class="basic_table">
1422+ <tr >
1423+ <td width="40%"><b>
1424+ ${_('Analysis from')}
1425+ </td></b>
1426+ <td width="40%"><b>
1427+ ${_('Analytic Account')}</b>
1428+ </td>
1429+ <td width="20%">
1430+ <b>
1431+ ${_('Currency')} </b>
1432+ </td></b>
1433+ </tr>
1434+
1435+ <tr>
1436+ <td>
1437+ ${formatLang(data['form']['date_from'],date=True)} to ${formatLang(data['form']['date_to'],date=True)}
1438+ </td>
1439+ <td>
1440+ ${o.name}
1441+ </td>
1442+ <td>
1443+ ${company.currency_id.name}
1444+ </td>
1445+ </tr>
1446+
1447+ </table>
1448+ <br/>
1449+ <table width="100%" class="list_table">
1450+ <tr >
1451+ <td width="40%"><b>
1452+ ${_('Description')}</b>
1453+ </td>
1454+ <td width="15%"><b>
1455+ ${_('Theoretical Amt')}</b>
1456+ </td>
1457+ <td width="12%"><b>
1458+ ${_('Planned Amt')}</b>
1459+ </td>
1460+ <td width="13%"><b>
1461+ ${_('Practical Amt')}</b>
1462+ </td>
1463+ <td width="10%" align="right"><b>
1464+ ${_('Perc(%)')}</b>
1465+ </td>
1466+ </tr>
1467+ %for a in funct(o,data['form']):
1468+ <tr>
1469+ <td>
1470+ ${a['name']}
1471+ </td>
1472+ <td>
1473+ ${formatLang(a['theo'], currency_obj=company.currency_id) }
1474+ </td>
1475+ <td>
1476+ ${ formatLang(a['pln'], currency_obj=company.currency_id) }
1477+ </td>
1478+ <td>
1479+ ${ formatLang(a['prac'], currency_obj=company.currency_id) }
1480+ </td>
1481+ <td>
1482+ ${ formatLang(a['perc']) }%
1483+ </td>
1484+ </tr>
1485+ %endfor
1486+ </table>
1487+ %for b in funct_total(data['form']):
1488+ <table width="100%">
1489+
1490+ <tr>
1491+ <td width="40%"><b><h5>
1492+ ${ } Total:</h5></b>
1493+ </td>
1494+ <td width="15%" align="right"><h5>
1495+ <b>${ formatLang(b['tot_theo'], currency_obj=company.currency_id) }</b></h5>
1496+ </td>
1497+ <td width="12%" align="right"><b><h5>
1498+ ${ formatLang(b['tot_pln'], currency_obj=company.currency_id) }</b></h5>
1499+ </td>
1500+ <td width="13%" align="right"><b><h5>
1501+ ${ formatLang(b['tot_prac'], currency_obj=company.currency_id) }</h5></b>
1502+ <td width="10%" align="right"><b><h5>
1503+ ${ formatLang(b['tot_perc']) }%</h5></b>
1504+ </td>
1505+ </tr></h5>
1506+ %endfor
1507+ </table>
1508+ <p style="page-break-after:always">
1509+ </p>
1510+
1511+%endfor
1512+</body>
1513+</html>
1514\ No newline at end of file
1515
1516=== added file 'account_budget_webkit/report/analytic_account_budget_report.py'
1517--- account_budget_webkit/report/analytic_account_budget_report.py 1970-01-01 00:00:00 +0000
1518+++ account_budget_webkit/report/analytic_account_budget_report.py 2013-10-10 09:47:29 +0000
1519@@ -0,0 +1,173 @@
1520+# -*- coding: utf-8 -*-
1521+##############################################################################
1522+#
1523+# OpenERP, Open Source Management Solution
1524+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
1525+#
1526+# This program is free software: you can redistribute it and/or modify
1527+# it under the terms of the GNU Affero General Public License as
1528+# published by the Free Software Foundation, either version 3 of the
1529+# License, or (at your option) any later version.
1530+#
1531+# This program is distributed in the hope that it will be useful,
1532+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1533+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1534+# GNU Affero General Public License for more details.
1535+#
1536+# You should have received a copy of the GNU Affero General Public License
1537+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1538+#
1539+############################################################################
1540+
1541+import time
1542+import datetime
1543+
1544+from openerp import pooler
1545+from openerp.report import report_sxw
1546+
1547+class analytic_account_budget_report(report_sxw.rml_parse):
1548+ def __init__(self, cr, uid, name, context):
1549+ super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context)
1550+ self.localcontext.update( {
1551+ 'funct': self.funct,
1552+ 'funct_total': self.funct_total,
1553+ 'time': time,
1554+ })
1555+ self.context = context
1556+
1557+ def funct(self, object, form, ids=None, done=None, level=1):
1558+ if ids is None:
1559+ ids = {}
1560+ if not ids:
1561+ ids = self.ids
1562+ if not done:
1563+ done = {}
1564+
1565+ global tot
1566+ tot = {
1567+ 'theo':0.00,
1568+ 'pln':0.00,
1569+ 'prac':0.00,
1570+ 'perc':0.00
1571+ }
1572+ result = []
1573+ accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy())
1574+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
1575+ obj_c_budget = self.pool.get('crossovered.budget')
1576+
1577+ for account_id in accounts:
1578+ res = {}
1579+ b_line_ids = []
1580+ for line in account_id.crossovered_budget_line:
1581+ b_line_ids.append(line.id)
1582+ if not b_line_ids:
1583+ return []
1584+ d_from = form['date_from']
1585+ d_to = form['date_to']
1586+
1587+ self.cr.execute('SELECT DISTINCT(crossovered_budget_id) FROM crossovered_budget_lines WHERE id =ANY(%s)',(b_line_ids,))
1588+ budget_ids = self.cr.fetchall()
1589+
1590+ context = {'wizard_date_from':d_from,'wizard_date_to':d_to}
1591+ for i in range(0, len(budget_ids)):
1592+ budget_name = obj_c_budget.browse(self.cr, self.uid, [budget_ids[i][0]])
1593+ res= {
1594+ 'b_id':'-1',
1595+ 'a_id':'-1',
1596+ 'name':budget_name[0].name,
1597+ 'status':1,
1598+ 'theo':0.00,
1599+ 'pln':0.00,
1600+ 'prac':0.00,
1601+ 'perc':0.00
1602+ }
1603+ result.append(res)
1604+
1605+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])])
1606+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
1607+ tot_theo = tot_pln = tot_prac = tot_perc = 0
1608+
1609+ done_budget = []
1610+ for line in line_id:
1611+ if line.id in b_line_ids:
1612+ theo = pract = 0.00
1613+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
1614+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
1615+ if line.general_budget_id.id in done_budget:
1616+ for record in result:
1617+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
1618+ record['theo'] += theo
1619+ record['pln'] += line.planned_amount
1620+ record['prac'] += pract
1621+ record['perc'] += line.percentage
1622+ tot_theo += theo
1623+ tot_pln += line.planned_amount
1624+ tot_prac += pract
1625+ tot_perc += line.percentage
1626+ else:
1627+ res1 = {
1628+ 'b_id': line.general_budget_id.id,
1629+ 'a_id': line.analytic_account_id.id,
1630+ 'name': line.general_budget_id.name,
1631+ 'status': 2,
1632+ 'theo': theo,
1633+ 'pln': line.planned_amount,
1634+ 'prac': pract,
1635+ 'perc': line.percentage
1636+ }
1637+ tot_theo += theo
1638+ tot_pln += line.planned_amount
1639+ tot_prac += pract
1640+ tot_perc += line.percentage
1641+ result.append(res1)
1642+ done_budget.append(line.general_budget_id.id)
1643+ else:
1644+ if line.general_budget_id.id in done_budget:
1645+ continue
1646+ else:
1647+ res1={
1648+ 'b_id': line.general_budget_id.id,
1649+ 'a_id': line.analytic_account_id.id,
1650+ 'name': line.general_budget_id.name,
1651+ 'status': 2,
1652+ 'theo': 0.00,
1653+ 'pln': 0.00,
1654+ 'prac': 0.00,
1655+ 'perc': 0.00
1656+ }
1657+ result.append(res1)
1658+ done_budget.append(line.general_budget_id.id)
1659+ if tot_theo == 0.00:
1660+ tot_perc = 0.00
1661+ else:
1662+ tot_perc = float(tot_prac / tot_theo) * 100
1663+
1664+ result[-(len(done_budget) +1)]['theo'] = tot_theo
1665+ tot['theo'] +=tot_theo
1666+ result[-(len(done_budget) +1)]['pln'] = tot_pln
1667+ tot['pln'] +=tot_pln
1668+ result[-(len(done_budget) +1)]['prac'] = tot_prac
1669+ tot['prac'] +=tot_prac
1670+ result[-(len(done_budget) +1)]['perc'] = tot_perc
1671+ if tot['theo'] == 0.00:
1672+ tot['perc'] = 0.00
1673+ else:
1674+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
1675+ return result
1676+
1677+ def funct_total(self, form):
1678+ result = []
1679+ res = {}
1680+ res = {
1681+ 'tot_theo': tot['theo'],
1682+ 'tot_pln': tot['pln'],
1683+ 'tot_prac': tot['prac'],
1684+ 'tot_perc': tot['perc']
1685+ }
1686+ result.append(res)
1687+ return result
1688+
1689+report_sxw.report_sxw('report.account.analytic.account.budget.webkit', 'account.analytic.account', 'account_budget_webkit/report/analytic_account_budget_report.mako',parser=analytic_account_budget_report,header='internal')
1690+
1691+
1692+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1693
1694=== added file 'account_budget_webkit/report/budget_report.mako'
1695--- account_budget_webkit/report/budget_report.mako 1970-01-01 00:00:00 +0000
1696+++ account_budget_webkit/report/budget_report.mako 2013-10-10 09:47:29 +0000
1697@@ -0,0 +1,131 @@
1698+<html>
1699+ <head>
1700+ <style type="text/css">
1701+ ${css}
1702+ </style>
1703+ </head>
1704+<body>
1705+</br>
1706+</br>
1707+</br>
1708+ %for o in objects:
1709+ <br/>
1710+ <table width="100%">
1711+ <tr>
1712+ <td align="center">
1713+ <h4>
1714+ <b> Budget </b></h4>
1715+ </td>
1716+ </tr>
1717+ </table>
1718+ <table width="100%" class="line">
1719+ <tr>
1720+ <td width="1%"></td>
1721+ <td width="49%">
1722+ <b>Currency:</b>${ company.currency_id.name }
1723+ </td>
1724+ <td width="49%" align="right">
1725+ Printed at: ${ formatLang(time.strftime('%Y-%m-%d'),date=True) } at ${ time.strftime('%H:%M:%S') }
1726+ </td>
1727+ <td width="1%"></td>
1728+ </tr>
1729+ <tr>
1730+ <td></td>
1731+ <td>
1732+ <b>Analysis from</b> ${ formatLang(data['form']['date_from'],date=True) } to ${ formatLang(data['form']['date_to'],date=True) }
1733+ </td>
1734+ <td align="right">
1735+ <b>Budget :</b> <font color="Blue">${ o.name }</font>
1736+
1737+ </td>
1738+ <td></td>
1739+ </tr>
1740+ </table>
1741+ <br/>
1742+ <br/>
1743+ <table width="100%" class="list_table">
1744+
1745+ <tr >
1746+ <td width="40%" >
1747+ <b>
1748+ ${_('Description')}
1749+ </b>
1750+ </td>
1751+ <td width="15%" align="right">
1752+ <b>
1753+ ${_('Theoretical Amt')}
1754+ </b>
1755+ </td>
1756+ <td width="12%" align="right">
1757+ <b>
1758+ ${_('Planned Amt')}
1759+ </b>
1760+ </td>
1761+ <td width="13%" align="right">
1762+ <b>
1763+ ${_('Practical Amt')}
1764+ </b>
1765+ </td>
1766+ <td width="10%" align="right">
1767+ <b>
1768+ ${_('Perc(%)')}
1769+ </b>
1770+ </td>
1771+ </tr>
1772+ </table>
1773+
1774+ %for a in funct(o,data['form']):
1775+ <table width="100%" style="border-bottom: 1px solid #ccc !important;text-align:left;font-size:12;">
1776+ <tr>
1777+ <td width="40%">
1778+ %if a['status'] == 1 :
1779+ ${a['name']}
1780+ %endif
1781+ %if a['status'] == 2:
1782+ <p style="padding-left:12px;">${a['name']} </p>
1783+ %endif
1784+ </td>
1785+ <td align="right" width="15%">
1786+ ${formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
1787+ </td>
1788+ <td align="right" width="12%">
1789+ ${formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
1790+ </td>
1791+ <td align="right" width="13%">
1792+ ${formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
1793+ </td>
1794+ <td width="10%" align="right">
1795+ ${formatLang(a['perc'], digits=2) }
1796+ </td>
1797+
1798+ </tr>
1799+
1800+ </table>
1801+ %endfor
1802+ %for b in funct_total(data['form']):
1803+ <table width="100%" class="top">
1804+ <tr>
1805+ <td width="40%">
1806+ Total:
1807+ </td>
1808+ <td width="15%" align="right">
1809+ ${ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
1810+ </td>
1811+ <td width="12%" align="right">
1812+ ${ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
1813+ </td>
1814+ <td width="13%" align="right">
1815+ ${ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
1816+ </td>
1817+ <td width="10%" align="right">
1818+ ${ formatLang(b['tot_perc'], digits=2) }%
1819+ </td>
1820+ </tr>
1821+ </table>
1822+ %endfor
1823+ <p style="page-break-after:always">
1824+ </p>
1825+
1826+%endfor
1827+</body>
1828+</html>
1829\ No newline at end of file
1830
1831=== added file 'account_budget_webkit/report/budget_report.py'
1832--- account_budget_webkit/report/budget_report.py 1970-01-01 00:00:00 +0000
1833+++ account_budget_webkit/report/budget_report.py 2013-10-10 09:47:29 +0000
1834@@ -0,0 +1,192 @@
1835+# -*- coding: utf-8 -*-
1836+##############################################################################
1837+#
1838+# OpenERP, Open Source Management Solution
1839+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
1840+#
1841+# This program is free software: you can redistribute it and/or modify
1842+# it under the terms of the GNU Affero General Public License as
1843+# published by the Free Software Foundation, either version 3 of the
1844+# License, or (at your option) any later version.
1845+#
1846+# This program is distributed in the hope that it will be useful,
1847+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1848+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1849+# GNU Affero General Public License for more details.
1850+#
1851+# You should have received a copy of the GNU Affero General Public License
1852+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1853+#
1854+############################################################################
1855+
1856+import time
1857+from openerp.report import report_sxw
1858+
1859+tot = {}
1860+
1861+class budget_report(report_sxw.rml_parse):
1862+ def __init__(self, cr, uid, name, context):
1863+ super(budget_report, self).__init__(cr, uid, name, context=context)
1864+ self.localcontext.update({
1865+ 'funct': self.funct,
1866+ 'funct_total': self.funct_total,
1867+ 'time': time,
1868+ })
1869+ self.context = context
1870+
1871+ def funct(self, object, form, ids=None, done=None, level=1):
1872+ if ids is None:
1873+ ids = {}
1874+ if not ids:
1875+ ids = self.ids
1876+ if not done:
1877+ done = {}
1878+ global tot
1879+ tot = {
1880+ 'theo':0.00,
1881+ 'pln':0.00,
1882+ 'prac':0.00,
1883+ 'perc':0.00
1884+ }
1885+ result = []
1886+
1887+ budgets = self.pool.get('account.budget.post').browse(self.cr, self.uid, [object.id], self.context.copy())
1888+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
1889+ acc_analytic_obj = self.pool.get('account.analytic.account')
1890+ for budget_id in budgets:
1891+ res = {}
1892+ budget_ids = []
1893+ d_from = form['date_from']
1894+ d_to = form['date_to']
1895+
1896+ for line in budget_id.crossovered_budget_line:
1897+ budget_ids.append(line.id)
1898+
1899+ if not budget_ids:
1900+ return []
1901+ self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
1902+ an_ids = self.cr.fetchall()
1903+
1904+ context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
1905+ for i in range(0, len(an_ids)):
1906+ if not an_ids[i][0]:
1907+ continue
1908+ analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
1909+ res={
1910+ 'b_id': '-1',
1911+ 'a_id': '-1',
1912+ 'name': analytic_name[0].name,
1913+ 'status': 1,
1914+ 'theo': 0.00,
1915+ 'pln': 0.00,
1916+ 'prac': 0.00,
1917+ 'perc': 0.00
1918+ }
1919+ result.append(res)
1920+
1921+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
1922+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
1923+ tot_theo = tot_pln = tot_prac = tot_perc = 0.00
1924+
1925+ done_budget = []
1926+ for line in line_id:
1927+ if line.id in budget_ids:
1928+ theo = pract = 0.00
1929+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
1930+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
1931+ if line.general_budget_id.id in done_budget:
1932+ for record in result:
1933+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
1934+ record['theo'] += theo
1935+ record['pln'] += line.planned_amount
1936+ record['prac'] += pract
1937+ if record['theo'] <> 0.00:
1938+ perc = (record['prac'] / record['theo']) * 100
1939+ else:
1940+ perc = 0.00
1941+ record['perc'] = perc
1942+ tot_theo += theo
1943+ tot_pln += line.planned_amount
1944+ tot_prac += pract
1945+ tot_perc += perc
1946+ else:
1947+ if theo <> 0.00:
1948+ perc = (pract / theo) * 100
1949+ else:
1950+ perc = 0.00
1951+ res1 = {
1952+ 'a_id': line.analytic_account_id.id,
1953+ 'b_id': line.general_budget_id.id,
1954+ 'name': line.general_budget_id.name,
1955+ 'status': 2,
1956+ 'theo': theo,
1957+ 'pln': line.planned_amount,
1958+ 'prac': pract,
1959+ 'perc': perc,
1960+ }
1961+ tot_theo += theo
1962+ tot_pln += line.planned_amount
1963+ tot_prac += pract
1964+ tot_perc += perc
1965+ if form['report'] == 'analytic-full':
1966+ result.append(res1)
1967+ done_budget.append(line.general_budget_id.id)
1968+ else:
1969+
1970+ if line.general_budget_id.id in done_budget:
1971+ continue
1972+ else:
1973+ res1={
1974+ 'a_id': line.analytic_account_id.id,
1975+ 'b_id': line.general_budget_id.id,
1976+ 'name': line.general_budget_id.name,
1977+ 'status': 2,
1978+ 'theo': 0.00,
1979+ 'pln': 0.00,
1980+ 'prac': 0.00,
1981+ 'perc': 0.00
1982+ }
1983+ if form['report'] == 'analytic-full':
1984+ result.append(res1)
1985+ done_budget.append(line.general_budget_id.id)
1986+ if tot_theo == 0.00:
1987+ tot_perc = 0.00
1988+ else:
1989+ tot_perc = float(tot_prac / tot_theo) * 100
1990+ if form['report'] == 'analytic-full':
1991+ result[-(len(done_budget) +1)]['theo'] = tot_theo
1992+ tot['theo'] += tot_theo
1993+ result[-(len(done_budget) +1)]['pln'] = tot_pln
1994+ tot['pln'] += tot_pln
1995+ result[-(len(done_budget) +1)]['prac'] = tot_prac
1996+ tot['prac'] += tot_prac
1997+ result[-(len(done_budget) +1)]['perc'] = tot_perc
1998+ else:
1999+ result[-1]['theo'] = tot_theo
2000+ tot['theo'] += tot_theo
2001+ result[-1]['pln'] = tot_pln
2002+ tot['pln'] += tot_pln
2003+ result[-1]['prac'] = tot_prac
2004+ tot['prac'] += tot_prac
2005+ result[-1]['perc'] = tot_perc
2006+ if tot['theo'] == 0.00:
2007+ tot['perc'] = 0.00
2008+ else:
2009+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
2010+ return result
2011+
2012+ def funct_total(self, form):
2013+ result = []
2014+ res = {}
2015+ res = {
2016+ 'tot_theo': tot['theo'],
2017+ 'tot_pln': tot['pln'],
2018+ 'tot_prac': tot['prac'],
2019+ 'tot_perc': tot['perc']
2020+ }
2021+ result.append(res)
2022+ return result
2023+
2024+report_sxw.report_sxw('report.account.budget.webkit', 'account.budget.post', 'account_budget_webkit/report/budget_report.mako', parser=budget_report, header='internal')
2025+
2026+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2027
2028=== added file 'account_budget_webkit/report/crossovered_budget_report.mako'
2029--- account_budget_webkit/report/crossovered_budget_report.mako 1970-01-01 00:00:00 +0000
2030+++ account_budget_webkit/report/crossovered_budget_report.mako 2013-10-10 09:47:29 +0000
2031@@ -0,0 +1,128 @@
2032+<html>
2033+ <head>
2034+ <style type="text/css">
2035+ ${css}
2036+ </style>
2037+ </head>
2038+<body>
2039+</br>
2040+</br>
2041+</br>
2042+ %for o in objects:
2043+ <br/>
2044+ <table width="100%">
2045+ <tr>
2046+ <td align="center">
2047+ <h4>
2048+ <b> Budget </b></h4>
2049+ </td>
2050+ </tr>
2051+ </table>
2052+ <br/>
2053+ <table width="100%" class="basic_table">
2054+ <tr>
2055+ <td>
2056+ ${_('Analysis from')}
2057+ </td>
2058+ <td>
2059+ ${_('Budget')}
2060+ </td>
2061+ <td>
2062+ ${_('Currency')}
2063+ </td>
2064+ </tr>
2065+ <tr>
2066+ <td>
2067+ ${ formatLang(data['form']['date_from'],date=True) } to ${ formatLang(data['form']['date_to'],date=True) }
2068+ </td>
2069+ <td>
2070+ ${ o.name }
2071+ </td>
2072+ <td>
2073+ ${ company.currency_id.name }
2074+ </td>
2075+ </tr>
2076+ </table>
2077+ <br/>
2078+ <br/>
2079+ <table width="100%" class="list_table">
2080+
2081+ <tr >
2082+ <td width="40%" >
2083+ <b>
2084+ ${_('Description')}
2085+ </b>
2086+ </td>
2087+ <td width="15%" align="right">
2088+ <b>
2089+ ${_('Theoretical Amt')}
2090+ </b>
2091+ </td>
2092+ <td width="12%" align="right">
2093+ <b>
2094+ ${_('Planned Amt')}
2095+ </b>
2096+ </td>
2097+ <td width="13%" align="right">
2098+ <b>
2099+ ${_('Practical Amt')}
2100+ </b>
2101+ </td>
2102+ <td width="10%" align="right">
2103+ <b>
2104+ ${_('Perc(%)')}
2105+ </b>
2106+ </td>
2107+ </tr>
2108+ </table>
2109+ %for a in funct(o,data['form']):
2110+ <table width="100%" style="border-bottom: 1px solid #ccc !important;text-align:left;font-size:12;">
2111+ <tr>
2112+ <td width="40%">
2113+ %if a['status'] == 1 :
2114+ ${a['name']}
2115+ %endif
2116+ %if a['status'] == 2:
2117+ <p style="padding-left:12px;">${a['name']} </p>
2118+ %endif
2119+ </td>
2120+ <td align="right" width="15%">
2121+ ${formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
2122+ </td>
2123+ <td align="right" width="12%">
2124+ ${formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
2125+ </td>
2126+ <td align="right" width="13%">
2127+ ${formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
2128+ </td>
2129+ <td width="10%" align="right">
2130+ ${formatLang(a['perc'], digits=2) }
2131+ </td>
2132+ </tr>
2133+ </table>
2134+ %endfor
2135+ %for b in funct_total(data['form']):
2136+ <table width="100%" class="top">
2137+ <tr>
2138+ <td width="40%">
2139+ Total:
2140+ </td>
2141+ <td width="15%" align="right">
2142+ ${ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
2143+ </td>
2144+ <td width="12%" align="right">
2145+ ${ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
2146+ </td>
2147+ <td width="13%" align="right">
2148+ ${ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
2149+ </td>
2150+ <td width="10%" align="right">
2151+ ${ formatLang(b['tot_perc'], digits=2) }%
2152+ </td>
2153+ </tr>
2154+ </table>
2155+ %endfor
2156+ <p style="page-break-after:always">
2157+ </p>
2158+%endfor
2159+</body>
2160\ No newline at end of file
2161
2162=== added file 'account_budget_webkit/report/crossovered_budget_report.py'
2163--- account_budget_webkit/report/crossovered_budget_report.py 1970-01-01 00:00:00 +0000
2164+++ account_budget_webkit/report/crossovered_budget_report.py 2013-10-10 09:47:29 +0000
2165@@ -0,0 +1,197 @@
2166+# -*- coding: utf-8 -*-
2167+##############################################################################
2168+#
2169+# OpenERP, Open Source Management Solution
2170+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2171+#
2172+# This program is free software: you can redistribute it and/or modify
2173+# it under the terms of the GNU Affero General Public License as
2174+# published by the Free Software Foundation, either version 3 of the
2175+# License, or (at your option) any later version.
2176+#
2177+# This program is distributed in the hope that it will be useful,
2178+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2179+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2180+# GNU Affero General Public License for more details.
2181+#
2182+# You should have received a copy of the GNU Affero General Public License
2183+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2184+#
2185+############################################################################
2186+import time
2187+import datetime
2188+
2189+from openerp import pooler
2190+from openerp.report import report_sxw
2191+import operator
2192+from openerp import osv
2193+
2194+class budget_report(report_sxw.rml_parse):
2195+ def __init__(self, cr, uid, name, context):
2196+ super(budget_report, self).__init__(cr, uid, name, context=context)
2197+ self.localcontext.update({
2198+ 'funct': self.funct,
2199+ 'funct_total': self.funct_total,
2200+ 'time': time,
2201+ })
2202+ self.context = context
2203+
2204+ def funct(self, object, form, ids=None, done=None, level=1):
2205+ if ids is None:
2206+ ids = {}
2207+ if not ids:
2208+ ids = self.ids
2209+ if not done:
2210+ done = {}
2211+ global tot
2212+ tot = {
2213+ 'theo':0.00,
2214+ 'pln':0.00,
2215+ 'prac':0.00,
2216+ 'perc':0.00
2217+ }
2218+ result = []
2219+
2220+ budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy())
2221+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
2222+ acc_analytic_obj = self.pool.get('account.analytic.account')
2223+ for budget_id in budgets:
2224+ res = {}
2225+ budget_lines = []
2226+ budget_ids = []
2227+ d_from = form['date_from']
2228+ d_to = form['date_to']
2229+
2230+ for line in budget_id.crossovered_budget_line:
2231+ budget_ids.append(line.id)
2232+
2233+ if not budget_ids:
2234+ return []
2235+
2236+ self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
2237+ an_ids = self.cr.fetchall()
2238+
2239+ context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
2240+ for i in range(0, len(an_ids)):
2241+ if not an_ids[i][0]:
2242+ continue
2243+ analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
2244+ res={
2245+ 'b_id': '-1',
2246+ 'a_id': '-1',
2247+ 'name': analytic_name[0].name,
2248+ 'status': 1,
2249+ 'theo': 0.00,
2250+ 'pln': 0.00,
2251+ 'prac': 0.00,
2252+ 'perc': 0.00
2253+ }
2254+ result.append(res)
2255+
2256+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
2257+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
2258+ tot_theo = tot_pln = tot_prac = tot_perc = 0.00
2259+
2260+ done_budget = []
2261+ for line in line_id:
2262+ if line.id in budget_ids:
2263+ theo = pract = 0.00
2264+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
2265+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
2266+ if line.general_budget_id.id in done_budget:
2267+ for record in result:
2268+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
2269+ record['theo'] += theo
2270+ record['pln'] += line.planned_amount
2271+ record['prac'] += pract
2272+ if record['theo'] <> 0.00:
2273+ perc = (record['prac'] / record['theo']) * 100
2274+ else:
2275+ perc = 0.00
2276+ record['perc'] = perc
2277+ tot_theo += theo
2278+ tot_pln += line.planned_amount
2279+ tot_prac += pract
2280+ tot_perc += perc
2281+ else:
2282+ if theo <> 0.00:
2283+ perc = (pract / theo) * 100
2284+ else:
2285+ perc = 0.00
2286+ res1 = {
2287+ 'a_id': line.analytic_account_id.id,
2288+ 'b_id': line.general_budget_id.id,
2289+ 'name': line.general_budget_id.name,
2290+ 'status': 2,
2291+ 'theo': theo,
2292+ 'pln': line.planned_amount,
2293+ 'prac': pract,
2294+ 'perc': perc,
2295+ }
2296+ tot_theo += theo
2297+ tot_pln += line.planned_amount
2298+ tot_prac += pract
2299+ tot_perc += perc
2300+ if form['report'] == 'analytic-full':
2301+ result.append(res1)
2302+ done_budget.append(line.general_budget_id.id)
2303+ else:
2304+
2305+ if line.general_budget_id.id in done_budget:
2306+ continue
2307+ else:
2308+ res1={
2309+ 'a_id': line.analytic_account_id.id,
2310+ 'b_id': line.general_budget_id.id,
2311+ 'name': line.general_budget_id.name,
2312+ 'status': 2,
2313+ 'theo': 0.00,
2314+ 'pln': 0.00,
2315+ 'prac': 0.00,
2316+ 'perc': 0.00
2317+ }
2318+ if form['report'] == 'analytic-full':
2319+ result.append(res1)
2320+ done_budget.append(line.general_budget_id.id)
2321+ if tot_theo == 0.00:
2322+ tot_perc = 0.00
2323+ else:
2324+ tot_perc = float(tot_prac / tot_theo) * 100
2325+ if form['report'] == 'analytic-full':
2326+ result[-(len(done_budget) +1)]['theo'] = tot_theo
2327+ tot['theo'] += tot_theo
2328+ result[-(len(done_budget) +1)]['pln'] = tot_pln
2329+ tot['pln'] += tot_pln
2330+ result[-(len(done_budget) +1)]['prac'] = tot_prac
2331+ tot['prac'] += tot_prac
2332+ result[-(len(done_budget) +1)]['perc'] = tot_perc
2333+ else:
2334+ result[-1]['theo'] = tot_theo
2335+ tot['theo'] += tot_theo
2336+ result[-1]['pln'] = tot_pln
2337+ tot['pln'] += tot_pln
2338+ result[-1]['prac'] = tot_prac
2339+ tot['prac'] += tot_prac
2340+ result[-1]['perc'] = tot_perc
2341+ if tot['theo'] == 0.00:
2342+ tot['perc'] = 0.00
2343+ else:
2344+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
2345+ return result
2346+
2347+ def funct_total(self, form):
2348+ result = []
2349+ res = {}
2350+ res = {
2351+ 'tot_theo': tot['theo'],
2352+ 'tot_pln': tot['pln'],
2353+ 'tot_prac': tot['prac'],
2354+ 'tot_perc': tot['perc']
2355+ }
2356+ result.append(res)
2357+ return result
2358+
2359+report_sxw.report_sxw('report.crossovered.budget.report.webkit', 'crossovered.budget', 'account_budget_webkit/report/crossovered_budget_report.mako',parser=budget_report,header='internal')
2360+
2361+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2362+
2363
2364=== added directory 'account_budget_webkit/wizard'
2365=== added file 'account_budget_webkit/wizard/__init__.py'
2366--- account_budget_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
2367+++ account_budget_webkit/wizard/__init__.py 2013-10-10 09:47:29 +0000
2368@@ -0,0 +1,27 @@
2369+# -*- coding: utf-8 -*-
2370+##############################################################################
2371+#
2372+# OpenERP, Open Source Management Solution
2373+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2374+#
2375+# This program is free software: you can redistribute it and/or modify
2376+# it under the terms of the GNU Affero General Public License as
2377+# published by the Free Software Foundation, either version 3 of the
2378+# License, or (at your option) any later version.
2379+#
2380+# This program is distributed in the hope that it will be useful,
2381+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2382+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2383+# GNU Affero General Public License for more details.
2384+#
2385+# You should have received a copy of the GNU Affero General Public License
2386+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2387+#
2388+############################################################################
2389+
2390+import account_budget_crossovered_report
2391+import account_budget_analytic
2392+import account_budget_crossovered_summary_report
2393+import account_budget_report
2394+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2395+
2396
2397=== added file 'account_budget_webkit/wizard/account_budget_analytic.py'
2398--- account_budget_webkit/wizard/account_budget_analytic.py 1970-01-01 00:00:00 +0000
2399+++ account_budget_webkit/wizard/account_budget_analytic.py 2013-10-10 09:47:29 +0000
2400@@ -0,0 +1,37 @@
2401+# -*- coding: utf-8 -*-
2402+##############################################################################
2403+#
2404+# OpenERP, Open Source Management Solution
2405+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2406+#
2407+# This program is free software: you can redistribute it and/or modify
2408+# it under the terms of the GNU Affero General Public License as
2409+# published by the Free Software Foundation, either version 3 of the
2410+# License, or (at your option) any later version.
2411+#
2412+# This program is distributed in the hope that it will be useful,
2413+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2414+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2415+# GNU Affero General Public License for more details.
2416+#
2417+# You should have received a copy of the GNU Affero General Public License
2418+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2419+#
2420+############################################################################
2421+import time
2422+
2423+from openerp.osv import fields, osv
2424+
2425+class account_budget_analytic(osv.osv_memory):
2426+
2427+ _inherit = "account.budget.analytic"
2428+
2429+ def check_report(self, cr, uid, ids, context=None):
2430+
2431+ res = super(account_budget_analytic,self).check_report( cr, uid, ids, context=context)
2432+ res['report_name']= 'account.analytic.account.budget.webkit'
2433+ return res
2434+
2435+account_budget_analytic()
2436+
2437+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2438
2439=== added file 'account_budget_webkit/wizard/account_budget_crossovered_report.py'
2440--- account_budget_webkit/wizard/account_budget_crossovered_report.py 1970-01-01 00:00:00 +0000
2441+++ account_budget_webkit/wizard/account_budget_crossovered_report.py 2013-10-10 09:47:29 +0000
2442@@ -0,0 +1,37 @@
2443+# -*- coding: utf-8 -*-
2444+##############################################################################
2445+#
2446+# OpenERP, Open Source Management Solution
2447+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2448+#
2449+# This program is free software: you can redistribute it and/or modify
2450+# it under the terms of the GNU Affero General Public License as
2451+# published by the Free Software Foundation, either version 3 of the
2452+# License, or (at your option) any later version.
2453+#
2454+# This program is distributed in the hope that it will be useful,
2455+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2456+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2457+# GNU Affero General Public License for more details.
2458+#
2459+# You should have received a copy of the GNU Affero General Public License
2460+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2461+#
2462+############################################################################
2463+import time
2464+
2465+from openerp.osv import fields, osv
2466+
2467+class account_budget_crossvered_report(osv.osv_memory):
2468+
2469+ _inherit="account.budget.crossvered.report"
2470+
2471+ def check_report(self, cr, uid, ids, context=None):
2472+
2473+ res = super(account_budget_crossvered_report,self).check_report( cr, uid, ids, context=context)
2474+ res['report_name']= 'crossovered.budget.report.webkit'
2475+ return res
2476+
2477+account_budget_crossvered_report()
2478+
2479+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2480
2481=== added file 'account_budget_webkit/wizard/account_budget_crossovered_summary_report.py'
2482--- account_budget_webkit/wizard/account_budget_crossovered_summary_report.py 1970-01-01 00:00:00 +0000
2483+++ account_budget_webkit/wizard/account_budget_crossovered_summary_report.py 2013-10-10 09:47:29 +0000
2484@@ -0,0 +1,40 @@
2485+# -*- coding: utf-8 -*-
2486+##############################################################################
2487+#
2488+# OpenERP, Open Source Management Solution
2489+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2490+#
2491+# This program is free software: you can redistribute it and/or modify
2492+# it under the terms of the GNU Affero General Public License as
2493+# published by the Free Software Foundation, either version 3 of the
2494+# License, or (at your option) any later version.
2495+#
2496+# This program is distributed in the hope that it will be useful,
2497+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2498+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2499+# GNU Affero General Public License for more details.
2500+#
2501+# You should have received a copy of the GNU Affero General Public License
2502+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2503+#
2504+############################################################################
2505+import time
2506+
2507+from openerp.osv import fields, osv
2508+
2509+class account_budget_crossvered_summary_report(osv.osv_memory):
2510+ """
2511+ This wizard provides the crossovered budget summary report'
2512+ """
2513+ _inherit = "account.budget.crossvered.summary.report"
2514+
2515+ def check_report(self, cr, uid, ids, context=None):
2516+
2517+ res = super(account_budget_crossvered_summary_report,self).check_report( cr, uid, ids, context=context)
2518+ res['report_name']= 'crossovered.budget.report.webkit'
2519+ return res
2520+
2521+account_budget_crossvered_summary_report()
2522+
2523+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2524+
2525
2526=== added file 'account_budget_webkit/wizard/account_budget_report.py'
2527--- account_budget_webkit/wizard/account_budget_report.py 1970-01-01 00:00:00 +0000
2528+++ account_budget_webkit/wizard/account_budget_report.py 2013-10-10 09:47:29 +0000
2529@@ -0,0 +1,38 @@
2530+# -*- coding: utf-8 -*-
2531+##############################################################################
2532+#
2533+# OpenERP, Open Source Management Solution
2534+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2535+#
2536+# This program is free software: you can redistribute it and/or modify
2537+# it under the terms of the GNU Affero General Public License as
2538+# published by the Free Software Foundation, either version 3 of the
2539+# License, or (at your option) any later version.
2540+#
2541+# This program is distributed in the hope that it will be useful,
2542+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2543+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2544+# GNU Affero General Public License for more details.
2545+#
2546+# You should have received a copy of the GNU Affero General Public License
2547+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2548+#
2549+############################################################################
2550+import time
2551+
2552+from openerp.osv import fields, osv
2553+
2554+
2555+class account_budget_report(osv.osv_memory):
2556+ _inherit = "account.budget.report"
2557+
2558+ def check_report(self, cr, uid, ids, context=None):
2559+
2560+ res = super(account_budget_report,self).check_report( cr, uid, ids, context=context)
2561+ res['report_name']= 'account.budget.webkit'
2562+ return res
2563+
2564+
2565+account_budget_report()
2566+
2567+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2568
2569=== added directory 'account_test_webkit'
2570=== added file 'account_test_webkit/__init__.py'
2571--- account_test_webkit/__init__.py 1970-01-01 00:00:00 +0000
2572+++ account_test_webkit/__init__.py 2013-10-10 09:47:29 +0000
2573@@ -0,0 +1,22 @@
2574+# -*- coding: utf-8 -*-
2575+##############################################################################
2576+#
2577+# OpenERP, Open Source Management Solution
2578+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2579+#
2580+# This program is free software: you can redistribute it and/or modify
2581+# it under the terms of the GNU Affero General Public License as
2582+# published by the Free Software Foundation, either version 3 of the
2583+# License, or (at your option) any later version.
2584+#
2585+# This program is distributed in the hope that it will be useful,
2586+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2587+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2588+# GNU Affero General Public License for more details.
2589+#
2590+# You should have received a copy of the GNU Affero General Public License
2591+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2592+#
2593+############################################################################
2594+
2595+import report
2596
2597=== added file 'account_test_webkit/__openerp__.py'
2598--- account_test_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
2599+++ account_test_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
2600@@ -0,0 +1,41 @@
2601+# -*- coding: utf-8 -*-
2602+##############################################################################
2603+#
2604+# OpenERP, Open Source Management Solution
2605+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2606+#
2607+# This program is free software: you can redistribute it and/or modify
2608+# it under the terms of the GNU Affero General Public License as
2609+# published by the Free Software Foundation, either version 3 of the
2610+# License, or (at your option) any later version.
2611+#
2612+# This program is distributed in the hope that it will be useful,
2613+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2614+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2615+# GNU Affero General Public License for more details.
2616+#
2617+# You should have received a copy of the GNU Affero General Public License
2618+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2619+#
2620+############################################################################
2621+
2622+{
2623+ 'name' : 'Accounting Consistency Tests',
2624+ 'version' : '1.0',
2625+ 'author' : 'Serpent Consulting Services',
2626+ 'category' : 'Accounting & Finance',
2627+ 'website': 'http://www.serpentcs.com',
2628+ 'description': """
2629+Asserts on accounting.
2630+======================
2631+It is conversion of rml report to Webkit Report.
2632+
2633+""",
2634+ 'depends' : ['account_test','report_webkit'],
2635+ 'data' : [
2636+ 'account_test_report.xml',
2637+ ],
2638+ 'active': False,
2639+ 'installable': True
2640+}
2641+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2642
2643=== added file 'account_test_webkit/account_test_report.xml'
2644--- account_test_webkit/account_test_report.xml 1970-01-01 00:00:00 +0000
2645+++ account_test_webkit/account_test_report.xml 2013-10-10 09:47:29 +0000
2646@@ -0,0 +1,26 @@
2647+<?xml version="1.0" encoding="utf-8"?>
2648+<openerp>
2649+<data>
2650+ <record id="account_test_header" model="ir.header_webkit">
2651+ <field name="footer_html"><![CDATA[]]></field>
2652+ <field name="orientation">Portrait</field>
2653+ <field name="format">A4</field>
2654+ <field name="html"><![CDATA[]]>
2655+ </field>
2656+ <field eval="15.0" name="margin_top"/>
2657+ <field eval="5.0" name="margin_bottom"/>
2658+ <field name="css"><![CDATA[ ]]>
2659+ </field>
2660+ <field name="name">Account Test webkit header</field>
2661+ </record>
2662+
2663+ <report
2664+ id="account_assert_test_report"
2665+ model="accounting.assert.test"
2666+ name="account.test.assert.print.webkit"
2667+ file="account_test_webkit/report/account_test.mako"
2668+ webkit_header="account_test_header"
2669+ report_type="webkit"
2670+ string="Accounting Tests"/>
2671+</data>
2672+</openerp>
2673
2674=== added directory 'account_test_webkit/report'
2675=== added file 'account_test_webkit/report/__init__.py'
2676--- account_test_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
2677+++ account_test_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
2678@@ -0,0 +1,24 @@
2679+# -*- coding: utf-8 -*-
2680+##############################################################################
2681+#
2682+# OpenERP, Open Source Management Solution
2683+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2684+#
2685+# This program is free software: you can redistribute it and/or modify
2686+# it under the terms of the GNU Affero General Public License as
2687+# published by the Free Software Foundation, either version 3 of the
2688+# License, or (at your option) any later version.
2689+#
2690+# This program is distributed in the hope that it will be useful,
2691+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2692+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2693+# GNU Affero General Public License for more details.
2694+#
2695+# You should have received a copy of the GNU Affero General Public License
2696+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2697+#
2698+############################################################################
2699+
2700+import account_test_report
2701+
2702+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2703
2704=== added file 'account_test_webkit/report/account_test.mako'
2705--- account_test_webkit/report/account_test.mako 1970-01-01 00:00:00 +0000
2706+++ account_test_webkit/report/account_test.mako 2013-10-10 09:47:29 +0000
2707@@ -0,0 +1,53 @@
2708+<html>
2709+<head>
2710+ <style type="text/css">
2711+ .list_table2 {
2712+ text-align:left;
2713+ border-collapse: collapse;
2714+ }
2715+ .list_table2 td {
2716+ border:1px solid black;
2717+ border-collapse: collapse;
2718+ font-family:"Times New Roman";
2719+ font-size:12px;
2720+ padding: 5px 5px 5px 5px;
2721+ }
2722+
2723+ </style>
2724+ <title>Account_Test.pdf</title>
2725+</head>
2726+<body>
2727+<table width="100%" style="font-family: Times New Roman ;font-size:20px;">
2728+ <tr>
2729+ <td align="center">
2730+ Accouting tests on ${ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") }
2731+ </td>
2732+ </tr>
2733+</table>
2734+</br>
2735+%for o in objects:
2736+ <table width="100%" class="list_table2">
2737+ <tr>
2738+ <td>
2739+ ${o.name}
2740+ </td>
2741+ </tr>
2742+ <tr>
2743+ <td>
2744+ <i>${ o.desc or '' }</i>
2745+ </td>
2746+ </tr>
2747+ </table>
2748+ <table width="100%" style="font-family: Times New Roman;font-size:12px;">
2749+ %for test_result in execute_code(o.code_exec):
2750+ <tr>
2751+ <td>
2752+ ${ test_result }
2753+ </td>
2754+ </tr>
2755+ %endfor
2756+ </table>
2757+ </br>
2758+%endfor
2759+</body>
2760+</html>
2761\ No newline at end of file
2762
2763=== added file 'account_test_webkit/report/account_test_report.py'
2764--- account_test_webkit/report/account_test_report.py 1970-01-01 00:00:00 +0000
2765+++ account_test_webkit/report/account_test_report.py 2013-10-10 09:47:29 +0000
2766@@ -0,0 +1,88 @@
2767+# -*- coding: utf-8 -*-
2768+##############################################################################
2769+#
2770+# OpenERP, Open Source Management Solution
2771+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2772+#
2773+# This program is free software: you can redistribute it and/or modify
2774+# it under the terms of the GNU Affero General Public License as
2775+# published by the Free Software Foundation, either version 3 of the
2776+# License, or (at your option) any later version.
2777+#
2778+# This program is distributed in the hope that it will be useful,
2779+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2780+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2781+# GNU Affero General Public License for more details.
2782+#
2783+# You should have received a copy of the GNU Affero General Public License
2784+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2785+#
2786+############################################################################
2787+
2788+
2789+import datetime
2790+import time
2791+from report import report_sxw
2792+from openerp.tools.translate import _
2793+#
2794+# Use period and Journal for selection or resources
2795+#
2796+class report_assert_account(report_sxw.rml_parse):
2797+ def __init__(self, cr, uid, name, context):
2798+ super(report_assert_account, self).__init__(cr, uid, name, context=context)
2799+ self.localcontext.update( {
2800+ 'time': time,
2801+ 'datetime': datetime,
2802+ 'execute_code': self.execute_code,
2803+ })
2804+
2805+ def execute_code(self, code_exec):
2806+ def reconciled_inv():
2807+ """
2808+ returns the list of invoices that are set as reconciled = True
2809+ """
2810+ return self.pool.get('account.invoice').search(self.cr, self.uid, [('reconciled','=',True)])
2811+
2812+ def order_columns(item, cols=None):
2813+ """
2814+ This function is used to display a dictionary as a string, with its columns in the order chosen.
2815+
2816+ :param item: dict
2817+ :param cols: list of field names
2818+ :returns: a list of tuples (fieldname: value) in a similar way that would dict.items() do except that the
2819+ returned values are following the order given by cols
2820+ :rtype: [(key, value)]
2821+ """
2822+ if cols is None:
2823+ cols = item.keys()
2824+ return [(col, item.get(col)) for col in cols if col in item.keys()]
2825+
2826+ localdict = {
2827+ 'cr': self.cr,
2828+ 'uid': self.uid,
2829+ 'reconciled_inv': reconciled_inv, #specific function used in different tests
2830+ 'result': None, #used to store the result of the test
2831+ 'column_order': None, #used to choose the display order of columns (in case you are returning a list of dict)
2832+ }
2833+ exec code_exec in localdict
2834+ result = localdict['result']
2835+ column_order = localdict.get('column_order', None)
2836+
2837+ if not isinstance(result, (tuple, list, set)):
2838+ result = [result]
2839+ if not result:
2840+ result = [_('The test was passed successfully')]
2841+ else:
2842+ def _format(item):
2843+ if isinstance(item, dict):
2844+ return ', '.join(["%s: %s" % (tup[0], tup[1]) for tup in order_columns(item, column_order)])
2845+ else:
2846+ return item
2847+ result = [_(_format(rec)) for rec in result]
2848+
2849+ return result
2850+
2851+report_sxw.report_sxw('report.account.test.assert.print.webkit', 'accounting.assert.test', 'addons/account_test_webkit/report/account_test.mako', parser=report_assert_account, header=False)
2852+
2853+
2854+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2855
2856=== added directory 'account_voucher_webkit'
2857=== added file 'account_voucher_webkit/__init__.py'
2858--- account_voucher_webkit/__init__.py 1970-01-01 00:00:00 +0000
2859+++ account_voucher_webkit/__init__.py 2013-10-10 09:47:29 +0000
2860@@ -0,0 +1,25 @@
2861+# -*- coding: utf-8 -*-
2862+##############################################################################
2863+#
2864+# OpenERP, Open Source Management Solution
2865+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2866+#
2867+# This program is free software: you can redistribute it and/or modify
2868+# it under the terms of the GNU Affero General Public License as
2869+# published by the Free Software Foundation, either version 3 of the
2870+# License, or (at your option) any later version.
2871+#
2872+# This program is distributed in the hope that it will be useful,
2873+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2874+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2875+# GNU Affero General Public License for more details.
2876+#
2877+# You should have received a copy of the GNU Affero General Public License
2878+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2879+#
2880+
2881+##############################################################################
2882+
2883+import report
2884+
2885+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2886
2887=== added file 'account_voucher_webkit/__openerp__.py'
2888--- account_voucher_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
2889+++ account_voucher_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
2890@@ -0,0 +1,45 @@
2891+# -*- coding: utf-8 -*-
2892+##############################################################################
2893+#
2894+# OpenERP, Open Source Management Solution
2895+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
2896+#
2897+# This program is free software: you can redistribute it and/or modify
2898+# it under the terms of the GNU Affero General Public License as
2899+# published by the Free Software Foundation, either version 3 of the
2900+# License, or (at your option) any later version.
2901+#
2902+# This program is distributed in the hope that it will be useful,
2903+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2904+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2905+# GNU Affero General Public License for more details.
2906+#
2907+# You should have received a copy of the GNU Affero General Public License
2908+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2909+#
2910+
2911+##############################################################################
2912+
2913+{
2914+ 'name' : 'eInvoicing & Payments',
2915+ 'version' : '1.0',
2916+ 'author' : 'Serpent Consulting Services',
2917+ 'summary': 'Send Invoices and Track Payments',
2918+ 'description': """
2919+Invoicing & Payments by Accounting Voucher & Receipts
2920+=====================================================
2921+ It is conversion of rml report to Webkit Report.
2922+ """,
2923+ 'category': 'Accounting & Finance',
2924+ 'sequence': 4,
2925+ 'website' : 'http://serpentcs.com',
2926+ 'depends' : ['account_voucher','report_webkit'],
2927+ 'data' : [
2928+ 'account_voucher_report.xml',
2929+ ],
2930+ 'auto_install': False,
2931+ 'application': True,
2932+ 'installable': True,
2933+}
2934+
2935+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2936
2937=== added file 'account_voucher_webkit/account_voucher_report.xml'
2938--- account_voucher_webkit/account_voucher_report.xml 1970-01-01 00:00:00 +0000
2939+++ account_voucher_webkit/account_voucher_report.xml 2013-10-10 09:47:29 +0000
2940@@ -0,0 +1,159 @@
2941+<?xml version="1.0"?>
2942+<openerp>
2943+ <data>
2944+ <record id="voucher_header" model="ir.header_webkit">
2945+ <field name="footer_html"><![CDATA[
2946+ <html>
2947+ <head>
2948+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
2949+ <script>
2950+ function subst() {
2951+ var vars={};
2952+ var x=document.location.search.substring(1).split('&');
2953+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
2954+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
2955+ for(var i in x) {
2956+ var y = document.getElementsByClassName(x[i]);
2957+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
2958+ }
2959+ }
2960+ </script>
2961+ <style type="text/css">
2962+
2963+ ${css}
2964+ </style>
2965+ </head>
2966+ <body style="border:0; margin: 0;" onload="subst()">
2967+ <table class="header" style="border-top: 1px solid black; width: 100%">
2968+ <tr >
2969+ <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
2970+ </tr>
2971+ <tr >
2972+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
2973+ </tr>
2974+ </table> ${_debug or ''|n} </body>
2975+ </html>
2976+ ]]></field>
2977+ <field name="orientation">Portrait</field>
2978+ <field name="format">A4</field>
2979+ <field name="html"><![CDATA[
2980+ <html>
2981+ <head>
2982+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
2983+ <script>
2984+ function subst() {
2985+ var vars={};
2986+ var x=document.location.search.substring(1).split('&');
2987+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
2988+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
2989+ for(var i in x) {
2990+ var y = document.getElementsByClassName(x[i]);
2991+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
2992+ }
2993+ }
2994+ </script>
2995+ <style type="text/css">
2996+
2997+ ${css}
2998+ </style>
2999+ </head>
3000+ <body style="border:0; margin: 0;" onload="subst()">
3001+
3002+ </html>]]>
3003+ </field>
3004+ <field eval="17.0" name="margin_top"/>
3005+ <field eval="25.0" name="margin_bottom"/>
3006+ <field name="css"><![CDATA[
3007+
3008+ body, table, td, span, div {
3009+ font-family: Helvetica;
3010+ }
3011+
3012+ body {
3013+
3014+ font-size:9;
3015+
3016+ }
3017+
3018+
3019+ .header {
3020+ margin-left:0;
3021+ text-align:left;
3022+ width:300px;
3023+ font-size:12;
3024+ }
3025+ .title {
3026+ font-size:16px;
3027+ width:100%;
3028+ font-weight: bold;
3029+ font-family: Helvetica;
3030+ text-align:center;
3031+ padding-bottom:20px;
3032+ }
3033+
3034+ .tbl_header{
3035+ width:100%;
3036+ font-size:12px;
3037+ font-family: Helvetica;
3038+ }
3039+ .tbl_grey_line {
3040+ width:100%;
3041+ border:1px solid Grey;
3042+ border-collapse: collapse;
3043+ font-family: Helvetica;
3044+ padding-bottom:20px;
3045+ }
3046+ .tbl_grey_line td{
3047+ border:1px solid Grey;
3048+ font-size:11px;
3049+ font-family: Helvetica;
3050+ }
3051+ .tbl_line{
3052+ width:100%;
3053+ font-size:12px;
3054+ font-family: Helvetica;
3055+ font-weight: bold;
3056+ border:1px solid grey;
3057+ border-left:0px;
3058+ border-right:0px;
3059+ }
3060+
3061+ .font{
3062+ width:100%;
3063+ font-size:12px;
3064+ font-family:Helvetica;
3065+ }
3066+ .font tr{
3067+ padding-top:10px;
3068+ }
3069+ .font td{
3070+ padding-top:5px;
3071+ }
3072+ ]]>
3073+ </field>
3074+ <field name="name">Voucher Header</field>
3075+ </record>
3076+
3077+ <report id="report_account_voucher"
3078+ string="Voucher"
3079+ model="account.voucher"
3080+ name="voucher.cash_receipt.drcr.webkit"
3081+ file="account_voucher_webkit/report/account_voucher.mako"
3082+ auto="False"
3083+ report_type="webkit"
3084+ webkit_header="voucher_header"
3085+ menu="True"/>
3086+
3087+<!-- This report is awfull so it's better to hide it -->
3088+
3089+ <report id="report_account_voucher_print"
3090+ string="Voucher Print"
3091+ model="account.voucher"
3092+ name="voucher.print.webkit"
3093+ file="account_voucher_webkit/report/account_voucher_print.mako"
3094+ auto="False"
3095+ menu="True"
3096+ report_type="webkit"
3097+ webkit_header="voucher_header"/>
3098+ </data>
3099+</openerp>
3100
3101=== added directory 'account_voucher_webkit/report'
3102=== added file 'account_voucher_webkit/report/.~lock.account_voucher_print.sxw#'
3103--- account_voucher_webkit/report/.~lock.account_voucher_print.sxw# 1970-01-01 00:00:00 +0000
3104+++ account_voucher_webkit/report/.~lock.account_voucher_print.sxw# 2013-10-10 09:47:29 +0000
3105@@ -0,0 +1,1 @@
3106+serpentcs ,serpentcs,serpentcs-desktop,17.09.2013 13:01,file:///home/serpentcs/.libreoffice/3;
3107\ No newline at end of file
3108
3109=== added file 'account_voucher_webkit/report/__init__.py'
3110--- account_voucher_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
3111+++ account_voucher_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
3112@@ -0,0 +1,26 @@
3113+# -*- coding: utf-8 -*-
3114+##############################################################################
3115+#
3116+# OpenERP, Open Source Management Solution
3117+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
3118+#
3119+# This program is free software: you can redistribute it and/or modify
3120+# it under the terms of the GNU Affero General Public License as
3121+# published by the Free Software Foundation, either version 3 of the
3122+# License, or (at your option) any later version.
3123+#
3124+# This program is distributed in the hope that it will be useful,
3125+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3126+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3127+# GNU Affero General Public License for more details.
3128+#
3129+# You should have received a copy of the GNU Affero General Public License
3130+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3131+#
3132+
3133+##############################################################################
3134+
3135+import account_voucher
3136+import account_voucher_print
3137+
3138+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3139
3140=== added file 'account_voucher_webkit/report/account_voucher.mako'
3141--- account_voucher_webkit/report/account_voucher.mako 1970-01-01 00:00:00 +0000
3142+++ account_voucher_webkit/report/account_voucher.mako 2013-10-10 09:47:29 +0000
3143@@ -0,0 +1,160 @@
3144+<html>
3145+ <head>
3146+ <style type="text/css">
3147+ ${css}
3148+ </style>
3149+ </head>
3150+ <body>
3151+ %for voucher in objects:
3152+ <table class="title">
3153+ <tr>
3154+ <td>
3155+ ${get_title(voucher.type)}
3156+ </td>
3157+ </tr>
3158+ </table>
3159+ <table class="tbl_grey_line">
3160+ <tr>
3161+ <td width="20%"><b>
3162+ ${_('Journal:')}</b>
3163+ </td>
3164+ <td colspan="3" width="30%">
3165+ ${ voucher.type}
3166+ </td>
3167+ <td width="20%">
3168+ <b>${_('Number:')}</b>
3169+ </td>
3170+ <td width="30%">
3171+ ${ voucher.number }
3172+ </td>
3173+ </tr>
3174+ <tr>
3175+ <td>
3176+ <b> ${_('Status:')} </b>
3177+ </td>
3178+ <td width="10%">
3179+ %if voucher.state == 'proforma':
3180+ PRO-FORMA
3181+ %endif
3182+ %if voucher.state == 'draft':
3183+ Draft
3184+ %endif
3185+ %if voucher.state == 'cancel':
3186+ Canceled
3187+ %endif
3188+ %if voucher.state == 'posted':
3189+ Posted
3190+ %endif
3191+ </td>
3192+ <td width="10%">
3193+ <b>${_('Ref. :')}</b>
3194+ </td>
3195+ <td width="10%">
3196+ ${ voucher.reference or '' }
3197+ </td>
3198+ <td>
3199+ <b>${_('Date:')}</b>
3200+ </td>
3201+ <td>
3202+ ${ formatLang(voucher.date , date=True) or '' }
3203+ </td>
3204+ </tr>
3205+ </table>
3206+ </br>
3207+ <table class="tbl_line">
3208+ <tr>
3209+ <td width="50%">
3210+ ${_('Particulars')}
3211+ </td>
3212+ <td width="25%" align="right">
3213+ ${_('Debit')}
3214+ </td>
3215+ <td width="25%" align="right">
3216+ ${_('Credit')}
3217+ </td>
3218+ </tr>
3219+ </table>
3220+ <table class="font">
3221+ %for move_ids in voucher.move_ids:
3222+ <tr>
3223+ <td style="padding-left:5px" width="50%">
3224+ <b> ${ (move_ids.partner_id and move_ids.partner_id.name) or 'Account' }</b>
3225+ </td>
3226+ <td style="padding-left:15px" width="25%" align="right">
3227+ ${ formatLang(move_ids.debit) }
3228+ </td>
3229+ <td style="padding-left:15px" width="25%" align="right">
3230+ ${ formatLang(move_ids.credit) }
3231+ </td>
3232+ </tr>
3233+ <tr>
3234+ <td colspan="3" style="padding-left:15px">
3235+ ${ move_ids.account_id.name }
3236+ </td>
3237+ </tr>
3238+ <tr>
3239+ <td colspan="3" style="padding-left:15px" width="25%">
3240+ <i>${ move_ids.name } - ${ get_ref(voucher.id,move_ids) }</i>
3241+ </td>
3242+ </tr>
3243+ %endfor
3244+ <tr>
3245+ <td colspan="3">
3246+ <b>${_('Through :')}
3247+ </td>
3248+ </tr>
3249+ <tr>
3250+ <td colspan="3" style="padding-left:15px" >
3251+ ${ voucher.narration or ''}
3252+ </td>
3253+ </tr>
3254+ <tr>
3255+ <td colspan="3" >
3256+ <b>${_('On Account of : ')}</b>
3257+ </td>
3258+ </tr>
3259+ <tr>
3260+ <td colspan="3" style="padding-left:15px >
3261+ ${ voucher.name or ''}
3262+ </td>
3263+ </tr>
3264+ <tr >
3265+ <td colspan="3">
3266+ <b> ${_('Amount (in words) :') }</b>
3267+ </td>
3268+ </tr>
3269+ <tr>
3270+ <td style="padding-left:15px">
3271+ ${ convert(voucher.amount,voucher.currency_id.name) or '' }
3272+ </td>
3273+ <td></td><td></td>
3274+ </tr>
3275+ </table>
3276+ <table class="tbl_line">
3277+ <tr>
3278+ <td width="50%">
3279+
3280+ </td>
3281+ <td width="25%" align="right" >
3282+ ${ debit(voucher.move_ids)}
3283+ </td>
3284+ <td width="25%" align="right">
3285+ ${ credit(voucher.move_ids)}
3286+ </td>
3287+ </tr>
3288+ <table>
3289+ </br>
3290+ <table class="tbl_header">
3291+ <tr>
3292+ <td width="50%">
3293+ Receiver's Signature
3294+ </td>
3295+ <td align="right" width="50%">
3296+ Authorised Signatory
3297+ </td>
3298+ </tr>
3299+ </table>
3300+ <p style="page-break-after:always"></p>
3301+ %endfor
3302+ </body>
3303+</html>
3304\ No newline at end of file
3305
3306=== added file 'account_voucher_webkit/report/account_voucher.py'
3307--- account_voucher_webkit/report/account_voucher.py 1970-01-01 00:00:00 +0000
3308+++ account_voucher_webkit/report/account_voucher.py 2013-10-10 09:47:29 +0000
3309@@ -0,0 +1,77 @@
3310+# -*- coding: utf-8 -*-
3311+##############################################################################
3312+#
3313+# OpenERP, Open Source Management Solution
3314+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
3315+#
3316+# This program is free software: you can redistribute it and/or modify
3317+# it under the terms of the GNU Affero General Public License as
3318+# published by the Free Software Foundation, either version 3 of the
3319+# License, or (at your option) any later version.
3320+#
3321+# This program is distributed in the hope that it will be useful,
3322+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3323+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3324+# GNU Affero General Public License for more details.
3325+#
3326+# You should have received a copy of the GNU Affero General Public License
3327+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3328+#
3329+
3330+##############################################################################
3331+
3332+import time
3333+from openerp.report import report_sxw
3334+from openerp.tools import amount_to_text_en
3335+
3336+class report_voucher(report_sxw.rml_parse):
3337+ def __init__(self, cr, uid, name, context):
3338+ super(report_voucher, self).__init__(cr, uid, name, context)
3339+ self.localcontext.update({
3340+ 'time': time,
3341+ 'convert':self.convert,
3342+ 'get_title': self.get_title,
3343+ 'debit':self.debit,
3344+ 'credit':self.credit,
3345+ 'get_ref': self._get_ref
3346+ })
3347+
3348+ def convert(self, amount, cur):
3349+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
3350+ return amt_en
3351+
3352+ def get_title(self, type):
3353+
3354+ title = ''
3355+ if type:
3356+ title = type[0].swapcase() + type[1:] + " Voucher"
3357+ return title
3358+
3359+ def debit(self, move_ids):
3360+ debit = 0.0
3361+ for move in move_ids:
3362+ debit += move.debit
3363+ return debit
3364+
3365+ def credit(self, move_ids):
3366+ credit = 0.0
3367+ for move in move_ids:
3368+ credit += move.credit
3369+ return credit
3370+
3371+ def _get_ref(self, voucher_id, move_ids):
3372+ voucher_line_obj = self.pool.get('account.voucher.line')
3373+ voucher_line = voucher_line_obj.search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)])
3374+ if voucher_line:
3375+ voucher = voucher_line_obj.browse(self.cr, self.uid, voucher_line)[0]
3376+ return voucher.name
3377+ else:
3378+ return
3379+report_sxw.report_sxw(
3380+ 'report.voucher.cash_receipt.drcr.webkit',
3381+ 'account.voucher',
3382+ 'addons/account_voucher_webkit/report/account_voucher.mako',
3383+ parser=report_voucher,header="external"
3384+)
3385+
3386+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3387
3388=== added file 'account_voucher_webkit/report/account_voucher_print.mako'
3389--- account_voucher_webkit/report/account_voucher_print.mako 1970-01-01 00:00:00 +0000
3390+++ account_voucher_webkit/report/account_voucher_print.mako 2013-10-10 09:47:29 +0000
3391@@ -0,0 +1,140 @@
3392+<html>
3393+ <head>
3394+ <style type="text/css">
3395+ ${css}
3396+ </style>
3397+ </head>
3398+ <body>
3399+ %for voucher in objects:
3400+ <table class="title">
3401+ <tr>
3402+ <td>
3403+ ${ get_title(voucher.type) }
3404+ </td>
3405+ </tr>
3406+ </table>
3407+ <table class="tbl_header">
3408+ <tr>
3409+ <td width="10%">
3410+ <b>${_('Number:')}</b>
3411+ </td>
3412+ <td width="40%">
3413+ ${_('voucher.number')}
3414+ <td align="right" width="40%">
3415+ <b>${_('Date:')}</b>
3416+ </td>
3417+ <td align="right" width="10%">
3418+ ${ formatLang(voucher.date , date=True) or '' }
3419+ </td>
3420+ </tr>
3421+ <tr>
3422+ <td width="10%">
3423+ <b> ${_('Status:')}</b>
3424+ </td>
3425+ <td width="40%">
3426+ %if voucher.state == 'proforma':
3427+ PRO-FORMA
3428+ %endif
3429+ %if voucher.state == 'draft':
3430+ Draft
3431+ %endif
3432+ %if voucher.state == 'cancel':
3433+ Canceled
3434+ %endif
3435+ %if voucher.state == 'posted':
3436+ Posted
3437+ %endif
3438+ </td>
3439+ <td align="right" width="40%">
3440+ <b>${_('Currency:')}</b>
3441+ </td>
3442+ <td align="right" width="10%">
3443+ ${ voucher.currency_id.symbol }
3444+ </td>
3445+ </tr>
3446+ </table>
3447+ </br>
3448+ <table class="tbl_line">
3449+ <tr width="70%">
3450+ <td>
3451+ ${_('Particulars')}
3452+ </td>
3453+ <td width="30%" align="right">
3454+ ${_('Amount')}
3455+ </td>
3456+ </tr>
3457+ </table>
3458+
3459+ <table class="font">
3460+ %for p in get_lines(voucher):
3461+ <tr>
3462+ <td width="70%" style="padding-left:5px"><b>
3463+ ${_('Account :')}</b>
3464+ </td>
3465+ </tr>
3466+
3467+ <tr>
3468+ <td style="padding-left:10px">
3469+ ${ p['pname'] }
3470+ </td>
3471+ <td align="right">
3472+ ${ formatLang(p['amount'], currency_obj=voucher.currency_id) }
3473+ </td>
3474+ </tr>
3475+
3476+ <tr>
3477+ <td style="padding-left:10px">
3478+ ${ p['ref'] }
3479+ </td>
3480+ </tr>
3481+ <tr>
3482+ <td style="padding-left:10px">
3483+ ${_('Account :')} ${ p['aname']}
3484+ </td>
3485+ </tr>
3486+ %endfor
3487+ <tr>
3488+ <td style="padding-left:5px">
3489+ <b>${_('Through :')}</b>
3490+ </td>
3491+ </tr>
3492+ <tr>
3493+ <td style="padding-left:10px">
3494+ ${ voucher.journal_id.name or '' }
3495+ </td>
3496+ </tr>
3497+ <tr>
3498+ <td style="padding-left:5px">
3499+ <b>${_('On Account of :')}</b>
3500+ </td>
3501+ </tr>
3502+ <tr>
3503+ <td style="padding-left:10px">
3504+ ${ get_on_account(voucher) }
3505+ </td>
3506+ </tr>
3507+ <tr>
3508+ <td style="padding-left:5px">
3509+ <b>Amount (in words) :</b>
3510+ </td>
3511+ </tr>
3512+ <tr>
3513+ <td style="padding-left:10px">
3514+ ${ convert(voucher.amount,voucher.currency_id.name) }
3515+ </td>
3516+ </tr>
3517+ </table>
3518+
3519+ <table class="tbl_line">
3520+ <tr>
3521+ <td width="70%">
3522+ </td>
3523+ <td align="right" width="30%">
3524+ ${ formatLang(voucher.amount, currency_obj=voucher.currency_id) }
3525+ </td>
3526+ </tr>
3527+ </table>
3528+ <p style="page-break-after:always"></p>
3529+ %endfor
3530+ </body>
3531+</html>
3532\ No newline at end of file
3533
3534=== added file 'account_voucher_webkit/report/account_voucher_print.py'
3535--- account_voucher_webkit/report/account_voucher_print.py 1970-01-01 00:00:00 +0000
3536+++ account_voucher_webkit/report/account_voucher_print.py 2013-10-10 09:47:29 +0000
3537@@ -0,0 +1,98 @@
3538+# -*- coding: utf-8 -*-
3539+##############################################################################
3540+#
3541+# OpenERP, Open Source Management Solution
3542+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
3543+#
3544+# This program is free software: you can redistribute it and/or modify
3545+# it under the terms of the GNU Affero General Public License as
3546+# published by the Free Software Foundation, either version 3 of the
3547+# License, or (at your option) any later version.
3548+#
3549+# This program is distributed in the hope that it will be useful,
3550+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3551+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3552+# GNU Affero General Public License for more details.
3553+#
3554+# You should have received a copy of the GNU Affero General Public License
3555+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3556+#
3557+
3558+##############################################################################
3559+
3560+import time
3561+from openerp.report import report_sxw
3562+from openerp.tools import amount_to_text_en
3563+
3564+class report_voucher_print(report_sxw.rml_parse):
3565+ def __init__(self, cr, uid, name, context):
3566+ super(report_voucher_print, self).__init__(cr, uid, name, context)
3567+ self.localcontext.update({
3568+ 'time': time,
3569+ 'get_title': self.get_title,
3570+ 'get_lines':self.get_lines,
3571+ 'get_on_account':self.get_on_account,
3572+ 'convert':self.convert
3573+ })
3574+
3575+ def convert(self, amount, cur):
3576+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
3577+ return amt_en
3578+
3579+ def get_lines(self, voucher):
3580+ result = []
3581+ if voucher.type in ('payment','receipt'):
3582+ type = voucher.line_ids and voucher.line_ids[0].type or False
3583+ for move in voucher.move_ids:
3584+ res = {}
3585+ amount = move.credit
3586+ if type == 'dr':
3587+ amount = move.debit
3588+ if amount > 0.0:
3589+ res['pname'] = move.partner_id.name
3590+ res['ref'] = 'Agst Ref'+" "+str(move.name)
3591+ res['aname'] = move.account_id.name
3592+ res['amount'] = amount
3593+ result.append(res)
3594+ else:
3595+ type = voucher.line_ids and voucher.line_ids[0].type or False
3596+ for move in voucher.move_ids:
3597+ res = {}
3598+ amount = move.credit
3599+ if type == 'dr':
3600+ amount = move.debit
3601+ if amount > 0.0:
3602+ res['pname'] = move.partner_id.name
3603+ res['ref'] = move.name
3604+ res['aname'] = move.account_id.name
3605+ res['amount'] = amount
3606+ result.append(res)
3607+ return result
3608+
3609+ def get_title(self, type):
3610+ print "type:::><><><><>",type
3611+ title = ''
3612+ if type:
3613+ title = type[0].swapcase() + type[1:] + " Voucher"
3614+ return title
3615+
3616+ def get_on_account(self, voucher):
3617+ name = ""
3618+ if voucher.type == 'receipt':
3619+ name = "Received cash from "+str(voucher.partner_id.name)
3620+ elif voucher.type == 'payment':
3621+ name = "Payment from "+str(voucher.partner_id.name)
3622+ elif voucher.type == 'sale':
3623+ name = "Sale to "+str(voucher.partner_id.name)
3624+ elif voucher.type == 'purchase':
3625+ name = "Purchase from "+str(voucher.partner_id.name)
3626+ return name
3627+
3628+report_sxw.report_sxw(
3629+ 'report.voucher.print.webkit',
3630+ 'account.voucher',
3631+ 'addons/account_voucher_webkit/report/account_voucher_print.mako',
3632+ parser=report_voucher_print,header="external"
3633+)
3634+
3635+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3636
3637=== added directory 'account_webkit'
3638=== added file 'account_webkit/__init__.py'
3639--- account_webkit/__init__.py 1970-01-01 00:00:00 +0000
3640+++ account_webkit/__init__.py 2013-10-10 09:47:29 +0000
3641@@ -0,0 +1,24 @@
3642+# -*- coding: utf-8 -*-
3643+##############################################################################
3644+#
3645+# OpenERP, Open Source Management Solution
3646+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
3647+#
3648+# This program is free software: you can redistribute it and/or modify
3649+# it under the terms of the GNU Affero General Public License as
3650+# published by the Free Software Foundation, either version 3 of the
3651+# License, or (at your option) any later version.
3652+#
3653+# This program is distributed in the hope that it will be useful,
3654+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3655+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3656+# GNU Affero General Public License for more details.
3657+#
3658+# You should have received a copy of the GNU Affero General Public License
3659+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3660+#
3661+############################################################################
3662+
3663+import report
3664+import wizard
3665+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3666
3667=== added file 'account_webkit/__openerp__.py'
3668--- account_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
3669+++ account_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
3670@@ -0,0 +1,44 @@
3671+# -*- coding: utf-8 -*-
3672+##############################################################################
3673+#
3674+# OpenERP, Open Source Management Solution
3675+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
3676+#
3677+# This program is free software: you can redistribute it and/or modify
3678+# it under the terms of the GNU Affero General Public License as
3679+# published by the Free Software Foundation, either version 3 of the
3680+# License, or (at your option) any later version.
3681+#
3682+# This program is distributed in the hope that it will be useful,
3683+# but WITHOUT ANY WARRANTY; without even the implied warranty of
3684+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3685+# GNU Affero General Public License for more details.
3686+#
3687+# You should have received a copy of the GNU Affero General Public License
3688+# along with this program. If not, see <http://www.gnu.org/licenses/>.
3689+#
3690+############################################################################
3691+
3692+{
3693+ 'name' : 'eInvoicing Webkit',
3694+ 'version' : '1.1',
3695+ 'author' : 'Serpent Consulting Services',
3696+ 'category' : 'Accounting & Finance',
3697+ 'description' : """
3698+Accounting and Financial Management.
3699+====================================
3700+ It is conversion of rml report to Webkit Report.
3701+ """,
3702+ 'website': 'http://www.serpentcs.com',
3703+ 'depends' : ["account", "report_webkit"],
3704+ 'init_xml': [],
3705+ 'update_xml': [
3706+ 'account_report.xml',
3707+ ],
3708+ 'test': [
3709+ ],
3710+ 'installable': True,
3711+ 'auto_install': False,
3712+
3713+}
3714+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3715
3716=== added file 'account_webkit/account_report.xml'
3717--- account_webkit/account_report.xml 1970-01-01 00:00:00 +0000
3718+++ account_webkit/account_report.xml 2013-10-10 09:47:29 +0000
3719@@ -0,0 +1,658 @@
3720+<?xml version="1.0" encoding="utf-8"?>
3721+<openerp>
3722+ <data>
3723+
3724+ <record id="account_tax_webkit_header" model="ir.header_webkit">
3725+ <field name="footer_html"><![CDATA[]]></field>
3726+ <field name="orientation">Portrait</field>
3727+ <field name="format">A4</field>
3728+ <field name="html"><![CDATA[
3729+ <html>
3730+ <head>
3731+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
3732+ <script>
3733+ function subst() {
3734+ var vars={};
3735+ var x=document.location.search.substring(1).split('&');
3736+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
3737+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
3738+ for(var i in x) {
3739+ var y = document.getElementsByClassName(x[i]);
3740+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
3741+ }
3742+ }
3743+ </script>
3744+ <style type="text/css">
3745+
3746+ ${css}
3747+ </style>
3748+ </head>
3749+ <body style="border:0; margin: 0;" onload="subst()">
3750+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
3751+ <tr >
3752+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
3753+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
3754+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
3755+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
3756+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
3757+ </tr>
3758+ </table> ${_debug or ''|n} </body>
3759+ </html>]]>
3760+ </field>
3761+ <field eval="15.0" name="margin_top"/>
3762+ <field eval="5.0" name="margin_bottom"/>
3763+ <field name="css"><![CDATA[
3764+
3765+ body, table, td, span, div {
3766+ font-family: Helvetica, Arial;
3767+ }
3768+
3769+ body {
3770+ font-family:Arial;
3771+ font-size:12;
3772+
3773+ }
3774+
3775+
3776+ .header {
3777+ margin-left:0;
3778+ text-align:left;
3779+ width:300px;
3780+ font-size:12;
3781+ }
3782+ .title {
3783+ font-size:16;
3784+ font-weight: bold;
3785+
3786+ }
3787+
3788+
3789+ .basic_table{
3790+ text-align:center;
3791+ border:1px solid lightGrey;
3792+ border-collapse: collapse;
3793+ }
3794+ .basic_table td {
3795+ border:1px solid lightGrey;
3796+ font-size:12;
3797+
3798+
3799+ }
3800+
3801+ .list_table {
3802+ border-color:black;
3803+ text-align:center;
3804+ border-collapse: collapse;
3805+
3806+ }
3807+ .list_table td {
3808+ border-color:gray;
3809+ border-top:1px solid gray;
3810+ text-align:right;
3811+ font-size:12;
3812+ padding-left:3px
3813+ padding-right:3px
3814+ padding-top:3px
3815+ padding-bottom:3px
3816+ }
3817+
3818+ .list_table th {
3819+ border-bottom:2px solid black;
3820+ text-align:right;
3821+ font-size:12;
3822+ font-weight:bold;
3823+ padding-left:3px
3824+ padding-right:3px
3825+ }
3826+
3827+ .list_tabe thead {
3828+ display:table-header-group;
3829+ }
3830+
3831+
3832+ .total {
3833+ width:100%;
3834+ }
3835+ .lib {
3836+ width:10.3%;
3837+ }
3838+ .tot {
3839+ text-align:left;
3840+ width:15%;
3841+ }
3842+ .righttot {
3843+ width:74%;
3844+ }
3845+ .tax {
3846+ width:50%;
3847+ }
3848+
3849+ .cell{
3850+ border-spacing: 0;
3851+ border-collapse: collapse;
3852+ border-style:solid;
3853+ border: 1px solid grey;
3854+ font-size:10px;
3855+ text-align:center;
3856+ }
3857+
3858+ .tbl_header{
3859+ width:100%;
3860+ font-size:10px;
3861+ }
3862+ .tr_bottom_line{
3863+ border-bottom: thin solid black;
3864+ width:100%;
3865+ }
3866+ .tr_bottom_line_dark_grey{
3867+ border-bottom: thin solid grey;
3868+ width:100%;
3869+ }
3870+ .tr_bottom_line_light_grey{
3871+ border-bottom: thin solid #CCCCCC;
3872+ width:100%;
3873+ }
3874+ .td_f12{
3875+ font-size:12px;
3876+ }
3877+ .td_f10{
3878+ font-size:10px;
3879+ }
3880+ .td_f10_right{
3881+ font-size:10px;
3882+ text-align:right;
3883+ }
3884+ .td_f12{
3885+ font-size:12px;
3886+ }
3887+ .td_f12_right{
3888+ font-size:12px;
3889+ text-align:right;
3890+ }
3891+ table.head_border_style{
3892+ border:1px solid;
3893+ color: #cccccc;
3894+ }
3895+ tr.head_border_style{
3896+ border:1px solid;
3897+ color: #cccccc;
3898+ }
3899+ tr.table_header{
3900+ font-weight: bold;
3901+ font-family: sans-serif, serif;
3902+ font-size: 14px;
3903+ caption-side: top;
3904+ padding: 5px;
3905+ }
3906+ tr.table_parent_data{
3907+ font-family: Helvetica-Bold;
3908+ font-size: 12px;
3909+ caption-side: top;
3910+ font-weight: bold;
3911+ }
3912+ tr.table_child_data{
3913+ font-family: Helvetica;
3914+ font-size: 12px;
3915+ caption-side: top;
3916+ }
3917+ tr.report_header{
3918+ font-size: 30px;
3919+ caption-side: top;
3920+ font-family: Helvetica-Bold
3921+ padding: 5px;
3922+ border-bottom: 15px solid black;
3923+ align: center
3924+ }
3925+
3926+ .top{
3927+ border-top:thin solid;
3928+ border-color:#cccccc;
3929+ }
3930+ .bottom {
3931+ border-bottom:thin solid;
3932+ border-color:#cccccc;
3933+ }
3934+ .head_bottom_border{
3935+ border-bottom:thin solid;
3936+ border-color:black;
3937+ }
3938+ .left {
3939+ border-left:thin solid;
3940+ border-color:#cccccc;
3941+ }
3942+ .right {
3943+ border-right:thin solid;
3944+ border-color:#cccccc;account_wbkit
3945+ }
3946+
3947+ ]]>
3948+ </field>
3949+ <field name="name">Account Tax Webkit Header</field>
3950+ </record>
3951+ <record id="account_print_invoice_header" model="ir.header_webkit">
3952+ <field name="footer_html"><![CDATA[
3953+ <html>
3954+ <head>
3955+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
3956+ <script>
3957+ function subst() {
3958+ var vars={};
3959+ var x=document.location.search.substring(1).split('&');
3960+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
3961+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
3962+ for(var i in x) {
3963+ var y = document.getElementsByClassName(x[i]);
3964+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
3965+ }
3966+ }
3967+ </script>
3968+ <style type="text/css">
3969+
3970+ ${css}
3971+ </style>
3972+ </head>
3973+ <body style="border:0; margin: 0;" onload="subst()">
3974+ <table class="header" style="border-top: 1px solid black; width: 100%">
3975+ <tr >
3976+ <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
3977+ </tr>
3978+ <tr >
3979+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
3980+ </tr>
3981+ </table> ${_debug or ''|n} </body>
3982+ </html>
3983+ ]]></field>
3984+ <field name="orientation">Portrait</field>
3985+ <field name="format">A4</field>
3986+ <field name="html"><![CDATA[
3987+ <html>
3988+ <head>
3989+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
3990+ <script>
3991+ function subst() {
3992+ var vars={};
3993+ var x=document.location.search.substring(1).split('&');
3994+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
3995+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
3996+ for(var i in x) {account_wbkit
3997+ var y = document.getElementsByClassName(x[i]);
3998+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
3999+ }
4000+ }
4001+ </script>
4002+ <style type="text/css">
4003+
4004+ ${css}
4005+ </style>
4006+ </head>
4007+ <body style="border:0; margin: 0;" onload="subst()">
4008+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
4009+ <tr >
4010+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
4011+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
4012+ </tr>
4013+ </table> ${_debug or ''|n} </body>
4014+ <p style="text-align:left;font-size:12;">${company.name}</p>
4015+ </html>]]>
4016+ </field>
4017+ <field eval="25.0" name="margin_top"/>
4018+ <field eval="25.0" name="margin_bottom"/>
4019+ <field name="css"><![CDATA[
4020+
4021+ body, table, td, span, div {
4022+ font-family: Helvetica, Arial;
4023+ }
4024+
4025+ body {
4026+ font-family:Arial;
4027+ font-size:9;
4028+
4029+ }
4030+
4031+
4032+ .header {
4033+ margin-left:0;
4034+ text-align:left;
4035+ width:300px;
4036+ font-size:12;
4037+ }
4038+ .title {
4039+ font-size:16;
4040+ font-weight: bold;
4041+
4042+ }
4043+
4044+
4045+ .basic_table{
4046+ text-align:center;
4047+ border:1px solid lightGrey;
4048+ border-collapse: collapse;
4049+ }
4050+ .basic_table td {
4051+ border:1px solid lightGrey;
4052+ font-size:12;
4053+
4054+
4055+ }
4056+
4057+ .list_table {
4058+ border-color:black;
4059+ text-align:center;
4060+ border-collapse: collapse;
4061+
4062+ }
4063+ .list_table td {
4064+ border-color:gray;
4065+ border-top:1px solid gray;
4066+ text-align:right;
4067+ font-size:12;
4068+ padding-left:3px
4069+ padding-right:3px
4070+ padding-top:3px
4071+ padding-bottom:3px
4072+ }
4073+
4074+ .list_table th {
4075+ border-bottom:2px solid black;
4076+ text-align:right;
4077+ font-size:12;
4078+ font-weight:bold;
4079+ padding-left:3px
4080+ padding-right:3px
4081+ }
4082+
4083+ .list_tabe thead {
4084+ display:table-header-group;
4085+ }
4086+
4087+
4088+ .total {
4089+ width:100%;
4090+ }
4091+ .lib {
4092+ width:10.3%;
4093+ }
4094+ .tot {
4095+ text-align:left;
4096+ width:15%;
4097+ }
4098+ .righttot {
4099+ width:74%;
4100+ }
4101+ .tax {
4102+ width:50%;
4103+ }
4104+
4105+ .cell{
4106+ border-spacing: 0;
4107+ border-collapse: collapse;
4108+ border-style:solid;
4109+ border: 1px solid grey;
4110+ font-size:10px;
4111+ text-align:center;
4112+ }
4113+
4114+ .tbl_header{
4115+ width:100%;
4116+ font-size:10px;
4117+ }
4118+ .tr_bottom_line{
4119+ border-bottom: thin solid black;
4120+ width:100%;
4121+ }
4122+ .tr_bottom_line_dark_grey{
4123+ border-bottom: thin solid grey;
4124+ width:100%;
4125+ }
4126+ .tr_bottom_line_light_grey{
4127+ border-bottom: thin solid #CCCCCC;
4128+ width:100%;
4129+ }
4130+ .td_f12{
4131+ font-size:12px;
4132+ }
4133+ .td_f10{
4134+ font-size:10px;
4135+ }
4136+ .td_f10_right{
4137+ font-size:10px;
4138+ text-align:right;
4139+ }
4140+ .td_f12{
4141+ font-size:12px;
4142+ }
4143+ .td_f12_right{
4144+ font-size:12px;
4145+ text-align:right;
4146+ }
4147+ table.head_border_style{
4148+ border:1px solid;
4149+ color: #cccccc;
4150+ }
4151+ tr.head_border_style{
4152+ border:1px solid;
4153+ color: #cccccc;
4154+ }
4155+ tr.table_header{
4156+ font-weight: bold;
4157+ font-family: sans-serif, serif;
4158+ font-size: 14px;
4159+ caption-side: top;
4160+ padding: 5px;
4161+ }
4162+ tr.table_parent_data{
4163+ font-family: Helvetica-Bold;
4164+ font-size: 12px;
4165+ caption-side: top;
4166+ font-weight: bold;
4167+ }
4168+ tr.table_child_data{
4169+ font-family: Helvetica;
4170+ font-size: 12px;
4171+ caption-side: top;
4172+ }
4173+ tr.report_header{
4174+ font-size: 30px;
4175+ caption-side: top;
4176+ font-family: Helvetica-Bold
4177+ padding: 5px;
4178+ border-bottom: 15px solid black;
4179+ align: center
4180+ }
4181+
4182+ .top{
4183+ border-top:thin solid;
4184+ border-color:#cccccc;
4185+ }
4186+ .bottom {
4187+ border-bottom:thin solid;
4188+ border-color:#cccccc;
4189+ }
4190+ .head_bottom_border{
4191+ border-bottom:thin solid;
4192+ border-color:black;
4193+ }
4194+ .left {
4195+ border-left:thin solid;
4196+ border-color:#cccccc;
4197+ }
4198+ .right {
4199+ border-right:thin solid;
4200+ border-color:#cccccc;
4201+ }
4202+
4203+ ]]>
4204+ </field>
4205+ <field name="name">Invoice Webkit Header</field>
4206+ </record>
4207+
4208+ <report
4209+ auto="False"
4210+ id="account_general_ledger"
4211+ menu="False"
4212+ model="account.account"
4213+ name="account.general.ledger.webkit"
4214+ file="account_webkit/report/account_general_ledger.mako"
4215+ string="General Ledger"
4216+ report_type="webkit"
4217+ webkit_header="account_tax_webkit_header" />
4218+
4219+ <report
4220+ auto="False"
4221+ id="account_general_ledger_landscape"
4222+ menu="False"
4223+ model="account.account"
4224+ name="account.general.ledger_landscape.webkit"
4225+ file="account_webkit/report/account_general_ledger_landscape.mako"
4226+ string="General Ledger"
4227+ report_type="webkit"
4228+ webkit_header="account_tax_webkit_header"/>
4229+
4230+ <report
4231+ auto="False"
4232+ id="account_3rdparty_ledger"
4233+ menu="False"
4234+ model="res.partner"
4235+ name="account.third_party_ledger.webkit"
4236+ file="account_webkit/report/account_partner_ledger.mako"
4237+ string="Partner Ledger"
4238+ report_type="webkit"
4239+ webkit_header="account_tax_webkit_header" />
4240+
4241+ <report
4242+ auto="False"
4243+ id="account_3rdparty_ledger_other"
4244+ menu="False"
4245+ model="res.partner"
4246+ name="account.third_party_ledger_other.webkit"
4247+ file="account_webkit/report/account_partner_ledger_other.mako"
4248+ string="Partner Ledger"
4249+ report_type="webkit"
4250+ webkit_header="account_tax_webkit_header" />
4251+
4252+ <report
4253+ auto="False"
4254+ id="account_account_balance"
4255+ menu="False"
4256+ model="account.account"
4257+ name="account.account.balance.webkit"
4258+ file="account_webkit/report/account_balance.mako"
4259+ string="Trial Balance"
4260+ report_type="webkit"
4261+ webkit_header="account_tax_webkit_header" />
4262+
4263+
4264+ <report
4265+ auto="False"
4266+ id="account_3rdparty_account_balance"
4267+ menu="False"
4268+ model="account.account"
4269+ name="account.partner.balance.webkit"
4270+ file="account_webkit/report/account_partner_balance.mako"
4271+ string="Partner Balance"
4272+ report_type="webkit"
4273+ webkit_header="account_tax_webkit_header" />
4274+
4275+ <report
4276+ auto= "False"
4277+ id="account_central_journal"
4278+ model="account.journal.period"
4279+ name="account.central.journal.webkit"
4280+ file="account_webkit/report/account_central_journal.mako"
4281+ menu="False"
4282+ string="Central Journal"
4283+ report_type="webkit"
4284+ webkit_header="account_tax_webkit_header" />
4285+
4286+
4287+ <report
4288+ auto="False"
4289+ id="account.account_general_journal"
4290+ model="account.journal.period"
4291+ name="account.general.journal.webkit"
4292+ rml="account_webkit/report/account_general_journal.mako"
4293+ string="General Journal"
4294+ report_type="webkit"
4295+ webkit_header="account_tax_webkit_header" />
4296+
4297+ <report
4298+ auto="False"
4299+ id="account.account_journal"
4300+ model="account.journal.period"
4301+ name="account.journal.period.print.webkit"
4302+ file="account_webkit/report/account_journal.mako"
4303+ string="Journal"
4304+ report_type="webkit"
4305+ webkit_header="account_tax_webkit_header" />
4306+
4307+ <report
4308+ auto="False"
4309+ id="account.webkit_account_journal_sale_purchase"
4310+ model="account.journal.period"
4311+ name="account.journal.period.print.sale.purchase.webkit"
4312+ file="account_webkit/report/account_journal_sale_purchase.mako"
4313+ string="Sale/Purchase Journal"
4314+ report_type="webkit"
4315+ webkit_header="account_tax_webkit_header" />
4316+
4317+ <report
4318+ auto="False"
4319+ id="account.account_overdue"
4320+ model="res.partner"
4321+ name="account.overdue.webkit"
4322+ file="account_webkit/report/account_print_overdue.mako"
4323+ string="Overdue Payments"
4324+ report_type="webkit"
4325+ webkit_header="account_print_invoice_header" />
4326+
4327+
4328+ <report
4329+ auto="False"
4330+ id="account.account_invoices"
4331+ model="account.invoice"
4332+ name="account.invoice.webkit"
4333+ file="account_webkit/report/account_print_invoice.mako"
4334+ string="Invoices"
4335+ attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
4336+ attachment_use="True"
4337+ usage="default"
4338+ report_type="webkit"
4339+ webkit_header="account_print_invoice_header" />
4340+
4341+
4342+
4343+ <report
4344+ auto="False"
4345+ id="account_vat_declaration"
4346+ menu="False"
4347+ model="account.tax.code"
4348+ name="account.vat.declaration.webkit"
4349+ file="account_webkit/report/account_tax_report.mako"
4350+ string="Taxes Report"
4351+ report_type="webkit"
4352+ webkit_header="account_tax_webkit_header"/>
4353+
4354+ <report
4355+ auto="False"
4356+ menu="False"
4357+ id="report_webkit_central_journal_id"
4358+ model="res.partner"
4359+ name="account.aged_trial_balance.webkit"
4360+ file="account_webkit/report/account_aged_partner_balance.mako"
4361+ string="Account aged partner Balance"
4362+ report_type="webkit"
4363+ webkit_header="account_tax_webkit_header" />
4364+
4365+ <report
4366+ auto="False"
4367+ menu="False"
4368+ id="account_financial_report"
4369+ model="account.account"
4370+ name="account.financial.report.webkit"
4371+ file="account_webkit/report/account_financial_report.mako"
4372+ string="Account Financial Report"
4373+ report_type="webkit"
4374+ webkit_header="account_tax_webkit_header"/>
4375+
4376+ </data>
4377+</openerp>
4378
4379=== added directory 'account_webkit/report'
4380=== added file 'account_webkit/report/__init__.py'
4381--- account_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
4382+++ account_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
4383@@ -0,0 +1,40 @@
4384+# -*- coding: utf-8 -*-
4385+##############################################################################
4386+#
4387+# OpenERP, Open Source Management Solution
4388+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
4389+#
4390+# This program is free software: you can redistribute it and/or modify
4391+# it under the terms of the GNU Affero General Public License as
4392+# published by the Free Software Foundation, either version 3 of the
4393+# License, or (at your option) any later version.
4394+#
4395+# This program is distributed in the hope that it will be useful,
4396+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4397+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4398+# GNU Affero General Public License for more details.
4399+#
4400+# You should have received a copy of the GNU Affero General Public License
4401+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4402+#
4403+############################################################################
4404+
4405+
4406+import account_central_journal
4407+import account_general_journal
4408+import account_journal
4409+import account_balance
4410+import account_partner_balance
4411+import account_general_ledger
4412+import account_partner_ledger
4413+#import invoice
4414+import account_print_invoice
4415+#import overdue
4416+import account_print_overdue
4417+import account_aged_partner_balance
4418+#import tax_report
4419+import account_tax_report
4420+import account_financial_report
4421+
4422+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4423+
4424
4425=== added file 'account_webkit/report/account_aged_partner_balance.mako'
4426--- account_webkit/report/account_aged_partner_balance.mako 1970-01-01 00:00:00 +0000
4427+++ account_webkit/report/account_aged_partner_balance.mako 2013-10-10 09:47:29 +0000
4428@@ -0,0 +1,220 @@
4429+<html>
4430+ <head>
4431+ <style type="text/css">
4432+
4433+ table.mystyle{border-width: 0 0 0 0;
4434+ border-spacing: 0;
4435+ border-collapse: collapse;
4436+ border-style: solid;
4437+ border: 1px solid grey;
4438+ font-size: 100%;}
4439+
4440+ .mystyle td, .mystyle th{
4441+ margin: 0;
4442+ padding: 4px;
4443+ border-width: 1px 1px 1px 1px;
4444+ border-style: solid;
4445+ border: 1px solid grey;
4446+ font-size: 60%;}
4447+
4448+ table.mystyleone{border-width: 0 0 0 0;
4449+ border-spacing: 0;
4450+ border-collapse: collapse;
4451+ border-color: black;
4452+ font-weight:bold;
4453+ border-style: solid;
4454+ font-size: 100%;}
4455+
4456+ .mystyleone tr{
4457+ margin: 0;
4458+ padding: 4px;
4459+ border-width: 0 0 1px 0;
4460+ border-color: black;
4461+ font-weight:bold;
4462+ border-style: solid;
4463+ font-size: 60%;}
4464+ </style>
4465+ </head>
4466+
4467+ <body>
4468+
4469+ %for o in objects:
4470+ </br>
4471+ <center><h2>Aged Trial Balance</h2></center>
4472+
4473+ <table width="100%" class="mystyle">
4474+ <tr class="table_parent_data_header">
4475+ <td width="16%" class="cell">
4476+ <b>Chart of Accounts</b>
4477+ </td>
4478+ <td width="14%" class="cell">
4479+ <b>Fiscal Year</b>
4480+ </td>
4481+ <td width="14%" class="cell">
4482+ <b>Start Date</b>
4483+ </td>
4484+ <td width="14%" class="cell">
4485+ <b>Period Length(days)</b>
4486+ </td>
4487+ <td width="14%" class="cell">
4488+ <b>Partner's</b>
4489+ </td>
4490+ <td width="16%" class="cell">
4491+ <b>Analysis Direction</b>
4492+ </td>
4493+ <td width="14%" class="cell">
4494+ <b>Target Moves</b>
4495+ </td>
4496+ </tr>
4497+
4498+ <tr class="table_child_data_header">
4499+ <td width="16%" class="cell">
4500+ ${get_account(data) or ''}
4501+ </td>
4502+ <td width="14%" class="cell">
4503+ ${get_fiscalyear(data) or ''}
4504+ </td>
4505+ <td width="14%" class="cell">
4506+ ${formatLang(data['form']['date_from'],date=True)}
4507+ </td>
4508+ <td width="14%" class="cell">
4509+ ${data['form']['period_length'] }
4510+ </td>
4511+ <td width="14%" class="cell">
4512+ ${get_partners(data)}
4513+ </td>
4514+ <td width="16%" class="cell">
4515+ ${data['form']['direction_selection']}
4516+ </td>
4517+ <td width="14%" class="cell">
4518+ ${get_target_move(data)}
4519+ </td>
4520+ </tr>
4521+ </table>
4522+ </br></br>
4523+
4524+ <table width="100%" class="mystyleone">
4525+ <tr class="table_parent_data">
4526+ <td width="23%">
4527+ Partners
4528+ </td>
4529+ <%
4530+ direction = ''
4531+ if data['form']['direction_selection'] == 'future':
4532+ direction = 'Due'
4533+ else:
4534+ direction = 'Not due'
4535+ %>
4536+ <td width="11%" >
4537+ ${direction}
4538+ </td>
4539+ <td width="11%" >
4540+ ${ data['form']['4']['name']}
4541+ </td><td width="11%" >
4542+ ${ data['form']['3']['name']}
4543+ </td>
4544+ <td width="11%" >
4545+ ${ data['form']['2']['name']}
4546+ </td>
4547+ <td width="11%" >
4548+ ${ data['form']['1']['name']}
4549+ </td>
4550+ <td width="11%" >
4551+ ${ data['form']['0']['name']}
4552+ </td>
4553+ <td width="11%" >
4554+ ${_('Total')}
4555+ </td>
4556+ </tr>
4557+
4558+
4559+ %if get_lines(data['form']) != False or get_lines_with_out_partner(data['form']) != False:
4560+ <tr class="table_parent_data">
4561+ <td width="23%">
4562+ ${_('Account Total')}
4563+ </td>
4564+ <td width="11%" >
4565+ ${formatLang(get_direction('6'), currency_obj=company.currency_id)}
4566+ </td>
4567+ <td width="11%" >
4568+ ${ formatLang(get_for_period('4'), currency_obj=company.currency_id)}
4569+ </td><td width="11%" >
4570+ ${ formatLang(get_for_period('3'), currency_obj=company.currency_id)}
4571+ </td>
4572+ <td width="11%" >
4573+ ${ formatLang(get_for_period('2'), currency_obj=company.currency_id)}
4574+ </td>
4575+ <td width="11%" >
4576+ ${ formatLang(get_for_period('1'), currency_obj=company.currency_id)}
4577+ </td>
4578+ <td width="11%" >
4579+ ${ formatLang(get_for_period('0'), currency_obj=company.currency_id)}
4580+ </td>
4581+ <td width="11%" >
4582+ ${formatLang(get_total('5'), currency_obj=company.currency_id)}
4583+ </td>
4584+ </tr>
4585+
4586+
4587+ %for partner in get_lines(data['form']):
4588+ <tr class="table_child_data">
4589+ <td width="23%">
4590+ ${partner['name']}
4591+ </td>
4592+ <td width="11%" >
4593+ ${formatLang(partner['direction'], currency_obj=company.currency_id)}
4594+ </td>
4595+ <td width="11%" >
4596+ ${ formatLang(partner['4'], currency_obj=company.currency_id)}
4597+ </td><td width="11%" >
4598+ ${ formatLang(partner['3'], currency_obj=company.currency_id)}
4599+ </td>
4600+ <td width="11%" >
4601+ ${ formatLang(partner['2'], currency_obj=company.currency_id)}
4602+ </td>
4603+ <td width="11%" >
4604+ ${ formatLang(partner['1'], currency_obj=company.currency_id)}
4605+ </td>
4606+ <td width="11%" >
4607+ ${ formatLang(partner['0'], currency_obj=company.currency_id)}
4608+ </td>
4609+ <td width="11%" >
4610+ ${formatLang(partner['total'], currency_obj=company.currency_id)}
4611+ </td>
4612+ </tr>
4613+ %endfor
4614+
4615+ %for not_partner in get_lines_with_out_partner(data['form']):
4616+ <tr class="table_child_data">
4617+ <td width="23%">
4618+ ${not_partner['name']}
4619+ </td>
4620+ <td width="11%" >
4621+ ${formatLang(not_partner['direction'], currency_obj=company.currency_id)}
4622+ </td>
4623+ <td width="11%" >
4624+ ${ formatLang(not_partner['4'], currency_obj=company.currency_id)}
4625+ </td><td width="11%" >
4626+ ${ formatLang(not_partner['3'], currency_obj=company.currency_id)}
4627+ </td>
4628+ <td width="11%" >
4629+ ${ formatLang(not_partner['2'], currency_obj=company.currency_id)}
4630+ </td>
4631+ <td width="11%" >
4632+ ${ formatLang(not_partner['1'], currency_obj=company.currency_id)}
4633+ </td>
4634+ <td width="11%" >
4635+ ${ formatLang(not_partner['0'], currency_obj=company.currency_id)}
4636+ </td>
4637+ <td width="11%" >
4638+ ${formatLang(not_partner['total'], currency_obj=company.currency_id)}
4639+ </td>
4640+ </tr>
4641+ %endfor
4642+ %endif
4643+
4644+ </table >
4645+ %endfor
4646+
4647+ </body>
4648+</html>
4649\ No newline at end of file
4650
4651=== added file 'account_webkit/report/account_aged_partner_balance.py'
4652--- account_webkit/report/account_aged_partner_balance.py 1970-01-01 00:00:00 +0000
4653+++ account_webkit/report/account_aged_partner_balance.py 2013-10-10 09:47:29 +0000
4654@@ -0,0 +1,383 @@
4655+# -*- coding: utf-8 -*-
4656+##############################################################################
4657+#
4658+# OpenERP, Open Source Management Solution
4659+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
4660+#
4661+# This program is free software: you can redistribute it and/or modify
4662+# it under the terms of the GNU Affero General Public License as
4663+# published by the Free Software Foundation, either version 3 of the
4664+# License, or (at your option) any later version.
4665+#
4666+# This program is distributed in the hope that it will be useful,
4667+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4668+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4669+# GNU Affero General Public License for more details.
4670+#
4671+# You should have received a copy of the GNU Affero General Public License
4672+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4673+#
4674+############################################################################
4675+
4676+import time
4677+from openerp.report import report_sxw
4678+from openerp.osv import osv
4679+from account.report.common_report_header import common_report_header
4680+
4681+class aged_trial_report(report_sxw.rml_parse, common_report_header):
4682+
4683+ def __init__(self, cr, uid, name, context):
4684+ super(aged_trial_report, self).__init__(cr, uid, name, context=context)
4685+ self.total_account = []
4686+ self.localcontext.update({
4687+ 'time': time,
4688+ 'get_lines_with_out_partner': self._get_lines_with_out_partner,
4689+ 'get_lines': self._get_lines,
4690+ 'get_total': self._get_total,
4691+ 'get_direction': self._get_direction,
4692+ 'get_for_period': self._get_for_period,
4693+ 'get_company': self._get_company,
4694+ 'get_currency': self._get_currency,
4695+ 'get_partners':self._get_partners,
4696+ 'get_account': self._get_account,
4697+ 'get_fiscalyear': self._get_fiscalyear,
4698+ 'get_target_move': self._get_target_move,
4699+ })
4700+
4701+ def set_context(self, objects, data, ids, report_type=None):
4702+ obj_move = self.pool.get('account.move.line')
4703+ ctx = data['form'].get('used_context', {})
4704+ ctx.update({'fiscalyear': False, 'all_fiscalyear': True})
4705+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx)
4706+ self.direction_selection = data['form'].get('direction_selection', 'past')
4707+ self.target_move = data['form'].get('target_move', 'all')
4708+ self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
4709+ if (data['form']['result_selection'] == 'customer' ):
4710+ self.ACCOUNT_TYPE = ['receivable']
4711+ elif (data['form']['result_selection'] == 'supplier'):
4712+ self.ACCOUNT_TYPE = ['payable']
4713+ else:
4714+ self.ACCOUNT_TYPE = ['payable','receivable']
4715+ return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type)
4716+
4717+ def _get_lines(self, form):
4718+ res = []
4719+ move_state = ['draft','posted']
4720+ if self.target_move == 'posted':
4721+ move_state = ['posted']
4722+ self.cr.execute('SELECT DISTINCT res_partner.id AS id,\
4723+ res_partner.name AS name \
4724+ FROM res_partner,account_move_line AS l, account_account, account_move am\
4725+ WHERE (l.account_id=account_account.id) \
4726+ AND (l.move_id=am.id) \
4727+ AND (am.state IN %s)\
4728+ AND (account_account.type IN %s)\
4729+ AND account_account.active\
4730+ AND ((reconcile_id IS NULL)\
4731+ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4732+ AND (l.partner_id=res_partner.id)\
4733+ AND (l.date <= %s)\
4734+ AND ' + self.query + ' \
4735+ ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
4736+ partners = self.cr.dictfetchall()
4737+ ## mise a 0 du total
4738+ for i in range(7):
4739+ self.total_account.append(0)
4740+ #
4741+ # Build a string like (1,2,3) for easy use in SQL query
4742+ partner_ids = [x['id'] for x in partners]
4743+ if not partner_ids:
4744+ return []
4745+ # This dictionary will store the debit-credit for all partners, using partner_id as key.
4746+
4747+ totals = {}
4748+ self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
4749+ FROM account_move_line AS l, account_account, account_move am \
4750+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id) \
4751+ AND (am.state IN %s)\
4752+ AND (account_account.type IN %s)\
4753+ AND (l.partner_id IN %s)\
4754+ AND ((l.reconcile_id IS NULL)\
4755+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4756+ AND ' + self.query + '\
4757+ AND account_account.active\
4758+ AND (l.date <= %s)\
4759+ GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from, self.date_from,))
4760+ t = self.cr.fetchall()
4761+ for i in t:
4762+ totals[i[0]] = i[1]
4763+
4764+ # This dictionary will store the future or past of all partners
4765+ future_past = {}
4766+ if self.direction_selection == 'future':
4767+ self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
4768+ FROM account_move_line AS l, account_account, account_move am \
4769+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id) \
4770+ AND (am.state IN %s)\
4771+ AND (account_account.type IN %s)\
4772+ AND (COALESCE(l.date_maturity, l.date) < %s)\
4773+ AND (l.partner_id IN %s)\
4774+ AND ((l.reconcile_id IS NULL)\
4775+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4776+ AND '+ self.query + '\
4777+ AND account_account.active\
4778+ AND (l.date <= %s)\
4779+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from, self.date_from,))
4780+ t = self.cr.fetchall()
4781+ for i in t:
4782+ future_past[i[0]] = i[1]
4783+ elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
4784+ self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
4785+ FROM account_move_line AS l, account_account, account_move am \
4786+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
4787+ AND (am.state IN %s)\
4788+ AND (account_account.type IN %s)\
4789+ AND (COALESCE(l.date_maturity,l.date) > %s)\
4790+ AND (l.partner_id IN %s)\
4791+ AND ((l.reconcile_id IS NULL)\
4792+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4793+ AND '+ self.query + '\
4794+ AND account_account.active\
4795+ AND (l.date <= %s)\
4796+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
4797+ t = self.cr.fetchall()
4798+ for i in t:
4799+ future_past[i[0]] = i[1]
4800+
4801+ # Use one query per period and store results in history (a list variable)
4802+ # Each history will contain: history[1] = {'<partner_id>': <partner_debit-credit>}
4803+ history = []
4804+ for i in range(5):
4805+ args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids),self.date_from,)
4806+ dates_query = '(COALESCE(l.date_maturity,l.date)'
4807+ if form[str(i)]['start'] and form[str(i)]['stop']:
4808+ dates_query += ' BETWEEN %s AND %s)'
4809+ args_list += (form[str(i)]['start'], form[str(i)]['stop'])
4810+ elif form[str(i)]['start']:
4811+ dates_query += ' > %s)'
4812+ args_list += (form[str(i)]['start'],)
4813+ else:
4814+ dates_query += ' < %s)'
4815+ args_list += (form[str(i)]['stop'],)
4816+ args_list += (self.date_from,)
4817+ self.cr.execute('''SELECT l.partner_id, SUM(l.debit-l.credit)
4818+ FROM account_move_line AS l, account_account, account_move am
4819+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)
4820+ AND (am.state IN %s)
4821+ AND (account_account.type IN %s)
4822+ AND (l.partner_id IN %s)
4823+ AND ((l.reconcile_id IS NULL)
4824+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))
4825+ AND ''' + self.query + '''
4826+ AND account_account.active
4827+ AND ''' + dates_query + '''
4828+ AND (l.date <= %s)
4829+ GROUP BY l.partner_id''', args_list)
4830+ t = self.cr.fetchall()
4831+ d = {}
4832+ for i in t:
4833+ d[i[0]] = i[1]
4834+ history.append(d)
4835+
4836+ for partner in partners:
4837+ values = {}
4838+ ## If choise selection is in the future
4839+ if self.direction_selection == 'future':
4840+ # Query here is replaced by one query which gets the all the partners their 'before' value
4841+ before = False
4842+ if future_past.has_key(partner['id']):
4843+ before = [ future_past[partner['id']] ]
4844+ self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
4845+ values['direction'] = before and before[0] or 0.0
4846+ elif self.direction_selection == 'past': # Changed this so people could in the future create new direction_selections
4847+ # Query here is replaced by one query which gets the all the partners their 'after' value
4848+ after = False
4849+ if future_past.has_key(partner['id']): # Making sure this partner actually was found by the query
4850+ after = [ future_past[partner['id']] ]
4851+
4852+ self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
4853+ values['direction'] = after and after[0] or 0.0
4854+
4855+ for i in range(5):
4856+ during = False
4857+ if history[i].has_key(partner['id']):
4858+ during = [ history[i][partner['id']] ]
4859+ # Ajout du compteur
4860+ self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
4861+ values[str(i)] = during and during[0] or 0.0
4862+ total = False
4863+ if totals.has_key( partner['id'] ):
4864+ total = [ totals[partner['id']] ]
4865+ values['total'] = total and total[0] or 0.0
4866+ ## Add for total
4867+ self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
4868+ values['name'] = partner['name']
4869+
4870+ res.append(values)
4871+
4872+ total = 0.0
4873+ totals = {}
4874+ for r in res:
4875+ total += float(r['total'] or 0.0)
4876+ for i in range(5)+['direction']:
4877+ totals.setdefault(str(i), 0.0)
4878+ totals[str(i)] += float(r[str(i)] or 0.0)
4879+ return res
4880+
4881+ def _get_lines_with_out_partner(self, form):
4882+ res = []
4883+ move_state = ['draft','posted']
4884+ if self.target_move == 'posted':
4885+ move_state = ['posted']
4886+
4887+ ## mise a 0 du total
4888+ for i in range(7):
4889+ self.total_account.append(0)
4890+ totals = {}
4891+ self.cr.execute('SELECT SUM(l.debit-l.credit) \
4892+ FROM account_move_line AS l, account_account, account_move am \
4893+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
4894+ AND (am.state IN %s)\
4895+ AND (l.partner_id IS NULL)\
4896+ AND (account_account.type IN %s)\
4897+ AND ((l.reconcile_id IS NULL) \
4898+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4899+ AND ' + self.query + '\
4900+ AND (l.date <= %s)\
4901+ AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
4902+ t = self.cr.fetchall()
4903+ for i in t:
4904+ totals['Unknown Partner'] = i[0]
4905+ future_past = {}
4906+ if self.direction_selection == 'future':
4907+ self.cr.execute('SELECT SUM(l.debit-l.credit) \
4908+ FROM account_move_line AS l, account_account, account_move am\
4909+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
4910+ AND (am.state IN %s)\
4911+ AND (l.partner_id IS NULL)\
4912+ AND (account_account.type IN %s)\
4913+ AND (COALESCE(l.date_maturity, l.date) < %s)\
4914+ AND ((l.reconcile_id IS NULL)\
4915+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4916+ AND '+ self.query + '\
4917+ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
4918+ t = self.cr.fetchall()
4919+ for i in t:
4920+ future_past['Unknown Partner'] = i[0]
4921+ elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
4922+ self.cr.execute('SELECT SUM(l.debit-l.credit) \
4923+ FROM account_move_line AS l, account_account, account_move am \
4924+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
4925+ AND (am.state IN %s)\
4926+ AND (l.partner_id IS NULL)\
4927+ AND (account_account.type IN %s)\
4928+ AND (COALESCE(l.date_maturity,l.date) > %s)\
4929+ AND ((l.reconcile_id IS NULL)\
4930+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4931+ AND '+ self.query + '\
4932+ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
4933+ t = self.cr.fetchall()
4934+ for i in t:
4935+ future_past['Unknown Partner'] = i[0]
4936+ history = []
4937+
4938+ for i in range(5):
4939+ args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from,)
4940+ dates_query = '(COALESCE(l.date_maturity,l.date)'
4941+ if form[str(i)]['start'] and form[str(i)]['stop']:
4942+ dates_query += ' BETWEEN %s AND %s)'
4943+ args_list += (form[str(i)]['start'], form[str(i)]['stop'])
4944+ elif form[str(i)]['start']:
4945+ dates_query += ' > %s)'
4946+ args_list += (form[str(i)]['start'],)
4947+ else:
4948+ dates_query += ' < %s)'
4949+ args_list += (form[str(i)]['stop'],)
4950+ args_list += (self.date_from,)
4951+ self.cr.execute('SELECT SUM(l.debit-l.credit)\
4952+ FROM account_move_line AS l, account_account, account_move am \
4953+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
4954+ AND (am.state IN %s)\
4955+ AND (account_account.type IN %s)\
4956+ AND (l.partner_id IS NULL)\
4957+ AND ((l.reconcile_id IS NULL)\
4958+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
4959+ AND '+ self.query + '\
4960+ AND account_account.active\
4961+ AND ' + dates_query + '\
4962+ AND (l.date <= %s)\
4963+ GROUP BY l.partner_id', args_list)
4964+ t = self.cr.fetchall()
4965+ d = {}
4966+ for i in t:
4967+ d['Unknown Partner'] = i[0]
4968+ history.append(d)
4969+
4970+ values = {}
4971+ if self.direction_selection == 'future':
4972+ before = False
4973+ if future_past.has_key('Unknown Partner'):
4974+ before = [ future_past['Unknown Partner'] ]
4975+ self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
4976+ values['direction'] = before and before[0] or 0.0
4977+ elif self.direction_selection == 'past':
4978+ after = False
4979+ if future_past.has_key('Unknown Partner'):
4980+ after = [ future_past['Unknown Partner'] ]
4981+ self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
4982+ values['direction'] = after and after[0] or 0.0
4983+
4984+ for i in range(5):
4985+ during = False
4986+ if history[i].has_key('Unknown Partner'):
4987+ during = [ history[i]['Unknown Partner'] ]
4988+ self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
4989+ values[str(i)] = during and during[0] or 0.0
4990+
4991+ total = False
4992+ if totals.has_key( 'Unknown Partner' ):
4993+ total = [ totals['Unknown Partner'] ]
4994+ values['total'] = total and total[0] or 0.0
4995+ ## Add for total
4996+ self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
4997+ values['name'] = 'Unknown Partner'
4998+
4999+ if values['total']:
5000+ res.append(values)
The diff has been truncated for viewing.