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
=== added directory 'account_analytic_plans_webkit'
=== added file 'account_analytic_plans_webkit/__init__.py'
--- account_analytic_plans_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,26 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import wizard
23import report
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
26
027
=== added file 'account_analytic_plans_webkit/__openerp__.py'
--- account_analytic_plans_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,42 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22{
23 'name': 'Multiple Analytic Plans Webkit',
24 'version': '1.0',
25 'category': 'Accounting & Finance',
26 'description': """
27This module allows to use several analytic plans according to the general journal.
28==================================================================================
29 It is conversion of rml report to Webkit Report.
30
31 """,
32 'author': 'Serpent Consulting Services',
33 'website': 'http://www.serpentcs.com',
34 'depends': ['report_webkit', 'account_analytic_plans'],
35 'data': [
36 'account_analytic_plans_report.xml',
37 ],
38 'installable': True,
39 'auto_install': False,
40}
41
42# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
043
=== added file 'account_analytic_plans_webkit/account_analytic_plans_report.xml'
--- account_analytic_plans_webkit/account_analytic_plans_report.xml 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/account_analytic_plans_report.xml 2013-10-10 09:47:29 +0000
@@ -0,0 +1,147 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="account_webkit_header" model="ir.header_webkit">
5 <field name="footer_html"><![CDATA[]]></field>
6 <field name="orientation">Portrait</field>
7 <field name="format">A4</field>
8 <field name="html"><![CDATA[
9<html>
10 <head>
11 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
12 <script>
13 function subst() {
14 var vars={};
15 var x=document.location.search.substring(1).split('&');
16 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
17 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
18 for(var i in x) {
19 var y = document.getElementsByClassName(x[i]);
20 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
21 }
22 }
23 </script>
24 <style type="text/css">
25
26 ${css}
27 </style>
28 </head>
29
30 ${_debug or ''|n} </body>
31</html>]]>
32 </field>
33 <field name="orientation">Portrait</field>
34 <field name="format">A4</field>
35 <field name="html"><![CDATA[
36<html>
37 <head>
38 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
39 <script>
40 function subst() {
41 var vars={};
42 var x=document.location.search.substring(1).split('&');
43 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
44 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
45 for(var i in x) {
46 var y = document.getElementsByClassName(x[i]);
47 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
48 }
49 }
50 </script>
51 <style type="text/css">
52 ${css}
53 </style>
54 </head>
55 <body style="border:0;" onload="subst()">
56 <table style="border-bottom: 1px solid black; width: 100%">
57 <tr >
58 <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
59 <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
60 <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
61 <td style="text-align:left;font-size:12;" width="1%"> /</td>
62 <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
63 </tr>
64 </table> ${_debug or ''|n} </body>
65
66</html>]]>
67 </field>
68 <field eval="15.0" name="margin_top"/>
69 <field eval="5.0" name="margin_bottom"/>
70 <field name="css"><![CDATA[
71
72 .cell_extended{
73 border-spacing: 0;
74 border-collapse: collapse;
75 border-style:solid;
76 border: 1px;
77 border-style:solid;
78 border-color:#C0C0C0;
79 font-size:10px;
80 }
81
82 tr.table_parent_data{
83 font-family: Helvetica-Bold;
84 font-size: 10px;
85 caption-side: top;
86 font-weight: bold;
87}
88 tr.table_child_data{
89 font-family: Helvetica;
90 font-size: 8px;
91 caption-side: top;
92}
93
94 .under_line1{
95 border-bottom:2px solid black;
96 font-size:10px;
97}
98
99 td.under_line{
100 border-bottom:2px solid black;
101 font-size:10px;
102}
103 .under_line_gray{
104 border-bottom:2px;
105 border-style:solid;
106 border-color:#C0C0C0;
107 font-size:10px;
108}
109 .list_table1 {
110border-color:#C0C0C0;
111text-align:center;
112font-size:8px;
113margin-top:2px;
114margin-bottom:2px;
115border-collapse: collapse;
116}
117.list_table1 td {
118border-color:gray;
119border-bottom:1px solid gray;
120text-align:left;
121font-size:10;
122padding-left:3px
123padding-right:3px
124padding-top:3px
125padding-bottom:3px
126}
127
128]]>
129 </field>
130 <field name="name">Account webkit Header</field>
131 </record>
132 <report
133 id="account_analytic_account_crossovered_analytic"
134 string="Crossovered Analytic"
135 model="account.analytic.account"
136 name="account.analytic.account.crossovered.analytic.webkit"
137 file="account_analytic_plans_webkit/report/crossovered_analytic.mako"
138 auto="False"
139 menu="False"
140 report_type="webkit"
141 header="True"
142 webkit_header="account_webkit_header"
143 />
144
145 </data>
146</openerp>
147
0148
=== added directory 'account_analytic_plans_webkit/report'
=== added file 'account_analytic_plans_webkit/report/__init__.py'
--- account_analytic_plans_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import crossovered_analytic
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
25
026
=== added file 'account_analytic_plans_webkit/report/crossovered_analytic.mako'
--- account_analytic_plans_webkit/report/crossovered_analytic.mako 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/report/crossovered_analytic.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,114 @@
1<html>
2<head>
3 <style type="text/css">
4 ${css}
5 </style>
6 <title>Crossoverred Analytic.pdf</title>
7
8</head>
9<body>
10 <table width="100%">
11 <tr>
12 <td style="text-align:center;">
13 <h3><b> Crossovered Analytic</b></h3>
14 </td>
15 </tr>
16 </table>
17 <table width="100%" class="cell_extended">
18 <tr>
19 <td style="text-align:center;" class="cell_extended"><b>${ _('From Date') }</b></td>
20 <td style="text-align:center;" class="cell_extended"><b>${ _('To Date') }</b></td>
21 <td style="text-align:center;" class="cell_extended"><b>${ _('Company') }</b></td>
22 <td style="text-align:center;" class="cell_extended"><b>${ _('Currency') }</b></td>
23 <td style="text-align:center;" class="cell_extended"><b>${ _('Printing date') }</b></td>
24 </tr>
25 <tr>
26 <td style="text-align:center;" class="cell_extended">${ data['form']['date1'] }</td>
27 <td style="text-align:center;" class="cell_extended">${ data['form']['date2'] } </td>
28 <td style="text-align:center;" class="cell_extended">${ company.name }</td>
29 <td style="text-align:center;" class="cell_extended">${ company.currency_id.name }</td>
30 <td style="text-align:center;" class="cell_extended">${ time.strftime('%Y-%m-%d')} at ${ time.strftime('%H:%M:%S') }</td>
31 </tr>
32 </table>
33 <br/>
34
35 <table width="100%" >
36 <tr>
37 <td>
38 <h4><b>Analytic Account Reference:</b></h4>
39 </td>
40 </tr>
41 </table>
42 <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">
43 <tr>
44 <td width="60%">
45 ${_('Account Name') }
46 </td>
47 <td width="10%">
48 ${_('Code') }
49 </td>
50 <td width="10%">
51 ${_('Quantity') }
52 </td>
53 <td width="10%">
54 ${_('Amount') }
55 </td>
56 <td width="10%">
57 ${_('Perc(%)') }
58 </td>
59 </tr>
60 </table>
61 %for k in ref_lines(data['form']):
62 <table width="100%" class="list_table1">
63 <tr>
64 <td width="60%">${k['ref_name']}</td>
65 <td width="10%" >${k['ref_code']}</td>
66 <td width="10%" style="text-align:right;">${k['ref_qty']}</td>
67 <td width="10%" style="text-align:right;">${k['ref_amt']}</td>
68 <td width="10%" style="text-align:right;">100.00%</td>
69 </tr>
70 </table>
71 %endfor
72
73 <br/>
74 <table width="100%" >
75 <tr>
76 <td>
77 <h4><b>Analytic Account :</b></h4>
78 </td>
79 </tr>
80 </table>
81 <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">
82 <tr>
83 <td width="60%">
84 ${_('Account Name') }
85 </td>
86 <td width="10%">
87 ${_('Code') }
88 </td>
89 <td width="10%">
90 ${_('Quantity') }
91 </td>
92 <td width="10%" >
93 ${_('Amount') }
94 </td>
95 <td width="10%">
96 ${_('Percentage') }
97 </td>
98 </tr>
99 </table>
100 %for account in lines(data['form']):
101 <table width="100%" class="list_table1">
102 <tr>
103 <td width="60%" >${account['acc_name']}</td>
104 <td width="10%" >${account['code']}</td>
105 <td width="10%" style="text-align:right;">${account['qty']}</td>
106 <td width="10%" style="text-align:right;">${account['amt']}</td>
107 <td width="10%" style="text-align:right;">${account['perc']}%</td>
108 </tr>
109 </table>
110 <p style="page-break-after:always">
111 </p>
112 %endfor
113</body>
114</html>
0\ No newline at end of file115\ No newline at end of file
1116
=== added file 'account_analytic_plans_webkit/report/crossovered_analytic.py'
--- account_analytic_plans_webkit/report/crossovered_analytic.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/report/crossovered_analytic.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,182 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22
23import time
24
25from openerp.report import report_sxw
26
27class crossovered_analytic(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(crossovered_analytic, self).__init__(cr, uid, name, context = context)
30 self.localcontext.update( {
31 'time': time,
32 'lines': self._lines,
33 'ref_lines': self._ref_lines,
34 'find_children': self.find_children,
35 })
36 self.base_amount = 0.00
37
38 def find_children(self, ref_ids):
39 if not ref_ids: return []
40 to_return_ids = []
41 final_list = []
42 parent_list = []
43 set_list = []
44 analytic_obj = self.pool.get('account.analytic.account')
45 for id in ref_ids:
46 # to avoid duplicate entries
47 if id not in to_return_ids:
48 to_return_ids.append(analytic_obj.search(self.cr,self.uid,[('parent_id','child_of',[id])]))
49 data_accnt = analytic_obj.browse(self.cr,self.uid,to_return_ids[0])
50 for data in data_accnt:
51 if data.parent_id and data.parent_id.id == ref_ids[0]:
52 parent_list.append(data.id)
53 final_list.append(ref_ids[0])
54 set_list = self.set_account(parent_list)
55 final_list.extend(set_list)
56 return final_list #to_return_ids[0]
57
58 def set_account(self, cats):
59 lst = []
60 category = self.pool.get('account.analytic.account').read(self.cr, self.uid, cats)
61 for cat in category:
62 lst.append(cat['id'])
63 if cat['child_ids']:
64 lst.extend(self.set_account(cat['child_ids']))
65 return lst
66
67 def _ref_lines(self, form):
68 result = []
69 res = {}
70 acc_pool = self.pool.get('account.analytic.account')
71 line_pool = self.pool.get('account.analytic.line')
72
73 self.dict_acc_ref = {}
74 if form['journal_ids']:
75 journal = " in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")"
76 else:
77 journal = 'is not null'
78
79 query_general = "SELECT id FROM account_analytic_line WHERE (journal_id " + journal +") AND date>='"+ str(form['date1']) +"'"" AND date<='" + str(form['date2']) + "'"
80
81 self.cr.execute(query_general)
82 l_ids = self.cr.fetchall()
83 line_ids = [x[0] for x in l_ids]
84
85 obj_line = line_pool.browse(self.cr,self.uid,line_ids)
86
87 #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.
88 self.dict_acc_ref[form['ref']] = []
89 children_list = acc_pool.search(self.cr, self.uid, [('parent_id', 'child_of', [form['ref']])])
90 for obj in obj_line:
91 if obj.account_id.id in children_list:
92 if obj.move_id and obj.move_id.id not in self.dict_acc_ref[form['ref']]:
93 self.dict_acc_ref[form['ref']].append(obj.move_id.id)
94
95 res['ref_name'] = acc_pool.name_get(self.cr, self.uid, [form['ref']])[0][1]
96 res['ref_code'] = acc_pool.browse(self.cr, self.uid, form['ref']).code
97
98 self.final_list = children_list
99 selected_ids = line_pool.search(self.cr, self.uid, [('account_id', 'in' ,self.final_list)])
100
101 res['ref_qty'] = 0.0
102 res['ref_amt'] = 0.0
103 self.base_amount = 0.0
104
105 if selected_ids:
106 query = "SELECT SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \
107 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']) + "'"
108
109 self.cr.execute(query)
110 info=self.cr.dictfetchall()
111 res['ref_qty'] = info[0]['qty']
112 res['ref_amt'] = info[0]['amt']
113 self.base_amount = info[0]['amt']
114 result.append(res)
115 return result
116
117 def _lines(self, form, ids=None):
118 print "\n\n :::::::lines",form
119 if ids is None:
120 ids = {}
121 if not ids:
122 ids = self.ids
123
124 if form['journal_ids']:
125 journal=" in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")"
126 else:
127 journal= 'is not null'
128
129 acc_pool = self.pool.get('account.analytic.account')
130 line_pool = self.pool.get('account.analytic.line')
131 acc_id = []
132 final = []
133 self.list_ids = []
134
135 self.final_list = self.find_children(ids)
136
137 for acc_id in self.final_list:
138 selected_ids = line_pool.search(self.cr, self.uid, [('account_id','=',acc_id), ('move_id', 'in', self.dict_acc_ref[form['ref']])])
139 if selected_ids:
140 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 \
141 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"
142
143 self.cr.execute(query)
144 res = self.cr.dictfetchall()
145 if res:
146 for element in res:
147 if self.base_amount <> 0.00:
148 element['perc'] = (element['amt'] / self.base_amount) * 100.00
149 else:
150 element['perc'] = 0.00
151 else:
152 result = {}
153 res = []
154 result['id'] = acc_id
155 data_account = acc_pool.browse(self.cr, self.uid, acc_id)
156 result['acc_name'] = data_account.name
157 result['code'] = data_account.code
158 result['amt'] = result['qty'] = result['perc'] = 0.00
159 if not form['empty_line']:
160 res.append(result)
161 else:
162 result = {}
163 res = []
164 result['id'] = acc_id
165 data_account = acc_pool.browse(self.cr, self.uid, acc_id)
166 result['acc_name'] = data_account.name
167 result['code'] = data_account.code
168 result['amt'] = result['qty'] = result['perc'] = 0.00
169 if not form['empty_line']:
170 res.append(result)
171
172 for item in res:
173 obj_acc = acc_pool.name_get(self.cr,self.uid,[item['id']])
174 item['acc_name'] = obj_acc[0][1]
175 final.append(item)
176 print final
177 return final
178
179report_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')
180
181# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
182
0183
=== added directory 'account_analytic_plans_webkit/wizard'
=== added file 'account_analytic_plans_webkit/wizard/__init__.py'
--- account_analytic_plans_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/wizard/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,26 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22
23import account_crossovered_analytic
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
26
027
=== added file 'account_analytic_plans_webkit/wizard/account_crossovered_analytic.py'
--- account_analytic_plans_webkit/wizard/account_crossovered_analytic.py 1970-01-01 00:00:00 +0000
+++ account_analytic_plans_webkit/wizard/account_crossovered_analytic.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,70 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import time
23
24from openerp.osv import fields, osv
25from openerp.tools.translate import _
26
27class account_crossovered_analytic(osv.osv_memory):
28 _inherit = "account.crossovered.analytic"
29
30
31
32 def print_report(self, cr, uid, ids, context=None):
33
34 res = super(account_crossovered_analytic,self).print_report( cr, uid, ids, context=context)
35 res['report_name']= 'account.analytic.account.crossovered.analytic.webkit'
36 return res
37# cr.execute('SELECT account_id FROM account_analytic_line')
38# res = cr.fetchall()
39# acc_ids = [x[0] for x in res]
40#
41# data = self.read(cr, uid, ids, [], context=context)[0]
42# data['ref'] = data['ref'][0]
43#
44# obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context)
45# name = obj_acc.name
46#
47# account_ids = self.pool.get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['ref']])], context=context)
48#
49# flag = True
50# for acc in account_ids:
51# if acc in acc_ids:
52# flag = False
53# break
54# if flag:
55# raise osv.except_osv(_('User Error!'),_('There are no analytic lines related to account %s.' % name))
56#
57# datas = {
58# 'ids': [],
59# 'model': 'account.analytic.account',
60# 'form': data
61# }
62# return {
63# 'type': 'ir.actions.report.xml',
64# 'report_name': 'account.analytic.account.crossovered.analytic',
65# 'datas': datas,
66# }
67
68account_crossovered_analytic()
69
70# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
071
=== added directory 'account_bank_statement_extensions_webkit'
=== added file 'account_bank_statement_extensions_webkit/__init__.py'
--- account_bank_statement_extensions_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ account_bank_statement_extensions_webkit/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import report
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'account_bank_statement_extensions_webkit/__openerp__.py'
--- account_bank_statement_extensions_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_bank_statement_extensions_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,41 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21{
22 'name': 'Bank Statement Extensions to Support e-banking Webkit',
23 'version': '1.1',
24 'author': 'Serpent Consulting Services',
25 'category': 'Generic Modules/Accounting',
26 'description': '''
27Module that extends the standard account_bank_statement_line object for improved e-banking support.
28===================================================================================================
29
30 It is conversion of rml report to Webkit Report.
31
32 ''',
33 'depends': ['account_bank_statement_extensions','report_webkit'],
34 'data' : [
35 'account_bank_statement_report.xml',
36 ],
37 'auto_install': False,
38 'installable': True,
39}
40
41# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
042
=== added file 'account_bank_statement_extensions_webkit/account_bank_statement_report.xml'
--- account_bank_statement_extensions_webkit/account_bank_statement_report.xml 1970-01-01 00:00:00 +0000
+++ account_bank_statement_extensions_webkit/account_bank_statement_report.xml 2013-10-10 09:47:29 +0000
@@ -0,0 +1,113 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="account_bank_statement_webkit_header" model="ir.header_webkit">
5 <field name="footer_html"><![CDATA[]]></field>
6 <field name="orientation">Portrait</field>
7 <field name="format">A4</field>
8 <field name="html"><![CDATA[
9 <html>
10 <head>
11 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
12 <script>
13 function subst() {
14 var vars={};
15 var x=document.location.search.substring(1).split('&');
16 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
17 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
18 for(var i in x) {
19 var y = document.getElementsByClassName(x[i]);
20 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
21 }
22 }
23 </script>
24 <style type="text/css">
25
26 ${css}
27 </style>
28 </head>
29 <body style="border:0; margin: 0;" onload="subst()">
30 <table class="header" style="border-bottom: 1px solid black; width: 100%">
31 <tr >
32 <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
33 <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
34 <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
35 <td style="text-align:left;font-size:12;" width="1%"> /</td>
36 <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
37 </tr>
38 </table> ${_debug or ''|n} </body>
39 </html>]]>
40 </field>
41 <field eval="15.0" name="margin_top"/>
42 <field eval="5.0" name="margin_bottom"/>
43 <field name="css"><![CDATA[
44
45 body, table, td, span, div {
46 font-family: Helvetica, Arial;
47 }
48
49 body {
50 font-family:Arial;
51 font-size:12px;
52
53 }
54
55 .tr_bottom_line_dark_grey{
56 border-bottom: thin solid grey;
57 width:100%;
58 font-size:12px;
59
60 }
61 .tr_bottom_line_dark_black{
62 border-bottom: thin solid black;
63 width:100%;
64 font-size:12px;
65 font-weight:bold;
66 }
67 tr.report_header{
68
69 caption-side: top;
70 font-family: Helvetica-Bold
71 padding: 5px;
72 border-bottom: 15px solid black;
73 align: center;
74 }
75
76
77 .header {
78 margin-left:0;
79 text-align:left;
80 width:300px;
81 font-size:12;
82 }
83 .title {
84 font-size:16;
85 font-weight: bold;
86
87 }
88
89 .list_table {
90 border-bottom:black;
91 text-align:center;
92 border-collapse: collapse;
93
94 }
95
96 ]]>
97 </field>
98 <field name="name">Account Bank Statment Webkit Header</field>
99 </record>
100
101 <report
102 auto="False"
103 id="bank_statement_balance_report"
104 model="account.bank.statement"
105 name="bank.statement.balance.report.webkit"
106 file="account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako"
107 report_type="webkit"
108 webkit_header="account_bank_statement_webkit_header"
109 string="Bank Statement Balances Report"
110 multi="True"/>
111
112 </data>
113</openerp>
0114
=== added directory 'account_bank_statement_extensions_webkit/report'
=== added file 'account_bank_statement_extensions_webkit/report/__init__.py'
--- account_bank_statement_extensions_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_bank_statement_extensions_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22
23import bank_statement_balance_report
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
026
=== added file 'account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako'
--- account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako 1970-01-01 00:00:00 +0000
+++ account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,56 @@
1<html>
2 <head>
3 <style type="text/css">
4 ${css}
5 </style>
6 </head>
7<body>
8 <br/>
9 <table width="100%">
10 <tr class ="report_header">
11 <td align="center">
12 <h4><b>
13 Bank Statement Balances Report
14 </b></h4>
15 </td>
16 </tr>
17 </table>
18 <br/> <br/>
19
20 <table border="0" class="tr_bottom_line_dark_black" >
21 <tr>
22 <td width="30%">
23 ${_('Name')}
24 </td>
25 <td width="30%">
26 ${_('Date')}
27 </td>
28 <td width="20%">
29 ${_('Journal')}
30 </td>
31 <td width="20%" align="right">
32 ${_('Closing Balance')}
33 </td>
34 </tr>
35 </table>
36 %for l in lines:
37 <table border="0" class="tr_bottom_line_dark_grey">
38 <tr >
39 <td width="30%">
40 ${ l['s_name'] }
41 </td>
42 <td width="30%">
43 ${ l['s_date'] }
44 </td>
45 <td width="20%">
46 ${ l['j_code'] }
47 </td>
48 <td width="20%" align="right">
49 ${ (l['s_balance']) }
50 </td>
51 </tr>
52 %endfor
53 </table>
54 <p style="page-break-after:always"></p>
55</body>
56</html>
0\ No newline at end of file57\ No newline at end of file
158
=== added file 'account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py'
--- account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py 1970-01-01 00:00:00 +0000
+++ account_bank_statement_extensions_webkit/report/bank_statement_balance_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,70 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22
23import time
24from openerp.report import report_sxw
25from openerp import pooler
26import logging
27_logger = logging.getLogger(__name__)
28
29class bank_statement_balance_report(report_sxw.rml_parse):
30
31 def set_context(self, objects, data, ids, report_type=None):
32 #_logger.warning('addons.'+__name__, 'set_context, objects = %s, data = %s, ids = %s' % (objects, data, ids))
33 cr = self.cr
34 uid = self.uid
35 context = self.context
36
37 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 ' \
38 'FROM account_bank_statement s ' \
39 'INNER JOIN account_journal j on s.journal_id = j.id ' \
40 'INNER JOIN ' \
41 '(SELECT journal_id, max(date) as max_date FROM account_bank_statement ' \
42 'GROUP BY journal_id) d ' \
43 'ON (s.journal_id = d.journal_id AND s.date = d.max_date) ' \
44 'ORDER BY j.code')
45 lines = cr.dictfetchall()
46
47 self.localcontext.update( {
48 'lines': lines,
49 })
50 super(bank_statement_balance_report, self).set_context(objects, data, ids, report_type=report_type)
51
52
53 def __init__(self, cr, uid, name, context):
54 if context is None:
55 context = {}
56 super(bank_statement_balance_report, self).__init__(cr, uid, name, context=context)
57 self.localcontext.update( {
58 'time': time,
59 })
60 self.context = context
61
62report_sxw.report_sxw(
63 'report.bank.statement.balance.report.webkit',
64 'account.bank.statement',
65 'addons/account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako',
66 parser=bank_statement_balance_report,
67 header='internal'
68)
69
70# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
071
=== added directory 'account_budget_webkit'
=== added file 'account_budget_webkit/__init__.py'
--- account_budget_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,26 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import report
23import wizard
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
26
027
=== added file 'account_budget_webkit/__openerp__.py'
--- account_budget_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,42 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22{
23 'name': 'Budgets Management',
24 'version': '1.0',
25 'category': 'Accounting & Finance',
26 'description': """
27This module allows accountants to manage analytic and crossovered budgets.
28==========================================================================
29
30It is conversion of rml report to Webkit Report.
31
32""",
33 'author': 'Serpent Consulting Services',
34 'website': 'http://www.serpentcs.com',
35 'depends': ['account_budget','report_webkit'],
36 'data': [
37 'account_budget_report.xml',
38 ],
39 'installable': True,
40 'auto_install': False,
41}
42# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
043
=== added file 'account_budget_webkit/account_budget_report.xml'
--- account_budget_webkit/account_budget_report.xml 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/account_budget_report.xml 2013-10-10 09:47:29 +0000
@@ -0,0 +1,234 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="account_budget_webkit_header" model="ir.header_webkit">
5 <field name="footer_html"><![CDATA[]]></field>
6 <field name="orientation">Portrait</field>
7 <field name="format">A4</field>
8 <field name="html"><![CDATA[
9 <html>
10 <head>
11 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
12 <script>
13 function subst() {
14 var vars={};
15 var x=document.location.search.substring(1).split('&');
16 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
17 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
18 for(var i in x) {
19 var y = document.getElementsByClassName(x[i]);
20 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
21 }
22 }
23 </script>
24 <style type="text/css">
25
26 ${css}
27 </style>
28 </head>
29 <body style="border:0; margin: 0;" onload="subst()">
30 <table class="header" style="border-bottom: 1px solid black; width: 100%">
31 <tr >
32 <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
33 <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
34 <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
35 <td style="text-align:left;font-size:12;" width="1%"> /</td>
36 <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
37 </tr>
38 </table> ${_debug or ''|n} </body>
39 </html>]]>
40 </field>
41 <field eval="15.0" name="margin_top"/>
42 <field eval="5.0" name="margin_bottom"/>
43 <field name="css"><![CDATA[
44
45 body, table, td, span, div {
46 font-family: Helvetica, Arial;
47 }
48
49 body {
50 font-family:Arial;
51 font-size:12;
52
53 }
54
55
56 .header {
57 margin-left:0;
58 text-align:left;
59 width:300px;
60 font-size:12;
61 }
62 .title {
63 font-size:16;
64 font-weight: bold;
65
66 }
67
68 .basic_table td
69 {
70 border:1px solid lightGrey;
71 font-size:12;
72
73 }
74
75 .list_table {
76 border-bottom:1px solid black;
77 border-right:border-bottom:1px solid #E5E4E2"
78 text-align:left;
79 font-size:12;
80 }
81 .list_table_grey{
82 font-size:12;
83 }
84 .list_table_grey tr{
85 border-bottom:1px solid #E5E4E2";
86
87 text-align:left;
88 font-size:12;
89 }
90 .basic_table{
91 text-align:center;
92 border:1px solid lightGrey;
93 border-collapse: collapse;
94 }
95
96 .list_tabe thead {
97 display:table-header-group;
98 }
99
100 .line{
101 font-size:12px;
102 border-top: 1px solid grey;
103 border-bottom: 1px solid #E5E4E2;
104
105 }
106
107 .tbl_header{
108 width:100%;
109 font-size:10px;
110 }
111 .tr_bottom_line{
112 border-bottom: thin solid black;
113 width:100%;
114 }
115 .tr_bottom_line_dark_grey{
116 border-bottom: thin solid grey;
117 width:100%;
118 }
119 .tr_bottom_line_light_grey{
120 border-bottom: thin solid #CCCCCC;
121 width:100%;
122 }
123 .td_f12{
124 font-size:12px;
125 }
126 .td_f10{
127 font-size:10px;
128 }
129 .td_f10_right{
130 font-size:10px;
131 text-align:right;
132 }
133 .td_f12{
134 font-size:12px;
135 }
136 .td_f12_right{
137 font-size:12px;
138 text-align:right;
139 }
140 table.head_border_style{
141 border:1px solid;
142 color: #cccccc;
143 }
144 tr.head_border_style{
145 border:1px solid;
146 color: #cccccc;
147 }
148 tr.table_header{
149 font-weight: bold;
150 font-family: sans-serif, serif;
151 font-size: 14px;
152 caption-side: top;
153 padding: 5px;
154 }
155 tr.table_parent_data{
156 font-family: Helvetica-Bold;
157 font-size: 12px;
158 caption-side: top;
159 font-weight: bold;
160 }
161 tr.table_child_data{
162 font-family: Helvetica;
163 font-size: 12px;
164 caption-side: top;
165 }
166 tr.report_header{
167 font-size: 30px;
168 caption-side: top;
169 font-family: Helvetica-Bold
170 padding: 5px;
171 border-bottom: 15px solid black;
172 align: center
173 }
174
175 .top{
176 border-top: thin solid black;
177
178 }
179 .bottom {
180 border-bottom:thin solid;
181 border-color:#cccccc;
182 }
183 .head_bottom_border{
184 border-bottom:thin solid;
185 border-color:black;
186 }
187 .left {
188 border-left:thin solid;
189 border-color:#cccccc;
190 }
191 .right {
192 border-right:thin solid;
193 border-color:#cccccc;
194 }
195
196 ]]>
197 </field>
198 <field name="name">Account Tax Webkit Header</field>
199 </record>
200
201 <!-- Reports on crossovered.budget -->
202 <report id="report_crossovered_budget"
203 string="Budgets"
204 model="crossovered.budget"
205 name="crossovered.budget.report.webkit"
206 file="account_budget_webkit/report/crossovered_budget_report.mako"
207 auto="False"
208 menu="False"
209 report_type="webkit"
210 webkit_header="account_budget_webkit_header"/>
211
212 <!-- moved from account module -->
213 <report auto="False"
214 id="account_budget"
215 menu="False"
216 model="account.budget.post"
217 name="account.budget.webkit"
218 file="account_budget_webkit/report/budget_report.mako"
219 string="Budget"
220 report_type="webkit"
221 webkit_header="account_budget_webkit_header"/>
222
223 <report
224 auto="False"
225 id="account_analytic_budget"
226 menu="False"
227 model="account.analytic.account"
228 name="account.analytic.account.budget.webkit"
229 file="account_budget_webkit/report/analytic_account_budget_report.mako"
230 string="Print Budget"
231 report_type="webkit"
232 webkit_header="account_budget_webkit_header" />
233 </data>
234</openerp>
0\ No newline at end of file235\ No newline at end of file
1236
=== added directory 'account_budget_webkit/report'
=== added file 'account_budget_webkit/report/__init__.py'
--- account_budget_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,27 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import crossovered_budget_report
23import analytic_account_budget_report
24import budget_report
25
26# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
27
028
=== added file 'account_budget_webkit/report/analytic_account_budget_report.mako'
--- account_budget_webkit/report/analytic_account_budget_report.mako 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/analytic_account_budget_report.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,119 @@
1<html>
2 <head>
3 <style type="text/css">
4 ${css}
5 .basic_table{
6 text-align:center;
7 border:1px solid lightGrey;
8 border-collapse: collapse;
9 }
10 </style>
11 </head>
12<body>
13</br>
14</br>
15</br>
16 %for o in objects:
17 </br>
18 <table width="100%">
19 <tr>
20 <td align="center">
21 <h4>
22 <b>Analytic Budget </b></h4>
23 </td>
24 </tr>
25 </table>
26<br/>
27 <table width="100%" class="basic_table">
28 <tr >
29 <td width="40%"><b>
30 ${_('Analysis from')}
31 </td></b>
32 <td width="40%"><b>
33 ${_('Analytic Account')}</b>
34 </td>
35 <td width="20%">
36 <b>
37 ${_('Currency')} </b>
38 </td></b>
39 </tr>
40
41 <tr>
42 <td>
43 ${formatLang(data['form']['date_from'],date=True)} to ${formatLang(data['form']['date_to'],date=True)}
44 </td>
45 <td>
46 ${o.name}
47 </td>
48 <td>
49 ${company.currency_id.name}
50 </td>
51 </tr>
52
53 </table>
54 <br/>
55 <table width="100%" class="list_table">
56 <tr >
57 <td width="40%"><b>
58 ${_('Description')}</b>
59 </td>
60 <td width="15%"><b>
61 ${_('Theoretical Amt')}</b>
62 </td>
63 <td width="12%"><b>
64 ${_('Planned Amt')}</b>
65 </td>
66 <td width="13%"><b>
67 ${_('Practical Amt')}</b>
68 </td>
69 <td width="10%" align="right"><b>
70 ${_('Perc(%)')}</b>
71 </td>
72 </tr>
73 %for a in funct(o,data['form']):
74 <tr>
75 <td>
76 ${a['name']}
77 </td>
78 <td>
79 ${formatLang(a['theo'], currency_obj=company.currency_id) }
80 </td>
81 <td>
82 ${ formatLang(a['pln'], currency_obj=company.currency_id) }
83 </td>
84 <td>
85 ${ formatLang(a['prac'], currency_obj=company.currency_id) }
86 </td>
87 <td>
88 ${ formatLang(a['perc']) }%
89 </td>
90 </tr>
91 %endfor
92 </table>
93 %for b in funct_total(data['form']):
94 <table width="100%">
95
96 <tr>
97 <td width="40%"><b><h5>
98 ${ } Total:</h5></b>
99 </td>
100 <td width="15%" align="right"><h5>
101 <b>${ formatLang(b['tot_theo'], currency_obj=company.currency_id) }</b></h5>
102 </td>
103 <td width="12%" align="right"><b><h5>
104 ${ formatLang(b['tot_pln'], currency_obj=company.currency_id) }</b></h5>
105 </td>
106 <td width="13%" align="right"><b><h5>
107 ${ formatLang(b['tot_prac'], currency_obj=company.currency_id) }</h5></b>
108 <td width="10%" align="right"><b><h5>
109 ${ formatLang(b['tot_perc']) }%</h5></b>
110 </td>
111 </tr></h5>
112 %endfor
113 </table>
114 <p style="page-break-after:always">
115 </p>
116
117%endfor
118</body>
119</html>
0\ No newline at end of file120\ No newline at end of file
1121
=== added file 'account_budget_webkit/report/analytic_account_budget_report.py'
--- account_budget_webkit/report/analytic_account_budget_report.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/analytic_account_budget_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,173 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import time
23import datetime
24
25from openerp import pooler
26from openerp.report import report_sxw
27
28class analytic_account_budget_report(report_sxw.rml_parse):
29 def __init__(self, cr, uid, name, context):
30 super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context)
31 self.localcontext.update( {
32 'funct': self.funct,
33 'funct_total': self.funct_total,
34 'time': time,
35 })
36 self.context = context
37
38 def funct(self, object, form, ids=None, done=None, level=1):
39 if ids is None:
40 ids = {}
41 if not ids:
42 ids = self.ids
43 if not done:
44 done = {}
45
46 global tot
47 tot = {
48 'theo':0.00,
49 'pln':0.00,
50 'prac':0.00,
51 'perc':0.00
52 }
53 result = []
54 accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy())
55 c_b_lines_obj = self.pool.get('crossovered.budget.lines')
56 obj_c_budget = self.pool.get('crossovered.budget')
57
58 for account_id in accounts:
59 res = {}
60 b_line_ids = []
61 for line in account_id.crossovered_budget_line:
62 b_line_ids.append(line.id)
63 if not b_line_ids:
64 return []
65 d_from = form['date_from']
66 d_to = form['date_to']
67
68 self.cr.execute('SELECT DISTINCT(crossovered_budget_id) FROM crossovered_budget_lines WHERE id =ANY(%s)',(b_line_ids,))
69 budget_ids = self.cr.fetchall()
70
71 context = {'wizard_date_from':d_from,'wizard_date_to':d_to}
72 for i in range(0, len(budget_ids)):
73 budget_name = obj_c_budget.browse(self.cr, self.uid, [budget_ids[i][0]])
74 res= {
75 'b_id':'-1',
76 'a_id':'-1',
77 'name':budget_name[0].name,
78 'status':1,
79 'theo':0.00,
80 'pln':0.00,
81 'prac':0.00,
82 'perc':0.00
83 }
84 result.append(res)
85
86 line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])])
87 line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
88 tot_theo = tot_pln = tot_prac = tot_perc = 0
89
90 done_budget = []
91 for line in line_id:
92 if line.id in b_line_ids:
93 theo = pract = 0.00
94 theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
95 pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
96 if line.general_budget_id.id in done_budget:
97 for record in result:
98 if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
99 record['theo'] += theo
100 record['pln'] += line.planned_amount
101 record['prac'] += pract
102 record['perc'] += line.percentage
103 tot_theo += theo
104 tot_pln += line.planned_amount
105 tot_prac += pract
106 tot_perc += line.percentage
107 else:
108 res1 = {
109 'b_id': line.general_budget_id.id,
110 'a_id': line.analytic_account_id.id,
111 'name': line.general_budget_id.name,
112 'status': 2,
113 'theo': theo,
114 'pln': line.planned_amount,
115 'prac': pract,
116 'perc': line.percentage
117 }
118 tot_theo += theo
119 tot_pln += line.planned_amount
120 tot_prac += pract
121 tot_perc += line.percentage
122 result.append(res1)
123 done_budget.append(line.general_budget_id.id)
124 else:
125 if line.general_budget_id.id in done_budget:
126 continue
127 else:
128 res1={
129 'b_id': line.general_budget_id.id,
130 'a_id': line.analytic_account_id.id,
131 'name': line.general_budget_id.name,
132 'status': 2,
133 'theo': 0.00,
134 'pln': 0.00,
135 'prac': 0.00,
136 'perc': 0.00
137 }
138 result.append(res1)
139 done_budget.append(line.general_budget_id.id)
140 if tot_theo == 0.00:
141 tot_perc = 0.00
142 else:
143 tot_perc = float(tot_prac / tot_theo) * 100
144
145 result[-(len(done_budget) +1)]['theo'] = tot_theo
146 tot['theo'] +=tot_theo
147 result[-(len(done_budget) +1)]['pln'] = tot_pln
148 tot['pln'] +=tot_pln
149 result[-(len(done_budget) +1)]['prac'] = tot_prac
150 tot['prac'] +=tot_prac
151 result[-(len(done_budget) +1)]['perc'] = tot_perc
152 if tot['theo'] == 0.00:
153 tot['perc'] = 0.00
154 else:
155 tot['perc'] = float(tot['prac'] / tot['theo']) * 100
156 return result
157
158 def funct_total(self, form):
159 result = []
160 res = {}
161 res = {
162 'tot_theo': tot['theo'],
163 'tot_pln': tot['pln'],
164 'tot_prac': tot['prac'],
165 'tot_perc': tot['perc']
166 }
167 result.append(res)
168 return result
169
170report_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')
171
172
173# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0174
=== added file 'account_budget_webkit/report/budget_report.mako'
--- account_budget_webkit/report/budget_report.mako 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/budget_report.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,131 @@
1<html>
2 <head>
3 <style type="text/css">
4 ${css}
5 </style>
6 </head>
7<body>
8</br>
9</br>
10</br>
11 %for o in objects:
12 <br/>
13 <table width="100%">
14 <tr>
15 <td align="center">
16 <h4>
17 <b> Budget </b></h4>
18 </td>
19 </tr>
20 </table>
21 <table width="100%" class="line">
22 <tr>
23 <td width="1%"></td>
24 <td width="49%">
25 <b>Currency:</b>${ company.currency_id.name }
26 </td>
27 <td width="49%" align="right">
28 Printed at: ${ formatLang(time.strftime('%Y-%m-%d'),date=True) } at ${ time.strftime('%H:%M:%S') }
29 </td>
30 <td width="1%"></td>
31 </tr>
32 <tr>
33 <td></td>
34 <td>
35 <b>Analysis from</b> ${ formatLang(data['form']['date_from'],date=True) } to ${ formatLang(data['form']['date_to'],date=True) }
36 </td>
37 <td align="right">
38 <b>Budget :</b> <font color="Blue">${ o.name }</font>
39
40 </td>
41 <td></td>
42 </tr>
43 </table>
44 <br/>
45 <br/>
46 <table width="100%" class="list_table">
47
48 <tr >
49 <td width="40%" >
50 <b>
51 ${_('Description')}
52 </b>
53 </td>
54 <td width="15%" align="right">
55 <b>
56 ${_('Theoretical Amt')}
57 </b>
58 </td>
59 <td width="12%" align="right">
60 <b>
61 ${_('Planned Amt')}
62 </b>
63 </td>
64 <td width="13%" align="right">
65 <b>
66 ${_('Practical Amt')}
67 </b>
68 </td>
69 <td width="10%" align="right">
70 <b>
71 ${_('Perc(%)')}
72 </b>
73 </td>
74 </tr>
75 </table>
76
77 %for a in funct(o,data['form']):
78 <table width="100%" style="border-bottom: 1px solid #ccc !important;text-align:left;font-size:12;">
79 <tr>
80 <td width="40%">
81 %if a['status'] == 1 :
82 ${a['name']}
83 %endif
84 %if a['status'] == 2:
85 <p style="padding-left:12px;">${a['name']} </p>
86 %endif
87 </td>
88 <td align="right" width="15%">
89 ${formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
90 </td>
91 <td align="right" width="12%">
92 ${formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
93 </td>
94 <td align="right" width="13%">
95 ${formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
96 </td>
97 <td width="10%" align="right">
98 ${formatLang(a['perc'], digits=2) }
99 </td>
100
101 </tr>
102
103 </table>
104 %endfor
105 %for b in funct_total(data['form']):
106 <table width="100%" class="top">
107 <tr>
108 <td width="40%">
109 Total:
110 </td>
111 <td width="15%" align="right">
112 ${ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
113 </td>
114 <td width="12%" align="right">
115 ${ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
116 </td>
117 <td width="13%" align="right">
118 ${ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
119 </td>
120 <td width="10%" align="right">
121 ${ formatLang(b['tot_perc'], digits=2) }%
122 </td>
123 </tr>
124 </table>
125 %endfor
126 <p style="page-break-after:always">
127 </p>
128
129%endfor
130</body>
131</html>
0\ No newline at end of file132\ No newline at end of file
1133
=== added file 'account_budget_webkit/report/budget_report.py'
--- account_budget_webkit/report/budget_report.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/budget_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,192 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import time
23from openerp.report import report_sxw
24
25tot = {}
26
27class budget_report(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(budget_report, self).__init__(cr, uid, name, context=context)
30 self.localcontext.update({
31 'funct': self.funct,
32 'funct_total': self.funct_total,
33 'time': time,
34 })
35 self.context = context
36
37 def funct(self, object, form, ids=None, done=None, level=1):
38 if ids is None:
39 ids = {}
40 if not ids:
41 ids = self.ids
42 if not done:
43 done = {}
44 global tot
45 tot = {
46 'theo':0.00,
47 'pln':0.00,
48 'prac':0.00,
49 'perc':0.00
50 }
51 result = []
52
53 budgets = self.pool.get('account.budget.post').browse(self.cr, self.uid, [object.id], self.context.copy())
54 c_b_lines_obj = self.pool.get('crossovered.budget.lines')
55 acc_analytic_obj = self.pool.get('account.analytic.account')
56 for budget_id in budgets:
57 res = {}
58 budget_ids = []
59 d_from = form['date_from']
60 d_to = form['date_to']
61
62 for line in budget_id.crossovered_budget_line:
63 budget_ids.append(line.id)
64
65 if not budget_ids:
66 return []
67 self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
68 an_ids = self.cr.fetchall()
69
70 context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
71 for i in range(0, len(an_ids)):
72 if not an_ids[i][0]:
73 continue
74 analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
75 res={
76 'b_id': '-1',
77 'a_id': '-1',
78 'name': analytic_name[0].name,
79 'status': 1,
80 'theo': 0.00,
81 'pln': 0.00,
82 'prac': 0.00,
83 'perc': 0.00
84 }
85 result.append(res)
86
87 line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
88 line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
89 tot_theo = tot_pln = tot_prac = tot_perc = 0.00
90
91 done_budget = []
92 for line in line_id:
93 if line.id in budget_ids:
94 theo = pract = 0.00
95 theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
96 pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
97 if line.general_budget_id.id in done_budget:
98 for record in result:
99 if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
100 record['theo'] += theo
101 record['pln'] += line.planned_amount
102 record['prac'] += pract
103 if record['theo'] <> 0.00:
104 perc = (record['prac'] / record['theo']) * 100
105 else:
106 perc = 0.00
107 record['perc'] = perc
108 tot_theo += theo
109 tot_pln += line.planned_amount
110 tot_prac += pract
111 tot_perc += perc
112 else:
113 if theo <> 0.00:
114 perc = (pract / theo) * 100
115 else:
116 perc = 0.00
117 res1 = {
118 'a_id': line.analytic_account_id.id,
119 'b_id': line.general_budget_id.id,
120 'name': line.general_budget_id.name,
121 'status': 2,
122 'theo': theo,
123 'pln': line.planned_amount,
124 'prac': pract,
125 'perc': perc,
126 }
127 tot_theo += theo
128 tot_pln += line.planned_amount
129 tot_prac += pract
130 tot_perc += perc
131 if form['report'] == 'analytic-full':
132 result.append(res1)
133 done_budget.append(line.general_budget_id.id)
134 else:
135
136 if line.general_budget_id.id in done_budget:
137 continue
138 else:
139 res1={
140 'a_id': line.analytic_account_id.id,
141 'b_id': line.general_budget_id.id,
142 'name': line.general_budget_id.name,
143 'status': 2,
144 'theo': 0.00,
145 'pln': 0.00,
146 'prac': 0.00,
147 'perc': 0.00
148 }
149 if form['report'] == 'analytic-full':
150 result.append(res1)
151 done_budget.append(line.general_budget_id.id)
152 if tot_theo == 0.00:
153 tot_perc = 0.00
154 else:
155 tot_perc = float(tot_prac / tot_theo) * 100
156 if form['report'] == 'analytic-full':
157 result[-(len(done_budget) +1)]['theo'] = tot_theo
158 tot['theo'] += tot_theo
159 result[-(len(done_budget) +1)]['pln'] = tot_pln
160 tot['pln'] += tot_pln
161 result[-(len(done_budget) +1)]['prac'] = tot_prac
162 tot['prac'] += tot_prac
163 result[-(len(done_budget) +1)]['perc'] = tot_perc
164 else:
165 result[-1]['theo'] = tot_theo
166 tot['theo'] += tot_theo
167 result[-1]['pln'] = tot_pln
168 tot['pln'] += tot_pln
169 result[-1]['prac'] = tot_prac
170 tot['prac'] += tot_prac
171 result[-1]['perc'] = tot_perc
172 if tot['theo'] == 0.00:
173 tot['perc'] = 0.00
174 else:
175 tot['perc'] = float(tot['prac'] / tot['theo']) * 100
176 return result
177
178 def funct_total(self, form):
179 result = []
180 res = {}
181 res = {
182 'tot_theo': tot['theo'],
183 'tot_pln': tot['pln'],
184 'tot_prac': tot['prac'],
185 'tot_perc': tot['perc']
186 }
187 result.append(res)
188 return result
189
190report_sxw.report_sxw('report.account.budget.webkit', 'account.budget.post', 'account_budget_webkit/report/budget_report.mako', parser=budget_report, header='internal')
191
192# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0193
=== added file 'account_budget_webkit/report/crossovered_budget_report.mako'
--- account_budget_webkit/report/crossovered_budget_report.mako 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/crossovered_budget_report.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,128 @@
1<html>
2 <head>
3 <style type="text/css">
4 ${css}
5 </style>
6 </head>
7<body>
8</br>
9</br>
10</br>
11 %for o in objects:
12 <br/>
13 <table width="100%">
14 <tr>
15 <td align="center">
16 <h4>
17 <b> Budget </b></h4>
18 </td>
19 </tr>
20 </table>
21 <br/>
22 <table width="100%" class="basic_table">
23 <tr>
24 <td>
25 ${_('Analysis from')}
26 </td>
27 <td>
28 ${_('Budget')}
29 </td>
30 <td>
31 ${_('Currency')}
32 </td>
33 </tr>
34 <tr>
35 <td>
36 ${ formatLang(data['form']['date_from'],date=True) } to ${ formatLang(data['form']['date_to'],date=True) }
37 </td>
38 <td>
39 ${ o.name }
40 </td>
41 <td>
42 ${ company.currency_id.name }
43 </td>
44 </tr>
45 </table>
46 <br/>
47 <br/>
48 <table width="100%" class="list_table">
49
50 <tr >
51 <td width="40%" >
52 <b>
53 ${_('Description')}
54 </b>
55 </td>
56 <td width="15%" align="right">
57 <b>
58 ${_('Theoretical Amt')}
59 </b>
60 </td>
61 <td width="12%" align="right">
62 <b>
63 ${_('Planned Amt')}
64 </b>
65 </td>
66 <td width="13%" align="right">
67 <b>
68 ${_('Practical Amt')}
69 </b>
70 </td>
71 <td width="10%" align="right">
72 <b>
73 ${_('Perc(%)')}
74 </b>
75 </td>
76 </tr>
77 </table>
78 %for a in funct(o,data['form']):
79 <table width="100%" style="border-bottom: 1px solid #ccc !important;text-align:left;font-size:12;">
80 <tr>
81 <td width="40%">
82 %if a['status'] == 1 :
83 ${a['name']}
84 %endif
85 %if a['status'] == 2:
86 <p style="padding-left:12px;">${a['name']} </p>
87 %endif
88 </td>
89 <td align="right" width="15%">
90 ${formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
91 </td>
92 <td align="right" width="12%">
93 ${formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
94 </td>
95 <td align="right" width="13%">
96 ${formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
97 </td>
98 <td width="10%" align="right">
99 ${formatLang(a['perc'], digits=2) }
100 </td>
101 </tr>
102 </table>
103 %endfor
104 %for b in funct_total(data['form']):
105 <table width="100%" class="top">
106 <tr>
107 <td width="40%">
108 Total:
109 </td>
110 <td width="15%" align="right">
111 ${ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
112 </td>
113 <td width="12%" align="right">
114 ${ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
115 </td>
116 <td width="13%" align="right">
117 ${ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
118 </td>
119 <td width="10%" align="right">
120 ${ formatLang(b['tot_perc'], digits=2) }%
121 </td>
122 </tr>
123 </table>
124 %endfor
125 <p style="page-break-after:always">
126 </p>
127%endfor
128</body>
0\ No newline at end of file129\ No newline at end of file
1130
=== added file 'account_budget_webkit/report/crossovered_budget_report.py'
--- account_budget_webkit/report/crossovered_budget_report.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/report/crossovered_budget_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,197 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21import time
22import datetime
23
24from openerp import pooler
25from openerp.report import report_sxw
26import operator
27from openerp import osv
28
29class budget_report(report_sxw.rml_parse):
30 def __init__(self, cr, uid, name, context):
31 super(budget_report, self).__init__(cr, uid, name, context=context)
32 self.localcontext.update({
33 'funct': self.funct,
34 'funct_total': self.funct_total,
35 'time': time,
36 })
37 self.context = context
38
39 def funct(self, object, form, ids=None, done=None, level=1):
40 if ids is None:
41 ids = {}
42 if not ids:
43 ids = self.ids
44 if not done:
45 done = {}
46 global tot
47 tot = {
48 'theo':0.00,
49 'pln':0.00,
50 'prac':0.00,
51 'perc':0.00
52 }
53 result = []
54
55 budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy())
56 c_b_lines_obj = self.pool.get('crossovered.budget.lines')
57 acc_analytic_obj = self.pool.get('account.analytic.account')
58 for budget_id in budgets:
59 res = {}
60 budget_lines = []
61 budget_ids = []
62 d_from = form['date_from']
63 d_to = form['date_to']
64
65 for line in budget_id.crossovered_budget_line:
66 budget_ids.append(line.id)
67
68 if not budget_ids:
69 return []
70
71 self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
72 an_ids = self.cr.fetchall()
73
74 context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
75 for i in range(0, len(an_ids)):
76 if not an_ids[i][0]:
77 continue
78 analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
79 res={
80 'b_id': '-1',
81 'a_id': '-1',
82 'name': analytic_name[0].name,
83 'status': 1,
84 'theo': 0.00,
85 'pln': 0.00,
86 'prac': 0.00,
87 'perc': 0.00
88 }
89 result.append(res)
90
91 line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
92 line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
93 tot_theo = tot_pln = tot_prac = tot_perc = 0.00
94
95 done_budget = []
96 for line in line_id:
97 if line.id in budget_ids:
98 theo = pract = 0.00
99 theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
100 pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
101 if line.general_budget_id.id in done_budget:
102 for record in result:
103 if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
104 record['theo'] += theo
105 record['pln'] += line.planned_amount
106 record['prac'] += pract
107 if record['theo'] <> 0.00:
108 perc = (record['prac'] / record['theo']) * 100
109 else:
110 perc = 0.00
111 record['perc'] = perc
112 tot_theo += theo
113 tot_pln += line.planned_amount
114 tot_prac += pract
115 tot_perc += perc
116 else:
117 if theo <> 0.00:
118 perc = (pract / theo) * 100
119 else:
120 perc = 0.00
121 res1 = {
122 'a_id': line.analytic_account_id.id,
123 'b_id': line.general_budget_id.id,
124 'name': line.general_budget_id.name,
125 'status': 2,
126 'theo': theo,
127 'pln': line.planned_amount,
128 'prac': pract,
129 'perc': perc,
130 }
131 tot_theo += theo
132 tot_pln += line.planned_amount
133 tot_prac += pract
134 tot_perc += perc
135 if form['report'] == 'analytic-full':
136 result.append(res1)
137 done_budget.append(line.general_budget_id.id)
138 else:
139
140 if line.general_budget_id.id in done_budget:
141 continue
142 else:
143 res1={
144 'a_id': line.analytic_account_id.id,
145 'b_id': line.general_budget_id.id,
146 'name': line.general_budget_id.name,
147 'status': 2,
148 'theo': 0.00,
149 'pln': 0.00,
150 'prac': 0.00,
151 'perc': 0.00
152 }
153 if form['report'] == 'analytic-full':
154 result.append(res1)
155 done_budget.append(line.general_budget_id.id)
156 if tot_theo == 0.00:
157 tot_perc = 0.00
158 else:
159 tot_perc = float(tot_prac / tot_theo) * 100
160 if form['report'] == 'analytic-full':
161 result[-(len(done_budget) +1)]['theo'] = tot_theo
162 tot['theo'] += tot_theo
163 result[-(len(done_budget) +1)]['pln'] = tot_pln
164 tot['pln'] += tot_pln
165 result[-(len(done_budget) +1)]['prac'] = tot_prac
166 tot['prac'] += tot_prac
167 result[-(len(done_budget) +1)]['perc'] = tot_perc
168 else:
169 result[-1]['theo'] = tot_theo
170 tot['theo'] += tot_theo
171 result[-1]['pln'] = tot_pln
172 tot['pln'] += tot_pln
173 result[-1]['prac'] = tot_prac
174 tot['prac'] += tot_prac
175 result[-1]['perc'] = tot_perc
176 if tot['theo'] == 0.00:
177 tot['perc'] = 0.00
178 else:
179 tot['perc'] = float(tot['prac'] / tot['theo']) * 100
180 return result
181
182 def funct_total(self, form):
183 result = []
184 res = {}
185 res = {
186 'tot_theo': tot['theo'],
187 'tot_pln': tot['pln'],
188 'tot_prac': tot['prac'],
189 'tot_perc': tot['perc']
190 }
191 result.append(res)
192 return result
193
194report_sxw.report_sxw('report.crossovered.budget.report.webkit', 'crossovered.budget', 'account_budget_webkit/report/crossovered_budget_report.mako',parser=budget_report,header='internal')
195
196# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
197
0198
=== added directory 'account_budget_webkit/wizard'
=== added file 'account_budget_webkit/wizard/__init__.py'
--- account_budget_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/wizard/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,27 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import account_budget_crossovered_report
23import account_budget_analytic
24import account_budget_crossovered_summary_report
25import account_budget_report
26# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
27
028
=== added file 'account_budget_webkit/wizard/account_budget_analytic.py'
--- account_budget_webkit/wizard/account_budget_analytic.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/wizard/account_budget_analytic.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,37 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21import time
22
23from openerp.osv import fields, osv
24
25class account_budget_analytic(osv.osv_memory):
26
27 _inherit = "account.budget.analytic"
28
29 def check_report(self, cr, uid, ids, context=None):
30
31 res = super(account_budget_analytic,self).check_report( cr, uid, ids, context=context)
32 res['report_name']= 'account.analytic.account.budget.webkit'
33 return res
34
35account_budget_analytic()
36
37# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
038
=== added file 'account_budget_webkit/wizard/account_budget_crossovered_report.py'
--- account_budget_webkit/wizard/account_budget_crossovered_report.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/wizard/account_budget_crossovered_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,37 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21import time
22
23from openerp.osv import fields, osv
24
25class account_budget_crossvered_report(osv.osv_memory):
26
27 _inherit="account.budget.crossvered.report"
28
29 def check_report(self, cr, uid, ids, context=None):
30
31 res = super(account_budget_crossvered_report,self).check_report( cr, uid, ids, context=context)
32 res['report_name']= 'crossovered.budget.report.webkit'
33 return res
34
35account_budget_crossvered_report()
36
37# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
038
=== added file 'account_budget_webkit/wizard/account_budget_crossovered_summary_report.py'
--- account_budget_webkit/wizard/account_budget_crossovered_summary_report.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/wizard/account_budget_crossovered_summary_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,40 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21import time
22
23from openerp.osv import fields, osv
24
25class account_budget_crossvered_summary_report(osv.osv_memory):
26 """
27 This wizard provides the crossovered budget summary report'
28 """
29 _inherit = "account.budget.crossvered.summary.report"
30
31 def check_report(self, cr, uid, ids, context=None):
32
33 res = super(account_budget_crossvered_summary_report,self).check_report( cr, uid, ids, context=context)
34 res['report_name']= 'crossovered.budget.report.webkit'
35 return res
36
37account_budget_crossvered_summary_report()
38
39# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
40
041
=== added file 'account_budget_webkit/wizard/account_budget_report.py'
--- account_budget_webkit/wizard/account_budget_report.py 1970-01-01 00:00:00 +0000
+++ account_budget_webkit/wizard/account_budget_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,38 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21import time
22
23from openerp.osv import fields, osv
24
25
26class account_budget_report(osv.osv_memory):
27 _inherit = "account.budget.report"
28
29 def check_report(self, cr, uid, ids, context=None):
30
31 res = super(account_budget_report,self).check_report( cr, uid, ids, context=context)
32 res['report_name']= 'account.budget.webkit'
33 return res
34
35
36account_budget_report()
37
38# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
039
=== added directory 'account_test_webkit'
=== added file 'account_test_webkit/__init__.py'
--- account_test_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ account_test_webkit/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import report
023
=== added file 'account_test_webkit/__openerp__.py'
--- account_test_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_test_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,41 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22{
23 'name' : 'Accounting Consistency Tests',
24 'version' : '1.0',
25 'author' : 'Serpent Consulting Services',
26 'category' : 'Accounting & Finance',
27 'website': 'http://www.serpentcs.com',
28 'description': """
29Asserts on accounting.
30======================
31It is conversion of rml report to Webkit Report.
32
33""",
34 'depends' : ['account_test','report_webkit'],
35 'data' : [
36 'account_test_report.xml',
37 ],
38 'active': False,
39 'installable': True
40}
41# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
042
=== added file 'account_test_webkit/account_test_report.xml'
--- account_test_webkit/account_test_report.xml 1970-01-01 00:00:00 +0000
+++ account_test_webkit/account_test_report.xml 2013-10-10 09:47:29 +0000
@@ -0,0 +1,26 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3<data>
4 <record id="account_test_header" model="ir.header_webkit">
5 <field name="footer_html"><![CDATA[]]></field>
6 <field name="orientation">Portrait</field>
7 <field name="format">A4</field>
8 <field name="html"><![CDATA[]]>
9 </field>
10 <field eval="15.0" name="margin_top"/>
11 <field eval="5.0" name="margin_bottom"/>
12 <field name="css"><![CDATA[ ]]>
13 </field>
14 <field name="name">Account Test webkit header</field>
15 </record>
16
17 <report
18 id="account_assert_test_report"
19 model="accounting.assert.test"
20 name="account.test.assert.print.webkit"
21 file="account_test_webkit/report/account_test.mako"
22 webkit_header="account_test_header"
23 report_type="webkit"
24 string="Accounting Tests"/>
25</data>
26</openerp>
027
=== added directory 'account_test_webkit/report'
=== added file 'account_test_webkit/report/__init__.py'
--- account_test_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_test_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import account_test_report
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'account_test_webkit/report/account_test.mako'
--- account_test_webkit/report/account_test.mako 1970-01-01 00:00:00 +0000
+++ account_test_webkit/report/account_test.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,53 @@
1<html>
2<head>
3 <style type="text/css">
4 .list_table2 {
5 text-align:left;
6 border-collapse: collapse;
7 }
8 .list_table2 td {
9 border:1px solid black;
10 border-collapse: collapse;
11 font-family:"Times New Roman";
12 font-size:12px;
13 padding: 5px 5px 5px 5px;
14 }
15
16 </style>
17 <title>Account_Test.pdf</title>
18</head>
19<body>
20<table width="100%" style="font-family: Times New Roman ;font-size:20px;">
21 <tr>
22 <td align="center">
23 Accouting tests on ${ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") }
24 </td>
25 </tr>
26</table>
27</br>
28%for o in objects:
29 <table width="100%" class="list_table2">
30 <tr>
31 <td>
32 ${o.name}
33 </td>
34 </tr>
35 <tr>
36 <td>
37 <i>${ o.desc or '' }</i>
38 </td>
39 </tr>
40 </table>
41 <table width="100%" style="font-family: Times New Roman;font-size:12px;">
42 %for test_result in execute_code(o.code_exec):
43 <tr>
44 <td>
45 ${ test_result }
46 </td>
47 </tr>
48 %endfor
49 </table>
50 </br>
51%endfor
52</body>
53</html>
0\ No newline at end of file54\ No newline at end of file
155
=== added file 'account_test_webkit/report/account_test_report.py'
--- account_test_webkit/report/account_test_report.py 1970-01-01 00:00:00 +0000
+++ account_test_webkit/report/account_test_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,88 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22
23import datetime
24import time
25from report import report_sxw
26from openerp.tools.translate import _
27#
28# Use period and Journal for selection or resources
29#
30class report_assert_account(report_sxw.rml_parse):
31 def __init__(self, cr, uid, name, context):
32 super(report_assert_account, self).__init__(cr, uid, name, context=context)
33 self.localcontext.update( {
34 'time': time,
35 'datetime': datetime,
36 'execute_code': self.execute_code,
37 })
38
39 def execute_code(self, code_exec):
40 def reconciled_inv():
41 """
42 returns the list of invoices that are set as reconciled = True
43 """
44 return self.pool.get('account.invoice').search(self.cr, self.uid, [('reconciled','=',True)])
45
46 def order_columns(item, cols=None):
47 """
48 This function is used to display a dictionary as a string, with its columns in the order chosen.
49
50 :param item: dict
51 :param cols: list of field names
52 :returns: a list of tuples (fieldname: value) in a similar way that would dict.items() do except that the
53 returned values are following the order given by cols
54 :rtype: [(key, value)]
55 """
56 if cols is None:
57 cols = item.keys()
58 return [(col, item.get(col)) for col in cols if col in item.keys()]
59
60 localdict = {
61 'cr': self.cr,
62 'uid': self.uid,
63 'reconciled_inv': reconciled_inv, #specific function used in different tests
64 'result': None, #used to store the result of the test
65 'column_order': None, #used to choose the display order of columns (in case you are returning a list of dict)
66 }
67 exec code_exec in localdict
68 result = localdict['result']
69 column_order = localdict.get('column_order', None)
70
71 if not isinstance(result, (tuple, list, set)):
72 result = [result]
73 if not result:
74 result = [_('The test was passed successfully')]
75 else:
76 def _format(item):
77 if isinstance(item, dict):
78 return ', '.join(["%s: %s" % (tup[0], tup[1]) for tup in order_columns(item, column_order)])
79 else:
80 return item
81 result = [_(_format(rec)) for rec in result]
82
83 return result
84
85report_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)
86
87
88# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
089
=== added directory 'account_voucher_webkit'
=== added file 'account_voucher_webkit/__init__.py'
--- account_voucher_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21##############################################################################
22
23import report
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
026
=== added file 'account_voucher_webkit/__openerp__.py'
--- account_voucher_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,45 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21##############################################################################
22
23{
24 'name' : 'eInvoicing & Payments',
25 'version' : '1.0',
26 'author' : 'Serpent Consulting Services',
27 'summary': 'Send Invoices and Track Payments',
28 'description': """
29Invoicing & Payments by Accounting Voucher & Receipts
30=====================================================
31 It is conversion of rml report to Webkit Report.
32 """,
33 'category': 'Accounting & Finance',
34 'sequence': 4,
35 'website' : 'http://serpentcs.com',
36 'depends' : ['account_voucher','report_webkit'],
37 'data' : [
38 'account_voucher_report.xml',
39 ],
40 'auto_install': False,
41 'application': True,
42 'installable': True,
43}
44
45# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
046
=== added file 'account_voucher_webkit/account_voucher_report.xml'
--- account_voucher_webkit/account_voucher_report.xml 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/account_voucher_report.xml 2013-10-10 09:47:29 +0000
@@ -0,0 +1,159 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="voucher_header" model="ir.header_webkit">
5 <field name="footer_html"><![CDATA[
6 <html>
7 <head>
8 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
9 <script>
10 function subst() {
11 var vars={};
12 var x=document.location.search.substring(1).split('&');
13 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
14 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
15 for(var i in x) {
16 var y = document.getElementsByClassName(x[i]);
17 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
18 }
19 }
20 </script>
21 <style type="text/css">
22
23 ${css}
24 </style>
25 </head>
26 <body style="border:0; margin: 0;" onload="subst()">
27 <table class="header" style="border-top: 1px solid black; width: 100%">
28 <tr >
29 <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
30 </tr>
31 <tr >
32 <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
33 </tr>
34 </table> ${_debug or ''|n} </body>
35 </html>
36 ]]></field>
37 <field name="orientation">Portrait</field>
38 <field name="format">A4</field>
39 <field name="html"><![CDATA[
40 <html>
41 <head>
42 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
43 <script>
44 function subst() {
45 var vars={};
46 var x=document.location.search.substring(1).split('&');
47 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
48 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
49 for(var i in x) {
50 var y = document.getElementsByClassName(x[i]);
51 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
52 }
53 }
54 </script>
55 <style type="text/css">
56
57 ${css}
58 </style>
59 </head>
60 <body style="border:0; margin: 0;" onload="subst()">
61
62 </html>]]>
63 </field>
64 <field eval="17.0" name="margin_top"/>
65 <field eval="25.0" name="margin_bottom"/>
66 <field name="css"><![CDATA[
67
68 body, table, td, span, div {
69 font-family: Helvetica;
70 }
71
72 body {
73
74 font-size:9;
75
76 }
77
78
79 .header {
80 margin-left:0;
81 text-align:left;
82 width:300px;
83 font-size:12;
84 }
85 .title {
86 font-size:16px;
87 width:100%;
88 font-weight: bold;
89 font-family: Helvetica;
90 text-align:center;
91 padding-bottom:20px;
92 }
93
94 .tbl_header{
95 width:100%;
96 font-size:12px;
97 font-family: Helvetica;
98 }
99 .tbl_grey_line {
100 width:100%;
101 border:1px solid Grey;
102 border-collapse: collapse;
103 font-family: Helvetica;
104 padding-bottom:20px;
105 }
106 .tbl_grey_line td{
107 border:1px solid Grey;
108 font-size:11px;
109 font-family: Helvetica;
110 }
111 .tbl_line{
112 width:100%;
113 font-size:12px;
114 font-family: Helvetica;
115 font-weight: bold;
116 border:1px solid grey;
117 border-left:0px;
118 border-right:0px;
119 }
120
121 .font{
122 width:100%;
123 font-size:12px;
124 font-family:Helvetica;
125 }
126 .font tr{
127 padding-top:10px;
128 }
129 .font td{
130 padding-top:5px;
131 }
132 ]]>
133 </field>
134 <field name="name">Voucher Header</field>
135 </record>
136
137 <report id="report_account_voucher"
138 string="Voucher"
139 model="account.voucher"
140 name="voucher.cash_receipt.drcr.webkit"
141 file="account_voucher_webkit/report/account_voucher.mako"
142 auto="False"
143 report_type="webkit"
144 webkit_header="voucher_header"
145 menu="True"/>
146
147<!-- This report is awfull so it's better to hide it -->
148
149 <report id="report_account_voucher_print"
150 string="Voucher Print"
151 model="account.voucher"
152 name="voucher.print.webkit"
153 file="account_voucher_webkit/report/account_voucher_print.mako"
154 auto="False"
155 menu="True"
156 report_type="webkit"
157 webkit_header="voucher_header"/>
158 </data>
159</openerp>
0160
=== added directory 'account_voucher_webkit/report'
=== added file 'account_voucher_webkit/report/.~lock.account_voucher_print.sxw#'
--- account_voucher_webkit/report/.~lock.account_voucher_print.sxw# 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/report/.~lock.account_voucher_print.sxw# 2013-10-10 09:47:29 +0000
@@ -0,0 +1,1 @@
1serpentcs ,serpentcs,serpentcs-desktop,17.09.2013 13:01,file:///home/serpentcs/.libreoffice/3;
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'account_voucher_webkit/report/__init__.py'
--- account_voucher_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,26 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21##############################################################################
22
23import account_voucher
24import account_voucher_print
25
26# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
027
=== added file 'account_voucher_webkit/report/account_voucher.mako'
--- account_voucher_webkit/report/account_voucher.mako 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/report/account_voucher.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,160 @@
1<html>
2 <head>
3 <style type="text/css">
4 ${css}
5 </style>
6 </head>
7 <body>
8 %for voucher in objects:
9 <table class="title">
10 <tr>
11 <td>
12 ${get_title(voucher.type)}
13 </td>
14 </tr>
15 </table>
16 <table class="tbl_grey_line">
17 <tr>
18 <td width="20%"><b>
19 ${_('Journal:')}</b>
20 </td>
21 <td colspan="3" width="30%">
22 ${ voucher.type}
23 </td>
24 <td width="20%">
25 <b>${_('Number:')}</b>
26 </td>
27 <td width="30%">
28 ${ voucher.number }
29 </td>
30 </tr>
31 <tr>
32 <td>
33 <b> ${_('Status:')} </b>
34 </td>
35 <td width="10%">
36 %if voucher.state == 'proforma':
37 PRO-FORMA
38 %endif
39 %if voucher.state == 'draft':
40 Draft
41 %endif
42 %if voucher.state == 'cancel':
43 Canceled
44 %endif
45 %if voucher.state == 'posted':
46 Posted
47 %endif
48 </td>
49 <td width="10%">
50 <b>${_('Ref. :')}</b>
51 </td>
52 <td width="10%">
53 ${ voucher.reference or '' }
54 </td>
55 <td>
56 <b>${_('Date:')}</b>
57 </td>
58 <td>
59 ${ formatLang(voucher.date , date=True) or '' }
60 </td>
61 </tr>
62 </table>
63 </br>
64 <table class="tbl_line">
65 <tr>
66 <td width="50%">
67 ${_('Particulars')}
68 </td>
69 <td width="25%" align="right">
70 ${_('Debit')}
71 </td>
72 <td width="25%" align="right">
73 ${_('Credit')}
74 </td>
75 </tr>
76 </table>
77 <table class="font">
78 %for move_ids in voucher.move_ids:
79 <tr>
80 <td style="padding-left:5px" width="50%">
81 <b> ${ (move_ids.partner_id and move_ids.partner_id.name) or 'Account' }</b>
82 </td>
83 <td style="padding-left:15px" width="25%" align="right">
84 ${ formatLang(move_ids.debit) }
85 </td>
86 <td style="padding-left:15px" width="25%" align="right">
87 ${ formatLang(move_ids.credit) }
88 </td>
89 </tr>
90 <tr>
91 <td colspan="3" style="padding-left:15px">
92 ${ move_ids.account_id.name }
93 </td>
94 </tr>
95 <tr>
96 <td colspan="3" style="padding-left:15px" width="25%">
97 <i>${ move_ids.name } - ${ get_ref(voucher.id,move_ids) }</i>
98 </td>
99 </tr>
100 %endfor
101 <tr>
102 <td colspan="3">
103 <b>${_('Through :')}
104 </td>
105 </tr>
106 <tr>
107 <td colspan="3" style="padding-left:15px" >
108 ${ voucher.narration or ''}
109 </td>
110 </tr>
111 <tr>
112 <td colspan="3" >
113 <b>${_('On Account of : ')}</b>
114 </td>
115 </tr>
116 <tr>
117 <td colspan="3" style="padding-left:15px >
118 ${ voucher.name or ''}
119 </td>
120 </tr>
121 <tr >
122 <td colspan="3">
123 <b> ${_('Amount (in words) :') }</b>
124 </td>
125 </tr>
126 <tr>
127 <td style="padding-left:15px">
128 ${ convert(voucher.amount,voucher.currency_id.name) or '' }
129 </td>
130 <td></td><td></td>
131 </tr>
132 </table>
133 <table class="tbl_line">
134 <tr>
135 <td width="50%">
136
137 </td>
138 <td width="25%" align="right" >
139 ${ debit(voucher.move_ids)}
140 </td>
141 <td width="25%" align="right">
142 ${ credit(voucher.move_ids)}
143 </td>
144 </tr>
145 <table>
146 </br>
147 <table class="tbl_header">
148 <tr>
149 <td width="50%">
150 Receiver's Signature
151 </td>
152 <td align="right" width="50%">
153 Authorised Signatory
154 </td>
155 </tr>
156 </table>
157 <p style="page-break-after:always"></p>
158 %endfor
159 </body>
160</html>
0\ No newline at end of file161\ No newline at end of file
1162
=== added file 'account_voucher_webkit/report/account_voucher.py'
--- account_voucher_webkit/report/account_voucher.py 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/report/account_voucher.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,77 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21##############################################################################
22
23import time
24from openerp.report import report_sxw
25from openerp.tools import amount_to_text_en
26
27class report_voucher(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(report_voucher, self).__init__(cr, uid, name, context)
30 self.localcontext.update({
31 'time': time,
32 'convert':self.convert,
33 'get_title': self.get_title,
34 'debit':self.debit,
35 'credit':self.credit,
36 'get_ref': self._get_ref
37 })
38
39 def convert(self, amount, cur):
40 amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
41 return amt_en
42
43 def get_title(self, type):
44
45 title = ''
46 if type:
47 title = type[0].swapcase() + type[1:] + " Voucher"
48 return title
49
50 def debit(self, move_ids):
51 debit = 0.0
52 for move in move_ids:
53 debit += move.debit
54 return debit
55
56 def credit(self, move_ids):
57 credit = 0.0
58 for move in move_ids:
59 credit += move.credit
60 return credit
61
62 def _get_ref(self, voucher_id, move_ids):
63 voucher_line_obj = self.pool.get('account.voucher.line')
64 voucher_line = voucher_line_obj.search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)])
65 if voucher_line:
66 voucher = voucher_line_obj.browse(self.cr, self.uid, voucher_line)[0]
67 return voucher.name
68 else:
69 return
70report_sxw.report_sxw(
71 'report.voucher.cash_receipt.drcr.webkit',
72 'account.voucher',
73 'addons/account_voucher_webkit/report/account_voucher.mako',
74 parser=report_voucher,header="external"
75)
76
77# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
078
=== added file 'account_voucher_webkit/report/account_voucher_print.mako'
--- account_voucher_webkit/report/account_voucher_print.mako 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/report/account_voucher_print.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,140 @@
1<html>
2 <head>
3 <style type="text/css">
4 ${css}
5 </style>
6 </head>
7 <body>
8 %for voucher in objects:
9 <table class="title">
10 <tr>
11 <td>
12 ${ get_title(voucher.type) }
13 </td>
14 </tr>
15 </table>
16 <table class="tbl_header">
17 <tr>
18 <td width="10%">
19 <b>${_('Number:')}</b>
20 </td>
21 <td width="40%">
22 ${_('voucher.number')}
23 <td align="right" width="40%">
24 <b>${_('Date:')}</b>
25 </td>
26 <td align="right" width="10%">
27 ${ formatLang(voucher.date , date=True) or '' }
28 </td>
29 </tr>
30 <tr>
31 <td width="10%">
32 <b> ${_('Status:')}</b>
33 </td>
34 <td width="40%">
35 %if voucher.state == 'proforma':
36 PRO-FORMA
37 %endif
38 %if voucher.state == 'draft':
39 Draft
40 %endif
41 %if voucher.state == 'cancel':
42 Canceled
43 %endif
44 %if voucher.state == 'posted':
45 Posted
46 %endif
47 </td>
48 <td align="right" width="40%">
49 <b>${_('Currency:')}</b>
50 </td>
51 <td align="right" width="10%">
52 ${ voucher.currency_id.symbol }
53 </td>
54 </tr>
55 </table>
56 </br>
57 <table class="tbl_line">
58 <tr width="70%">
59 <td>
60 ${_('Particulars')}
61 </td>
62 <td width="30%" align="right">
63 ${_('Amount')}
64 </td>
65 </tr>
66 </table>
67
68 <table class="font">
69 %for p in get_lines(voucher):
70 <tr>
71 <td width="70%" style="padding-left:5px"><b>
72 ${_('Account :')}</b>
73 </td>
74 </tr>
75
76 <tr>
77 <td style="padding-left:10px">
78 ${ p['pname'] }
79 </td>
80 <td align="right">
81 ${ formatLang(p['amount'], currency_obj=voucher.currency_id) }
82 </td>
83 </tr>
84
85 <tr>
86 <td style="padding-left:10px">
87 ${ p['ref'] }
88 </td>
89 </tr>
90 <tr>
91 <td style="padding-left:10px">
92 ${_('Account :')} ${ p['aname']}
93 </td>
94 </tr>
95 %endfor
96 <tr>
97 <td style="padding-left:5px">
98 <b>${_('Through :')}</b>
99 </td>
100 </tr>
101 <tr>
102 <td style="padding-left:10px">
103 ${ voucher.journal_id.name or '' }
104 </td>
105 </tr>
106 <tr>
107 <td style="padding-left:5px">
108 <b>${_('On Account of :')}</b>
109 </td>
110 </tr>
111 <tr>
112 <td style="padding-left:10px">
113 ${ get_on_account(voucher) }
114 </td>
115 </tr>
116 <tr>
117 <td style="padding-left:5px">
118 <b>Amount (in words) :</b>
119 </td>
120 </tr>
121 <tr>
122 <td style="padding-left:10px">
123 ${ convert(voucher.amount,voucher.currency_id.name) }
124 </td>
125 </tr>
126 </table>
127
128 <table class="tbl_line">
129 <tr>
130 <td width="70%">
131 </td>
132 <td align="right" width="30%">
133 ${ formatLang(voucher.amount, currency_obj=voucher.currency_id) }
134 </td>
135 </tr>
136 </table>
137 <p style="page-break-after:always"></p>
138 %endfor
139 </body>
140</html>
0\ No newline at end of file141\ No newline at end of file
1142
=== added file 'account_voucher_webkit/report/account_voucher_print.py'
--- account_voucher_webkit/report/account_voucher_print.py 1970-01-01 00:00:00 +0000
+++ account_voucher_webkit/report/account_voucher_print.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,98 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20
21##############################################################################
22
23import time
24from openerp.report import report_sxw
25from openerp.tools import amount_to_text_en
26
27class report_voucher_print(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(report_voucher_print, self).__init__(cr, uid, name, context)
30 self.localcontext.update({
31 'time': time,
32 'get_title': self.get_title,
33 'get_lines':self.get_lines,
34 'get_on_account':self.get_on_account,
35 'convert':self.convert
36 })
37
38 def convert(self, amount, cur):
39 amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
40 return amt_en
41
42 def get_lines(self, voucher):
43 result = []
44 if voucher.type in ('payment','receipt'):
45 type = voucher.line_ids and voucher.line_ids[0].type or False
46 for move in voucher.move_ids:
47 res = {}
48 amount = move.credit
49 if type == 'dr':
50 amount = move.debit
51 if amount > 0.0:
52 res['pname'] = move.partner_id.name
53 res['ref'] = 'Agst Ref'+" "+str(move.name)
54 res['aname'] = move.account_id.name
55 res['amount'] = amount
56 result.append(res)
57 else:
58 type = voucher.line_ids and voucher.line_ids[0].type or False
59 for move in voucher.move_ids:
60 res = {}
61 amount = move.credit
62 if type == 'dr':
63 amount = move.debit
64 if amount > 0.0:
65 res['pname'] = move.partner_id.name
66 res['ref'] = move.name
67 res['aname'] = move.account_id.name
68 res['amount'] = amount
69 result.append(res)
70 return result
71
72 def get_title(self, type):
73 print "type:::><><><><>",type
74 title = ''
75 if type:
76 title = type[0].swapcase() + type[1:] + " Voucher"
77 return title
78
79 def get_on_account(self, voucher):
80 name = ""
81 if voucher.type == 'receipt':
82 name = "Received cash from "+str(voucher.partner_id.name)
83 elif voucher.type == 'payment':
84 name = "Payment from "+str(voucher.partner_id.name)
85 elif voucher.type == 'sale':
86 name = "Sale to "+str(voucher.partner_id.name)
87 elif voucher.type == 'purchase':
88 name = "Purchase from "+str(voucher.partner_id.name)
89 return name
90
91report_sxw.report_sxw(
92 'report.voucher.print.webkit',
93 'account.voucher',
94 'addons/account_voucher_webkit/report/account_voucher_print.mako',
95 parser=report_voucher_print,header="external"
96)
97
98# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
099
=== added directory 'account_webkit'
=== added file 'account_webkit/__init__.py'
--- account_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ account_webkit/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import report
23import wizard
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
025
=== added file 'account_webkit/__openerp__.py'
--- account_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_webkit/__openerp__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,44 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22{
23 'name' : 'eInvoicing Webkit',
24 'version' : '1.1',
25 'author' : 'Serpent Consulting Services',
26 'category' : 'Accounting & Finance',
27 'description' : """
28Accounting and Financial Management.
29====================================
30 It is conversion of rml report to Webkit Report.
31 """,
32 'website': 'http://www.serpentcs.com',
33 'depends' : ["account", "report_webkit"],
34 'init_xml': [],
35 'update_xml': [
36 'account_report.xml',
37 ],
38 'test': [
39 ],
40 'installable': True,
41 'auto_install': False,
42
43}
44# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
045
=== added file 'account_webkit/account_report.xml'
--- account_webkit/account_report.xml 1970-01-01 00:00:00 +0000
+++ account_webkit/account_report.xml 2013-10-10 09:47:29 +0000
@@ -0,0 +1,658 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="account_tax_webkit_header" model="ir.header_webkit">
6 <field name="footer_html"><![CDATA[]]></field>
7 <field name="orientation">Portrait</field>
8 <field name="format">A4</field>
9 <field name="html"><![CDATA[
10 <html>
11 <head>
12 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
13 <script>
14 function subst() {
15 var vars={};
16 var x=document.location.search.substring(1).split('&');
17 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
18 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
19 for(var i in x) {
20 var y = document.getElementsByClassName(x[i]);
21 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
22 }
23 }
24 </script>
25 <style type="text/css">
26
27 ${css}
28 </style>
29 </head>
30 <body style="border:0; margin: 0;" onload="subst()">
31 <table class="header" style="border-bottom: 1px solid black; width: 100%">
32 <tr >
33 <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
34 <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
35 <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
36 <td style="text-align:left;font-size:12;" width="1%"> /</td>
37 <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
38 </tr>
39 </table> ${_debug or ''|n} </body>
40 </html>]]>
41 </field>
42 <field eval="15.0" name="margin_top"/>
43 <field eval="5.0" name="margin_bottom"/>
44 <field name="css"><![CDATA[
45
46 body, table, td, span, div {
47 font-family: Helvetica, Arial;
48 }
49
50 body {
51 font-family:Arial;
52 font-size:12;
53
54 }
55
56
57 .header {
58 margin-left:0;
59 text-align:left;
60 width:300px;
61 font-size:12;
62 }
63 .title {
64 font-size:16;
65 font-weight: bold;
66
67 }
68
69
70 .basic_table{
71 text-align:center;
72 border:1px solid lightGrey;
73 border-collapse: collapse;
74 }
75 .basic_table td {
76 border:1px solid lightGrey;
77 font-size:12;
78
79
80 }
81
82 .list_table {
83 border-color:black;
84 text-align:center;
85 border-collapse: collapse;
86
87 }
88 .list_table td {
89 border-color:gray;
90 border-top:1px solid gray;
91 text-align:right;
92 font-size:12;
93 padding-left:3px
94 padding-right:3px
95 padding-top:3px
96 padding-bottom:3px
97 }
98
99 .list_table th {
100 border-bottom:2px solid black;
101 text-align:right;
102 font-size:12;
103 font-weight:bold;
104 padding-left:3px
105 padding-right:3px
106 }
107
108 .list_tabe thead {
109 display:table-header-group;
110 }
111
112
113 .total {
114 width:100%;
115 }
116 .lib {
117 width:10.3%;
118 }
119 .tot {
120 text-align:left;
121 width:15%;
122 }
123 .righttot {
124 width:74%;
125 }
126 .tax {
127 width:50%;
128 }
129
130 .cell{
131 border-spacing: 0;
132 border-collapse: collapse;
133 border-style:solid;
134 border: 1px solid grey;
135 font-size:10px;
136 text-align:center;
137 }
138
139 .tbl_header{
140 width:100%;
141 font-size:10px;
142 }
143 .tr_bottom_line{
144 border-bottom: thin solid black;
145 width:100%;
146 }
147 .tr_bottom_line_dark_grey{
148 border-bottom: thin solid grey;
149 width:100%;
150 }
151 .tr_bottom_line_light_grey{
152 border-bottom: thin solid #CCCCCC;
153 width:100%;
154 }
155 .td_f12{
156 font-size:12px;
157 }
158 .td_f10{
159 font-size:10px;
160 }
161 .td_f10_right{
162 font-size:10px;
163 text-align:right;
164 }
165 .td_f12{
166 font-size:12px;
167 }
168 .td_f12_right{
169 font-size:12px;
170 text-align:right;
171 }
172 table.head_border_style{
173 border:1px solid;
174 color: #cccccc;
175 }
176 tr.head_border_style{
177 border:1px solid;
178 color: #cccccc;
179 }
180 tr.table_header{
181 font-weight: bold;
182 font-family: sans-serif, serif;
183 font-size: 14px;
184 caption-side: top;
185 padding: 5px;
186 }
187 tr.table_parent_data{
188 font-family: Helvetica-Bold;
189 font-size: 12px;
190 caption-side: top;
191 font-weight: bold;
192 }
193 tr.table_child_data{
194 font-family: Helvetica;
195 font-size: 12px;
196 caption-side: top;
197 }
198 tr.report_header{
199 font-size: 30px;
200 caption-side: top;
201 font-family: Helvetica-Bold
202 padding: 5px;
203 border-bottom: 15px solid black;
204 align: center
205 }
206
207 .top{
208 border-top:thin solid;
209 border-color:#cccccc;
210 }
211 .bottom {
212 border-bottom:thin solid;
213 border-color:#cccccc;
214 }
215 .head_bottom_border{
216 border-bottom:thin solid;
217 border-color:black;
218 }
219 .left {
220 border-left:thin solid;
221 border-color:#cccccc;
222 }
223 .right {
224 border-right:thin solid;
225 border-color:#cccccc;account_wbkit
226 }
227
228 ]]>
229 </field>
230 <field name="name">Account Tax Webkit Header</field>
231 </record>
232 <record id="account_print_invoice_header" model="ir.header_webkit">
233 <field name="footer_html"><![CDATA[
234 <html>
235 <head>
236 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
237 <script>
238 function subst() {
239 var vars={};
240 var x=document.location.search.substring(1).split('&');
241 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
242 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
243 for(var i in x) {
244 var y = document.getElementsByClassName(x[i]);
245 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
246 }
247 }
248 </script>
249 <style type="text/css">
250
251 ${css}
252 </style>
253 </head>
254 <body style="border:0; margin: 0;" onload="subst()">
255 <table class="header" style="border-top: 1px solid black; width: 100%">
256 <tr >
257 <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
258 </tr>
259 <tr >
260 <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
261 </tr>
262 </table> ${_debug or ''|n} </body>
263 </html>
264 ]]></field>
265 <field name="orientation">Portrait</field>
266 <field name="format">A4</field>
267 <field name="html"><![CDATA[
268 <html>
269 <head>
270 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
271 <script>
272 function subst() {
273 var vars={};
274 var x=document.location.search.substring(1).split('&');
275 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
276 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
277 for(var i in x) {account_wbkit
278 var y = document.getElementsByClassName(x[i]);
279 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
280 }
281 }
282 </script>
283 <style type="text/css">
284
285 ${css}
286 </style>
287 </head>
288 <body style="border:0; margin: 0;" onload="subst()">
289 <table class="header" style="border-bottom: 1px solid black; width: 100%">
290 <tr >
291 <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
292 <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
293 </tr>
294 </table> ${_debug or ''|n} </body>
295 <p style="text-align:left;font-size:12;">${company.name}</p>
296 </html>]]>
297 </field>
298 <field eval="25.0" name="margin_top"/>
299 <field eval="25.0" name="margin_bottom"/>
300 <field name="css"><![CDATA[
301
302 body, table, td, span, div {
303 font-family: Helvetica, Arial;
304 }
305
306 body {
307 font-family:Arial;
308 font-size:9;
309
310 }
311
312
313 .header {
314 margin-left:0;
315 text-align:left;
316 width:300px;
317 font-size:12;
318 }
319 .title {
320 font-size:16;
321 font-weight: bold;
322
323 }
324
325
326 .basic_table{
327 text-align:center;
328 border:1px solid lightGrey;
329 border-collapse: collapse;
330 }
331 .basic_table td {
332 border:1px solid lightGrey;
333 font-size:12;
334
335
336 }
337
338 .list_table {
339 border-color:black;
340 text-align:center;
341 border-collapse: collapse;
342
343 }
344 .list_table td {
345 border-color:gray;
346 border-top:1px solid gray;
347 text-align:right;
348 font-size:12;
349 padding-left:3px
350 padding-right:3px
351 padding-top:3px
352 padding-bottom:3px
353 }
354
355 .list_table th {
356 border-bottom:2px solid black;
357 text-align:right;
358 font-size:12;
359 font-weight:bold;
360 padding-left:3px
361 padding-right:3px
362 }
363
364 .list_tabe thead {
365 display:table-header-group;
366 }
367
368
369 .total {
370 width:100%;
371 }
372 .lib {
373 width:10.3%;
374 }
375 .tot {
376 text-align:left;
377 width:15%;
378 }
379 .righttot {
380 width:74%;
381 }
382 .tax {
383 width:50%;
384 }
385
386 .cell{
387 border-spacing: 0;
388 border-collapse: collapse;
389 border-style:solid;
390 border: 1px solid grey;
391 font-size:10px;
392 text-align:center;
393 }
394
395 .tbl_header{
396 width:100%;
397 font-size:10px;
398 }
399 .tr_bottom_line{
400 border-bottom: thin solid black;
401 width:100%;
402 }
403 .tr_bottom_line_dark_grey{
404 border-bottom: thin solid grey;
405 width:100%;
406 }
407 .tr_bottom_line_light_grey{
408 border-bottom: thin solid #CCCCCC;
409 width:100%;
410 }
411 .td_f12{
412 font-size:12px;
413 }
414 .td_f10{
415 font-size:10px;
416 }
417 .td_f10_right{
418 font-size:10px;
419 text-align:right;
420 }
421 .td_f12{
422 font-size:12px;
423 }
424 .td_f12_right{
425 font-size:12px;
426 text-align:right;
427 }
428 table.head_border_style{
429 border:1px solid;
430 color: #cccccc;
431 }
432 tr.head_border_style{
433 border:1px solid;
434 color: #cccccc;
435 }
436 tr.table_header{
437 font-weight: bold;
438 font-family: sans-serif, serif;
439 font-size: 14px;
440 caption-side: top;
441 padding: 5px;
442 }
443 tr.table_parent_data{
444 font-family: Helvetica-Bold;
445 font-size: 12px;
446 caption-side: top;
447 font-weight: bold;
448 }
449 tr.table_child_data{
450 font-family: Helvetica;
451 font-size: 12px;
452 caption-side: top;
453 }
454 tr.report_header{
455 font-size: 30px;
456 caption-side: top;
457 font-family: Helvetica-Bold
458 padding: 5px;
459 border-bottom: 15px solid black;
460 align: center
461 }
462
463 .top{
464 border-top:thin solid;
465 border-color:#cccccc;
466 }
467 .bottom {
468 border-bottom:thin solid;
469 border-color:#cccccc;
470 }
471 .head_bottom_border{
472 border-bottom:thin solid;
473 border-color:black;
474 }
475 .left {
476 border-left:thin solid;
477 border-color:#cccccc;
478 }
479 .right {
480 border-right:thin solid;
481 border-color:#cccccc;
482 }
483
484 ]]>
485 </field>
486 <field name="name">Invoice Webkit Header</field>
487 </record>
488
489 <report
490 auto="False"
491 id="account_general_ledger"
492 menu="False"
493 model="account.account"
494 name="account.general.ledger.webkit"
495 file="account_webkit/report/account_general_ledger.mako"
496 string="General Ledger"
497 report_type="webkit"
498 webkit_header="account_tax_webkit_header" />
499
500 <report
501 auto="False"
502 id="account_general_ledger_landscape"
503 menu="False"
504 model="account.account"
505 name="account.general.ledger_landscape.webkit"
506 file="account_webkit/report/account_general_ledger_landscape.mako"
507 string="General Ledger"
508 report_type="webkit"
509 webkit_header="account_tax_webkit_header"/>
510
511 <report
512 auto="False"
513 id="account_3rdparty_ledger"
514 menu="False"
515 model="res.partner"
516 name="account.third_party_ledger.webkit"
517 file="account_webkit/report/account_partner_ledger.mako"
518 string="Partner Ledger"
519 report_type="webkit"
520 webkit_header="account_tax_webkit_header" />
521
522 <report
523 auto="False"
524 id="account_3rdparty_ledger_other"
525 menu="False"
526 model="res.partner"
527 name="account.third_party_ledger_other.webkit"
528 file="account_webkit/report/account_partner_ledger_other.mako"
529 string="Partner Ledger"
530 report_type="webkit"
531 webkit_header="account_tax_webkit_header" />
532
533 <report
534 auto="False"
535 id="account_account_balance"
536 menu="False"
537 model="account.account"
538 name="account.account.balance.webkit"
539 file="account_webkit/report/account_balance.mako"
540 string="Trial Balance"
541 report_type="webkit"
542 webkit_header="account_tax_webkit_header" />
543
544
545 <report
546 auto="False"
547 id="account_3rdparty_account_balance"
548 menu="False"
549 model="account.account"
550 name="account.partner.balance.webkit"
551 file="account_webkit/report/account_partner_balance.mako"
552 string="Partner Balance"
553 report_type="webkit"
554 webkit_header="account_tax_webkit_header" />
555
556 <report
557 auto= "False"
558 id="account_central_journal"
559 model="account.journal.period"
560 name="account.central.journal.webkit"
561 file="account_webkit/report/account_central_journal.mako"
562 menu="False"
563 string="Central Journal"
564 report_type="webkit"
565 webkit_header="account_tax_webkit_header" />
566
567
568 <report
569 auto="False"
570 id="account.account_general_journal"
571 model="account.journal.period"
572 name="account.general.journal.webkit"
573 rml="account_webkit/report/account_general_journal.mako"
574 string="General Journal"
575 report_type="webkit"
576 webkit_header="account_tax_webkit_header" />
577
578 <report
579 auto="False"
580 id="account.account_journal"
581 model="account.journal.period"
582 name="account.journal.period.print.webkit"
583 file="account_webkit/report/account_journal.mako"
584 string="Journal"
585 report_type="webkit"
586 webkit_header="account_tax_webkit_header" />
587
588 <report
589 auto="False"
590 id="account.webkit_account_journal_sale_purchase"
591 model="account.journal.period"
592 name="account.journal.period.print.sale.purchase.webkit"
593 file="account_webkit/report/account_journal_sale_purchase.mako"
594 string="Sale/Purchase Journal"
595 report_type="webkit"
596 webkit_header="account_tax_webkit_header" />
597
598 <report
599 auto="False"
600 id="account.account_overdue"
601 model="res.partner"
602 name="account.overdue.webkit"
603 file="account_webkit/report/account_print_overdue.mako"
604 string="Overdue Payments"
605 report_type="webkit"
606 webkit_header="account_print_invoice_header" />
607
608
609 <report
610 auto="False"
611 id="account.account_invoices"
612 model="account.invoice"
613 name="account.invoice.webkit"
614 file="account_webkit/report/account_print_invoice.mako"
615 string="Invoices"
616 attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
617 attachment_use="True"
618 usage="default"
619 report_type="webkit"
620 webkit_header="account_print_invoice_header" />
621
622
623
624 <report
625 auto="False"
626 id="account_vat_declaration"
627 menu="False"
628 model="account.tax.code"
629 name="account.vat.declaration.webkit"
630 file="account_webkit/report/account_tax_report.mako"
631 string="Taxes Report"
632 report_type="webkit"
633 webkit_header="account_tax_webkit_header"/>
634
635 <report
636 auto="False"
637 menu="False"
638 id="report_webkit_central_journal_id"
639 model="res.partner"
640 name="account.aged_trial_balance.webkit"
641 file="account_webkit/report/account_aged_partner_balance.mako"
642 string="Account aged partner Balance"
643 report_type="webkit"
644 webkit_header="account_tax_webkit_header" />
645
646 <report
647 auto="False"
648 menu="False"
649 id="account_financial_report"
650 model="account.account"
651 name="account.financial.report.webkit"
652 file="account_webkit/report/account_financial_report.mako"
653 string="Account Financial Report"
654 report_type="webkit"
655 webkit_header="account_tax_webkit_header"/>
656
657 </data>
658</openerp>
0659
=== added directory 'account_webkit/report'
=== added file 'account_webkit/report/__init__.py'
--- account_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,40 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22
23import account_central_journal
24import account_general_journal
25import account_journal
26import account_balance
27import account_partner_balance
28import account_general_ledger
29import account_partner_ledger
30#import invoice
31import account_print_invoice
32#import overdue
33import account_print_overdue
34import account_aged_partner_balance
35#import tax_report
36import account_tax_report
37import account_financial_report
38
39# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
40
041
=== added file 'account_webkit/report/account_aged_partner_balance.mako'
--- account_webkit/report/account_aged_partner_balance.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_aged_partner_balance.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,220 @@
1<html>
2 <head>
3 <style type="text/css">
4
5 table.mystyle{border-width: 0 0 0 0;
6 border-spacing: 0;
7 border-collapse: collapse;
8 border-style: solid;
9 border: 1px solid grey;
10 font-size: 100%;}
11
12 .mystyle td, .mystyle th{
13 margin: 0;
14 padding: 4px;
15 border-width: 1px 1px 1px 1px;
16 border-style: solid;
17 border: 1px solid grey;
18 font-size: 60%;}
19
20 table.mystyleone{border-width: 0 0 0 0;
21 border-spacing: 0;
22 border-collapse: collapse;
23 border-color: black;
24 font-weight:bold;
25 border-style: solid;
26 font-size: 100%;}
27
28 .mystyleone tr{
29 margin: 0;
30 padding: 4px;
31 border-width: 0 0 1px 0;
32 border-color: black;
33 font-weight:bold;
34 border-style: solid;
35 font-size: 60%;}
36 </style>
37 </head>
38
39 <body>
40
41 %for o in objects:
42 </br>
43 <center><h2>Aged Trial Balance</h2></center>
44
45 <table width="100%" class="mystyle">
46 <tr class="table_parent_data_header">
47 <td width="16%" class="cell">
48 <b>Chart of Accounts</b>
49 </td>
50 <td width="14%" class="cell">
51 <b>Fiscal Year</b>
52 </td>
53 <td width="14%" class="cell">
54 <b>Start Date</b>
55 </td>
56 <td width="14%" class="cell">
57 <b>Period Length(days)</b>
58 </td>
59 <td width="14%" class="cell">
60 <b>Partner's</b>
61 </td>
62 <td width="16%" class="cell">
63 <b>Analysis Direction</b>
64 </td>
65 <td width="14%" class="cell">
66 <b>Target Moves</b>
67 </td>
68 </tr>
69
70 <tr class="table_child_data_header">
71 <td width="16%" class="cell">
72 ${get_account(data) or ''}
73 </td>
74 <td width="14%" class="cell">
75 ${get_fiscalyear(data) or ''}
76 </td>
77 <td width="14%" class="cell">
78 ${formatLang(data['form']['date_from'],date=True)}
79 </td>
80 <td width="14%" class="cell">
81 ${data['form']['period_length'] }
82 </td>
83 <td width="14%" class="cell">
84 ${get_partners(data)}
85 </td>
86 <td width="16%" class="cell">
87 ${data['form']['direction_selection']}
88 </td>
89 <td width="14%" class="cell">
90 ${get_target_move(data)}
91 </td>
92 </tr>
93 </table>
94 </br></br>
95
96 <table width="100%" class="mystyleone">
97 <tr class="table_parent_data">
98 <td width="23%">
99 Partners
100 </td>
101 <%
102 direction = ''
103 if data['form']['direction_selection'] == 'future':
104 direction = 'Due'
105 else:
106 direction = 'Not due'
107 %>
108 <td width="11%" >
109 ${direction}
110 </td>
111 <td width="11%" >
112 ${ data['form']['4']['name']}
113 </td><td width="11%" >
114 ${ data['form']['3']['name']}
115 </td>
116 <td width="11%" >
117 ${ data['form']['2']['name']}
118 </td>
119 <td width="11%" >
120 ${ data['form']['1']['name']}
121 </td>
122 <td width="11%" >
123 ${ data['form']['0']['name']}
124 </td>
125 <td width="11%" >
126 ${_('Total')}
127 </td>
128 </tr>
129
130
131 %if get_lines(data['form']) != False or get_lines_with_out_partner(data['form']) != False:
132 <tr class="table_parent_data">
133 <td width="23%">
134 ${_('Account Total')}
135 </td>
136 <td width="11%" >
137 ${formatLang(get_direction('6'), currency_obj=company.currency_id)}
138 </td>
139 <td width="11%" >
140 ${ formatLang(get_for_period('4'), currency_obj=company.currency_id)}
141 </td><td width="11%" >
142 ${ formatLang(get_for_period('3'), currency_obj=company.currency_id)}
143 </td>
144 <td width="11%" >
145 ${ formatLang(get_for_period('2'), currency_obj=company.currency_id)}
146 </td>
147 <td width="11%" >
148 ${ formatLang(get_for_period('1'), currency_obj=company.currency_id)}
149 </td>
150 <td width="11%" >
151 ${ formatLang(get_for_period('0'), currency_obj=company.currency_id)}
152 </td>
153 <td width="11%" >
154 ${formatLang(get_total('5'), currency_obj=company.currency_id)}
155 </td>
156 </tr>
157
158
159 %for partner in get_lines(data['form']):
160 <tr class="table_child_data">
161 <td width="23%">
162 ${partner['name']}
163 </td>
164 <td width="11%" >
165 ${formatLang(partner['direction'], currency_obj=company.currency_id)}
166 </td>
167 <td width="11%" >
168 ${ formatLang(partner['4'], currency_obj=company.currency_id)}
169 </td><td width="11%" >
170 ${ formatLang(partner['3'], currency_obj=company.currency_id)}
171 </td>
172 <td width="11%" >
173 ${ formatLang(partner['2'], currency_obj=company.currency_id)}
174 </td>
175 <td width="11%" >
176 ${ formatLang(partner['1'], currency_obj=company.currency_id)}
177 </td>
178 <td width="11%" >
179 ${ formatLang(partner['0'], currency_obj=company.currency_id)}
180 </td>
181 <td width="11%" >
182 ${formatLang(partner['total'], currency_obj=company.currency_id)}
183 </td>
184 </tr>
185 %endfor
186
187 %for not_partner in get_lines_with_out_partner(data['form']):
188 <tr class="table_child_data">
189 <td width="23%">
190 ${not_partner['name']}
191 </td>
192 <td width="11%" >
193 ${formatLang(not_partner['direction'], currency_obj=company.currency_id)}
194 </td>
195 <td width="11%" >
196 ${ formatLang(not_partner['4'], currency_obj=company.currency_id)}
197 </td><td width="11%" >
198 ${ formatLang(not_partner['3'], currency_obj=company.currency_id)}
199 </td>
200 <td width="11%" >
201 ${ formatLang(not_partner['2'], currency_obj=company.currency_id)}
202 </td>
203 <td width="11%" >
204 ${ formatLang(not_partner['1'], currency_obj=company.currency_id)}
205 </td>
206 <td width="11%" >
207 ${ formatLang(not_partner['0'], currency_obj=company.currency_id)}
208 </td>
209 <td width="11%" >
210 ${formatLang(not_partner['total'], currency_obj=company.currency_id)}
211 </td>
212 </tr>
213 %endfor
214 %endif
215
216 </table >
217 %endfor
218
219 </body>
220</html>
0\ No newline at end of file221\ No newline at end of file
1222
=== added file 'account_webkit/report/account_aged_partner_balance.py'
--- account_webkit/report/account_aged_partner_balance.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_aged_partner_balance.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,383 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20############################################################################
21
22import time
23from openerp.report import report_sxw
24from openerp.osv import osv
25from account.report.common_report_header import common_report_header
26
27class aged_trial_report(report_sxw.rml_parse, common_report_header):
28
29 def __init__(self, cr, uid, name, context):
30 super(aged_trial_report, self).__init__(cr, uid, name, context=context)
31 self.total_account = []
32 self.localcontext.update({
33 'time': time,
34 'get_lines_with_out_partner': self._get_lines_with_out_partner,
35 'get_lines': self._get_lines,
36 'get_total': self._get_total,
37 'get_direction': self._get_direction,
38 'get_for_period': self._get_for_period,
39 'get_company': self._get_company,
40 'get_currency': self._get_currency,
41 'get_partners':self._get_partners,
42 'get_account': self._get_account,
43 'get_fiscalyear': self._get_fiscalyear,
44 'get_target_move': self._get_target_move,
45 })
46
47 def set_context(self, objects, data, ids, report_type=None):
48 obj_move = self.pool.get('account.move.line')
49 ctx = data['form'].get('used_context', {})
50 ctx.update({'fiscalyear': False, 'all_fiscalyear': True})
51 self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx)
52 self.direction_selection = data['form'].get('direction_selection', 'past')
53 self.target_move = data['form'].get('target_move', 'all')
54 self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
55 if (data['form']['result_selection'] == 'customer' ):
56 self.ACCOUNT_TYPE = ['receivable']
57 elif (data['form']['result_selection'] == 'supplier'):
58 self.ACCOUNT_TYPE = ['payable']
59 else:
60 self.ACCOUNT_TYPE = ['payable','receivable']
61 return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type)
62
63 def _get_lines(self, form):
64 res = []
65 move_state = ['draft','posted']
66 if self.target_move == 'posted':
67 move_state = ['posted']
68 self.cr.execute('SELECT DISTINCT res_partner.id AS id,\
69 res_partner.name AS name \
70 FROM res_partner,account_move_line AS l, account_account, account_move am\
71 WHERE (l.account_id=account_account.id) \
72 AND (l.move_id=am.id) \
73 AND (am.state IN %s)\
74 AND (account_account.type IN %s)\
75 AND account_account.active\
76 AND ((reconcile_id IS NULL)\
77 OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
78 AND (l.partner_id=res_partner.id)\
79 AND (l.date <= %s)\
80 AND ' + self.query + ' \
81 ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
82 partners = self.cr.dictfetchall()
83 ## mise a 0 du total
84 for i in range(7):
85 self.total_account.append(0)
86 #
87 # Build a string like (1,2,3) for easy use in SQL query
88 partner_ids = [x['id'] for x in partners]
89 if not partner_ids:
90 return []
91 # This dictionary will store the debit-credit for all partners, using partner_id as key.
92
93 totals = {}
94 self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
95 FROM account_move_line AS l, account_account, account_move am \
96 WHERE (l.account_id = account_account.id) AND (l.move_id=am.id) \
97 AND (am.state IN %s)\
98 AND (account_account.type IN %s)\
99 AND (l.partner_id IN %s)\
100 AND ((l.reconcile_id IS NULL)\
101 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
102 AND ' + self.query + '\
103 AND account_account.active\
104 AND (l.date <= %s)\
105 GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from, self.date_from,))
106 t = self.cr.fetchall()
107 for i in t:
108 totals[i[0]] = i[1]
109
110 # This dictionary will store the future or past of all partners
111 future_past = {}
112 if self.direction_selection == 'future':
113 self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
114 FROM account_move_line AS l, account_account, account_move am \
115 WHERE (l.account_id=account_account.id) AND (l.move_id=am.id) \
116 AND (am.state IN %s)\
117 AND (account_account.type IN %s)\
118 AND (COALESCE(l.date_maturity, l.date) < %s)\
119 AND (l.partner_id IN %s)\
120 AND ((l.reconcile_id IS NULL)\
121 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
122 AND '+ self.query + '\
123 AND account_account.active\
124 AND (l.date <= %s)\
125 GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from, self.date_from,))
126 t = self.cr.fetchall()
127 for i in t:
128 future_past[i[0]] = i[1]
129 elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
130 self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
131 FROM account_move_line AS l, account_account, account_move am \
132 WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
133 AND (am.state IN %s)\
134 AND (account_account.type IN %s)\
135 AND (COALESCE(l.date_maturity,l.date) > %s)\
136 AND (l.partner_id IN %s)\
137 AND ((l.reconcile_id IS NULL)\
138 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
139 AND '+ self.query + '\
140 AND account_account.active\
141 AND (l.date <= %s)\
142 GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
143 t = self.cr.fetchall()
144 for i in t:
145 future_past[i[0]] = i[1]
146
147 # Use one query per period and store results in history (a list variable)
148 # Each history will contain: history[1] = {'<partner_id>': <partner_debit-credit>}
149 history = []
150 for i in range(5):
151 args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids),self.date_from,)
152 dates_query = '(COALESCE(l.date_maturity,l.date)'
153 if form[str(i)]['start'] and form[str(i)]['stop']:
154 dates_query += ' BETWEEN %s AND %s)'
155 args_list += (form[str(i)]['start'], form[str(i)]['stop'])
156 elif form[str(i)]['start']:
157 dates_query += ' > %s)'
158 args_list += (form[str(i)]['start'],)
159 else:
160 dates_query += ' < %s)'
161 args_list += (form[str(i)]['stop'],)
162 args_list += (self.date_from,)
163 self.cr.execute('''SELECT l.partner_id, SUM(l.debit-l.credit)
164 FROM account_move_line AS l, account_account, account_move am
165 WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)
166 AND (am.state IN %s)
167 AND (account_account.type IN %s)
168 AND (l.partner_id IN %s)
169 AND ((l.reconcile_id IS NULL)
170 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))
171 AND ''' + self.query + '''
172 AND account_account.active
173 AND ''' + dates_query + '''
174 AND (l.date <= %s)
175 GROUP BY l.partner_id''', args_list)
176 t = self.cr.fetchall()
177 d = {}
178 for i in t:
179 d[i[0]] = i[1]
180 history.append(d)
181
182 for partner in partners:
183 values = {}
184 ## If choise selection is in the future
185 if self.direction_selection == 'future':
186 # Query here is replaced by one query which gets the all the partners their 'before' value
187 before = False
188 if future_past.has_key(partner['id']):
189 before = [ future_past[partner['id']] ]
190 self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
191 values['direction'] = before and before[0] or 0.0
192 elif self.direction_selection == 'past': # Changed this so people could in the future create new direction_selections
193 # Query here is replaced by one query which gets the all the partners their 'after' value
194 after = False
195 if future_past.has_key(partner['id']): # Making sure this partner actually was found by the query
196 after = [ future_past[partner['id']] ]
197
198 self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
199 values['direction'] = after and after[0] or 0.0
200
201 for i in range(5):
202 during = False
203 if history[i].has_key(partner['id']):
204 during = [ history[i][partner['id']] ]
205 # Ajout du compteur
206 self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
207 values[str(i)] = during and during[0] or 0.0
208 total = False
209 if totals.has_key( partner['id'] ):
210 total = [ totals[partner['id']] ]
211 values['total'] = total and total[0] or 0.0
212 ## Add for total
213 self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
214 values['name'] = partner['name']
215
216 res.append(values)
217
218 total = 0.0
219 totals = {}
220 for r in res:
221 total += float(r['total'] or 0.0)
222 for i in range(5)+['direction']:
223 totals.setdefault(str(i), 0.0)
224 totals[str(i)] += float(r[str(i)] or 0.0)
225 return res
226
227 def _get_lines_with_out_partner(self, form):
228 res = []
229 move_state = ['draft','posted']
230 if self.target_move == 'posted':
231 move_state = ['posted']
232
233 ## mise a 0 du total
234 for i in range(7):
235 self.total_account.append(0)
236 totals = {}
237 self.cr.execute('SELECT SUM(l.debit-l.credit) \
238 FROM account_move_line AS l, account_account, account_move am \
239 WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
240 AND (am.state IN %s)\
241 AND (l.partner_id IS NULL)\
242 AND (account_account.type IN %s)\
243 AND ((l.reconcile_id IS NULL) \
244 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
245 AND ' + self.query + '\
246 AND (l.date <= %s)\
247 AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
248 t = self.cr.fetchall()
249 for i in t:
250 totals['Unknown Partner'] = i[0]
251 future_past = {}
252 if self.direction_selection == 'future':
253 self.cr.execute('SELECT SUM(l.debit-l.credit) \
254 FROM account_move_line AS l, account_account, account_move am\
255 WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
256 AND (am.state IN %s)\
257 AND (l.partner_id IS NULL)\
258 AND (account_account.type IN %s)\
259 AND (COALESCE(l.date_maturity, l.date) < %s)\
260 AND ((l.reconcile_id IS NULL)\
261 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
262 AND '+ self.query + '\
263 AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
264 t = self.cr.fetchall()
265 for i in t:
266 future_past['Unknown Partner'] = i[0]
267 elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
268 self.cr.execute('SELECT SUM(l.debit-l.credit) \
269 FROM account_move_line AS l, account_account, account_move am \
270 WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
271 AND (am.state IN %s)\
272 AND (l.partner_id IS NULL)\
273 AND (account_account.type IN %s)\
274 AND (COALESCE(l.date_maturity,l.date) > %s)\
275 AND ((l.reconcile_id IS NULL)\
276 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
277 AND '+ self.query + '\
278 AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
279 t = self.cr.fetchall()
280 for i in t:
281 future_past['Unknown Partner'] = i[0]
282 history = []
283
284 for i in range(5):
285 args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from,)
286 dates_query = '(COALESCE(l.date_maturity,l.date)'
287 if form[str(i)]['start'] and form[str(i)]['stop']:
288 dates_query += ' BETWEEN %s AND %s)'
289 args_list += (form[str(i)]['start'], form[str(i)]['stop'])
290 elif form[str(i)]['start']:
291 dates_query += ' > %s)'
292 args_list += (form[str(i)]['start'],)
293 else:
294 dates_query += ' < %s)'
295 args_list += (form[str(i)]['stop'],)
296 args_list += (self.date_from,)
297 self.cr.execute('SELECT SUM(l.debit-l.credit)\
298 FROM account_move_line AS l, account_account, account_move am \
299 WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
300 AND (am.state IN %s)\
301 AND (account_account.type IN %s)\
302 AND (l.partner_id IS NULL)\
303 AND ((l.reconcile_id IS NULL)\
304 OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
305 AND '+ self.query + '\
306 AND account_account.active\
307 AND ' + dates_query + '\
308 AND (l.date <= %s)\
309 GROUP BY l.partner_id', args_list)
310 t = self.cr.fetchall()
311 d = {}
312 for i in t:
313 d['Unknown Partner'] = i[0]
314 history.append(d)
315
316 values = {}
317 if self.direction_selection == 'future':
318 before = False
319 if future_past.has_key('Unknown Partner'):
320 before = [ future_past['Unknown Partner'] ]
321 self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
322 values['direction'] = before and before[0] or 0.0
323 elif self.direction_selection == 'past':
324 after = False
325 if future_past.has_key('Unknown Partner'):
326 after = [ future_past['Unknown Partner'] ]
327 self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
328 values['direction'] = after and after[0] or 0.0
329
330 for i in range(5):
331 during = False
332 if history[i].has_key('Unknown Partner'):
333 during = [ history[i]['Unknown Partner'] ]
334 self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
335 values[str(i)] = during and during[0] or 0.0
336
337 total = False
338 if totals.has_key( 'Unknown Partner' ):
339 total = [ totals['Unknown Partner'] ]
340 values['total'] = total and total[0] or 0.0
341 ## Add for total
342 self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
343 values['name'] = 'Unknown Partner'
344
345 if values['total']:
346 res.append(values)
The diff has been truncated for viewing.