openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #00401
[Merge] lp:~serpentcs/account-financial-report/account-serpentcs into lp:account-financial-report
Nishant Jogi has proposed merging lp:~serpentcs/account-financial-report/account-serpentcs into lp:account-financial-report.
Requested reviews:
Account Report Core Editors (account-report-core-editor)
For more details, see:
https://code.launchpad.net/~serpentcs/account-financial-report/account-serpentcs/+merge/190320
--
https://code.launchpad.net/~serpentcs/account-financial-report/account-serpentcs/+merge/190320
Your team Account Report Core Editors is requested to review the proposed merge of lp:~serpentcs/account-financial-report/account-serpentcs into lp:account-financial-report.
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import wizard
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+{
+ 'name': 'Multiple Analytic Plans Webkit',
+ 'version': '1.0',
+ 'category': 'Accounting & Finance',
+ 'description': """
+This module allows to use several analytic plans according to the general journal.
+==================================================================================
+ It is conversion of rml report to Webkit Report.
+
+ """,
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['report_webkit', 'account_analytic_plans'],
+ 'data': [
+ 'account_analytic_plans_report.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="account_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+<html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+
+ ${_debug or ''|n} </body>
+</html>]]>
+ </field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+<html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body style="border:0;" onload="subst()">
+ <table style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+
+</html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ .cell_extended{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px;
+ border-style:solid;
+ border-color:#C0C0C0;
+ font-size:10px;
+ }
+
+ tr.table_parent_data{
+ font-family: Helvetica-Bold;
+ font-size: 10px;
+ caption-side: top;
+ font-weight: bold;
+}
+ tr.table_child_data{
+ font-family: Helvetica;
+ font-size: 8px;
+ caption-side: top;
+}
+
+ .under_line1{
+ border-bottom:2px solid black;
+ font-size:10px;
+}
+
+ td.under_line{
+ border-bottom:2px solid black;
+ font-size:10px;
+}
+ .under_line_gray{
+ border-bottom:2px;
+ border-style:solid;
+ border-color:#C0C0C0;
+ font-size:10px;
+}
+ .list_table1 {
+border-color:#C0C0C0;
+text-align:center;
+font-size:8px;
+margin-top:2px;
+margin-bottom:2px;
+border-collapse: collapse;
+}
+.list_table1 td {
+border-color:gray;
+border-bottom:1px solid gray;
+text-align:left;
+font-size:10;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+
+]]>
+ </field>
+ <field name="name">Account webkit Header</field>
+ </record>
+ <report
+ id="account_analytic_account_crossovered_analytic"
+ string="Crossovered Analytic"
+ model="account.analytic.account"
+ name="account.analytic.account.crossovered.analytic.webkit"
+ file="account_analytic_plans_webkit/report/crossovered_analytic.mako"
+ auto="False"
+ menu="False"
+ report_type="webkit"
+ header="True"
+ webkit_header="account_webkit_header"
+ />
+
+ </data>
+</openerp>
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import crossovered_analytic
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+ <title>Crossoverred Analytic.pdf</title>
+
+</head>
+<body>
+ <table width="100%">
+ <tr>
+ <td style="text-align:center;">
+ <h3><b> Crossovered Analytic</b></h3>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" class="cell_extended">
+ <tr>
+ <td style="text-align:center;" class="cell_extended"><b>${ _('From Date') }</b></td>
+ <td style="text-align:center;" class="cell_extended"><b>${ _('To Date') }</b></td>
+ <td style="text-align:center;" class="cell_extended"><b>${ _('Company') }</b></td>
+ <td style="text-align:center;" class="cell_extended"><b>${ _('Currency') }</b></td>
+ <td style="text-align:center;" class="cell_extended"><b>${ _('Printing date') }</b></td>
+ </tr>
+ <tr>
+ <td style="text-align:center;" class="cell_extended">${ data['form']['date1'] }</td>
+ <td style="text-align:center;" class="cell_extended">${ data['form']['date2'] } </td>
+ <td style="text-align:center;" class="cell_extended">${ company.name }</td>
+ <td style="text-align:center;" class="cell_extended">${ company.currency_id.name }</td>
+ <td style="text-align:center;" class="cell_extended">${ time.strftime('%Y-%m-%d')} at ${ time.strftime('%H:%M:%S') }</td>
+ </tr>
+ </table>
+ <br/>
+
+ <table width="100%" >
+ <tr>
+ <td>
+ <h4><b>Analytic Account Reference:</b></h4>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">
+ <tr>
+ <td width="60%">
+ ${_('Account Name') }
+ </td>
+ <td width="10%">
+ ${_('Code') }
+ </td>
+ <td width="10%">
+ ${_('Quantity') }
+ </td>
+ <td width="10%">
+ ${_('Amount') }
+ </td>
+ <td width="10%">
+ ${_('Perc(%)') }
+ </td>
+ </tr>
+ </table>
+ %for k in ref_lines(data['form']):
+ <table width="100%" class="list_table1">
+ <tr>
+ <td width="60%">${k['ref_name']}</td>
+ <td width="10%" >${k['ref_code']}</td>
+ <td width="10%" style="text-align:right;">${k['ref_qty']}</td>
+ <td width="10%" style="text-align:right;">${k['ref_amt']}</td>
+ <td width="10%" style="text-align:right;">100.00%</td>
+ </tr>
+ </table>
+ %endfor
+
+ <br/>
+ <table width="100%" >
+ <tr>
+ <td>
+ <h4><b>Analytic Account :</b></h4>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" style="font-weight: bold ;font-size: 12px ;border-bottom:1px solid black;">
+ <tr>
+ <td width="60%">
+ ${_('Account Name') }
+ </td>
+ <td width="10%">
+ ${_('Code') }
+ </td>
+ <td width="10%">
+ ${_('Quantity') }
+ </td>
+ <td width="10%" >
+ ${_('Amount') }
+ </td>
+ <td width="10%">
+ ${_('Percentage') }
+ </td>
+ </tr>
+ </table>
+ %for account in lines(data['form']):
+ <table width="100%" class="list_table1">
+ <tr>
+ <td width="60%" >${account['acc_name']}</td>
+ <td width="10%" >${account['code']}</td>
+ <td width="10%" style="text-align:right;">${account['qty']}</td>
+ <td width="10%" style="text-align:right;">${account['amt']}</td>
+ <td width="10%" style="text-align:right;">${account['perc']}%</td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import time
+
+from openerp.report import report_sxw
+
+class crossovered_analytic(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(crossovered_analytic, self).__init__(cr, uid, name, context = context)
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self._lines,
+ 'ref_lines': self._ref_lines,
+ 'find_children': self.find_children,
+ })
+ self.base_amount = 0.00
+
+ def find_children(self, ref_ids):
+ if not ref_ids: return []
+ to_return_ids = []
+ final_list = []
+ parent_list = []
+ set_list = []
+ analytic_obj = self.pool.get('account.analytic.account')
+ for id in ref_ids:
+ # to avoid duplicate entries
+ if id not in to_return_ids:
+ to_return_ids.append(analytic_obj.search(self.cr,self.uid,[('parent_id','child_of',[id])]))
+ data_accnt = analytic_obj.browse(self.cr,self.uid,to_return_ids[0])
+ for data in data_accnt:
+ if data.parent_id and data.parent_id.id == ref_ids[0]:
+ parent_list.append(data.id)
+ final_list.append(ref_ids[0])
+ set_list = self.set_account(parent_list)
+ final_list.extend(set_list)
+ return final_list #to_return_ids[0]
+
+ def set_account(self, cats):
+ lst = []
+ category = self.pool.get('account.analytic.account').read(self.cr, self.uid, cats)
+ for cat in category:
+ lst.append(cat['id'])
+ if cat['child_ids']:
+ lst.extend(self.set_account(cat['child_ids']))
+ return lst
+
+ def _ref_lines(self, form):
+ result = []
+ res = {}
+ acc_pool = self.pool.get('account.analytic.account')
+ line_pool = self.pool.get('account.analytic.line')
+
+ self.dict_acc_ref = {}
+ if form['journal_ids']:
+ journal = " in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")"
+ else:
+ journal = 'is not null'
+
+ query_general = "SELECT id FROM account_analytic_line WHERE (journal_id " + journal +") AND date>='"+ str(form['date1']) +"'"" AND date<='" + str(form['date2']) + "'"
+
+ self.cr.execute(query_general)
+ l_ids = self.cr.fetchall()
+ line_ids = [x[0] for x in l_ids]
+
+ obj_line = line_pool.browse(self.cr,self.uid,line_ids)
+
+ #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.
+ self.dict_acc_ref[form['ref']] = []
+ children_list = acc_pool.search(self.cr, self.uid, [('parent_id', 'child_of', [form['ref']])])
+ for obj in obj_line:
+ if obj.account_id.id in children_list:
+ if obj.move_id and obj.move_id.id not in self.dict_acc_ref[form['ref']]:
+ self.dict_acc_ref[form['ref']].append(obj.move_id.id)
+
+ res['ref_name'] = acc_pool.name_get(self.cr, self.uid, [form['ref']])[0][1]
+ res['ref_code'] = acc_pool.browse(self.cr, self.uid, form['ref']).code
+
+ self.final_list = children_list
+ selected_ids = line_pool.search(self.cr, self.uid, [('account_id', 'in' ,self.final_list)])
+
+ res['ref_qty'] = 0.0
+ res['ref_amt'] = 0.0
+ self.base_amount = 0.0
+
+ if selected_ids:
+ query = "SELECT SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \
+ 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']) + "'"
+
+ self.cr.execute(query)
+ info=self.cr.dictfetchall()
+ res['ref_qty'] = info[0]['qty']
+ res['ref_amt'] = info[0]['amt']
+ self.base_amount = info[0]['amt']
+ result.append(res)
+ return result
+
+ def _lines(self, form, ids=None):
+ print "\n\n :::::::lines",form
+ if ids is None:
+ ids = {}
+ if not ids:
+ ids = self.ids
+
+ if form['journal_ids']:
+ journal=" in (" + ','.join(map(lambda x: str(x), form['journal_ids'])) + ")"
+ else:
+ journal= 'is not null'
+
+ acc_pool = self.pool.get('account.analytic.account')
+ line_pool = self.pool.get('account.analytic.line')
+ acc_id = []
+ final = []
+ self.list_ids = []
+
+ self.final_list = self.find_children(ids)
+
+ for acc_id in self.final_list:
+ selected_ids = line_pool.search(self.cr, self.uid, [('account_id','=',acc_id), ('move_id', 'in', self.dict_acc_ref[form['ref']])])
+ if selected_ids:
+ 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 \
+ 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"
+
+ self.cr.execute(query)
+ res = self.cr.dictfetchall()
+ if res:
+ for element in res:
+ if self.base_amount <> 0.00:
+ element['perc'] = (element['amt'] / self.base_amount) * 100.00
+ else:
+ element['perc'] = 0.00
+ else:
+ result = {}
+ res = []
+ result['id'] = acc_id
+ data_account = acc_pool.browse(self.cr, self.uid, acc_id)
+ result['acc_name'] = data_account.name
+ result['code'] = data_account.code
+ result['amt'] = result['qty'] = result['perc'] = 0.00
+ if not form['empty_line']:
+ res.append(result)
+ else:
+ result = {}
+ res = []
+ result['id'] = acc_id
+ data_account = acc_pool.browse(self.cr, self.uid, acc_id)
+ result['acc_name'] = data_account.name
+ result['code'] = data_account.code
+ result['amt'] = result['qty'] = result['perc'] = 0.00
+ if not form['empty_line']:
+ res.append(result)
+
+ for item in res:
+ obj_acc = acc_pool.name_get(self.cr,self.uid,[item['id']])
+ item['acc_name'] = obj_acc[0][1]
+ final.append(item)
+ print final
+ return final
+
+report_sxw.report_sxw('report.account.analytic.account.crossovered.analytic.webkit', 'account.analytic.account', 'addons/account_analytic_plans_webkit/report/crossovered_analytic.rml',parser = crossovered_analytic, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import account_crossovered_analytic
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+class account_crossovered_analytic(osv.osv_memory):
+ _inherit = "account.crossovered.analytic"
+
+
+
+ def print_report(self, cr, uid, ids, context=None):
+
+ res = super(account_crossovered_analytic,self).print_report( cr, uid, ids, context=context)
+ res['report_name']= 'account.analytic.account.crossovered.analytic.webkit'
+ return res
+# cr.execute('SELECT account_id FROM account_analytic_line')
+# res = cr.fetchall()
+# acc_ids = [x[0] for x in res]
+#
+# data = self.read(cr, uid, ids, [], context=context)[0]
+# data['ref'] = data['ref'][0]
+#
+# obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context)
+# name = obj_acc.name
+#
+# account_ids = self.pool.get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['ref']])], context=context)
+#
+# flag = True
+# for acc in account_ids:
+# if acc in acc_ids:
+# flag = False
+# break
+# if flag:
+# raise osv.except_osv(_('User Error!'),_('There are no analytic lines related to account %s.' % name))
+#
+# datas = {
+# 'ids': [],
+# 'model': 'account.analytic.account',
+# 'form': data
+# }
+# return {
+# 'type': 'ir.actions.report.xml',
+# 'report_name': 'account.analytic.account.crossovered.analytic',
+# 'datas': datas,
+# }
+
+account_crossovered_analytic()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+{
+ 'name': 'Bank Statement Extensions to Support e-banking Webkit',
+ 'version': '1.1',
+ 'author': 'Serpent Consulting Services',
+ 'category': 'Generic Modules/Accounting',
+ 'description': '''
+Module that extends the standard account_bank_statement_line object for improved e-banking support.
+===================================================================================================
+
+ It is conversion of rml report to Webkit Report.
+
+ ''',
+ 'depends': ['account_bank_statement_extensions','report_webkit'],
+ 'data' : [
+ 'account_bank_statement_report.xml',
+ ],
+ 'auto_install': False,
+ 'installable': True,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="account_bank_statement_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:12px;
+
+ }
+
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ font-size:12px;
+
+ }
+ .tr_bottom_line_dark_black{
+ border-bottom: thin solid black;
+ width:100%;
+ font-size:12px;
+ font-weight:bold;
+ }
+ tr.report_header{
+
+ caption-side: top;
+ font-family: Helvetica-Bold
+ padding: 5px;
+ border-bottom: 15px solid black;
+ align: center;
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+ .list_table {
+ border-bottom:black;
+ text-align:center;
+ border-collapse: collapse;
+
+ }
+
+ ]]>
+ </field>
+ <field name="name">Account Bank Statment Webkit Header</field>
+ </record>
+
+ <report
+ auto="False"
+ id="bank_statement_balance_report"
+ model="account.bank.statement"
+ name="bank.statement.balance.report.webkit"
+ file="account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako"
+ report_type="webkit"
+ webkit_header="account_bank_statement_webkit_header"
+ string="Bank Statement Balances Report"
+ multi="True"/>
+
+ </data>
+</openerp>
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import bank_statement_balance_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+ <br/>
+ <table width="100%">
+ <tr class ="report_header">
+ <td align="center">
+ <h4><b>
+ Bank Statement Balances Report
+ </b></h4>
+ </td>
+ </tr>
+ </table>
+ <br/> <br/>
+
+ <table border="0" class="tr_bottom_line_dark_black" >
+ <tr>
+ <td width="30%">
+ ${_('Name')}
+ </td>
+ <td width="30%">
+ ${_('Date')}
+ </td>
+ <td width="20%">
+ ${_('Journal')}
+ </td>
+ <td width="20%" align="right">
+ ${_('Closing Balance')}
+ </td>
+ </tr>
+ </table>
+ %for l in lines:
+ <table border="0" class="tr_bottom_line_dark_grey">
+ <tr >
+ <td width="30%">
+ ${ l['s_name'] }
+ </td>
+ <td width="30%">
+ ${ l['s_date'] }
+ </td>
+ <td width="20%">
+ ${ l['j_code'] }
+ </td>
+ <td width="20%" align="right">
+ ${ (l['s_balance']) }
+ </td>
+ </tr>
+ %endfor
+ </table>
+ <p style="page-break-after:always"></p>
+</body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import time
+from openerp.report import report_sxw
+from openerp import pooler
+import logging
+_logger = logging.getLogger(__name__)
+
+class bank_statement_balance_report(report_sxw.rml_parse):
+
+ def set_context(self, objects, data, ids, report_type=None):
+ #_logger.warning('addons.'+__name__, 'set_context, objects = %s, data = %s, ids = %s' % (objects, data, ids))
+ cr = self.cr
+ uid = self.uid
+ context = self.context
+
+ 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 ' \
+ 'FROM account_bank_statement s ' \
+ 'INNER JOIN account_journal j on s.journal_id = j.id ' \
+ 'INNER JOIN ' \
+ '(SELECT journal_id, max(date) as max_date FROM account_bank_statement ' \
+ 'GROUP BY journal_id) d ' \
+ 'ON (s.journal_id = d.journal_id AND s.date = d.max_date) ' \
+ 'ORDER BY j.code')
+ lines = cr.dictfetchall()
+
+ self.localcontext.update( {
+ 'lines': lines,
+ })
+ super(bank_statement_balance_report, self).set_context(objects, data, ids, report_type=report_type)
+
+
+ def __init__(self, cr, uid, name, context):
+ if context is None:
+ context = {}
+ super(bank_statement_balance_report, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'time': time,
+ })
+ self.context = context
+
+report_sxw.report_sxw(
+ 'report.bank.statement.balance.report.webkit',
+ 'account.bank.statement',
+ 'addons/account_bank_statement_extensions_webkit/report/bank_statement_balance_report.mako',
+ parser=bank_statement_balance_report,
+ header='internal'
+)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import report
+import wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+{
+ 'name': 'Budgets Management',
+ 'version': '1.0',
+ 'category': 'Accounting & Finance',
+ 'description': """
+This module allows accountants to manage analytic and crossovered budgets.
+==========================================================================
+
+It is conversion of rml report to Webkit Report.
+
+""",
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['account_budget','report_webkit'],
+ 'data': [
+ 'account_budget_report.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="account_budget_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:12;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+ .basic_table td
+ {
+ border:1px solid lightGrey;
+ font-size:12;
+
+ }
+
+ .list_table {
+ border-bottom:1px solid black;
+ border-right:border-bottom:1px solid #E5E4E2"
+ text-align:left;
+ font-size:12;
+ }
+ .list_table_grey{
+ font-size:12;
+ }
+ .list_table_grey tr{
+ border-bottom:1px solid #E5E4E2";
+
+ text-align:left;
+ font-size:12;
+ }
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+
+ .line{
+ font-size:12px;
+ border-top: 1px solid grey;
+ border-bottom: 1px solid #E5E4E2;
+
+ }
+
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ }
+ .tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f10{
+ font-size:10px;
+ }
+ .td_f10_right{
+ font-size:10px;
+ text-align:right;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f12_right{
+ font-size:12px;
+ text-align:right;
+ }
+ table.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.table_header{
+ font-weight: bold;
+ font-family: sans-serif, serif;
+ font-size: 14px;
+ caption-side: top;
+ padding: 5px;
+ }
+ tr.table_parent_data{
+ font-family: Helvetica-Bold;
+ font-size: 12px;
+ caption-side: top;
+ font-weight: bold;
+ }
+ tr.table_child_data{
+ font-family: Helvetica;
+ font-size: 12px;
+ caption-side: top;
+ }
+ tr.report_header{
+ font-size: 30px;
+ caption-side: top;
+ font-family: Helvetica-Bold
+ padding: 5px;
+ border-bottom: 15px solid black;
+ align: center
+ }
+
+ .top{
+ border-top: thin solid black;
+
+ }
+ .bottom {
+ border-bottom:thin solid;
+ border-color:#cccccc;
+ }
+ .head_bottom_border{
+ border-bottom:thin solid;
+ border-color:black;
+ }
+ .left {
+ border-left:thin solid;
+ border-color:#cccccc;
+ }
+ .right {
+ border-right:thin solid;
+ border-color:#cccccc;
+ }
+
+ ]]>
+ </field>
+ <field name="name">Account Tax Webkit Header</field>
+ </record>
+
+ <!-- Reports on crossovered.budget -->
+ <report id="report_crossovered_budget"
+ string="Budgets"
+ model="crossovered.budget"
+ name="crossovered.budget.report.webkit"
+ file="account_budget_webkit/report/crossovered_budget_report.mako"
+ auto="False"
+ menu="False"
+ report_type="webkit"
+ webkit_header="account_budget_webkit_header"/>
+
+ <!-- moved from account module -->
+ <report auto="False"
+ id="account_budget"
+ menu="False"
+ model="account.budget.post"
+ name="account.budget.webkit"
+ file="account_budget_webkit/report/budget_report.mako"
+ string="Budget"
+ report_type="webkit"
+ webkit_header="account_budget_webkit_header"/>
+
+ <report
+ auto="False"
+ id="account_analytic_budget"
+ menu="False"
+ model="account.analytic.account"
+ name="account.analytic.account.budget.webkit"
+ file="account_budget_webkit/report/analytic_account_budget_report.mako"
+ string="Print Budget"
+ report_type="webkit"
+ webkit_header="account_budget_webkit_header" />
+ </data>
+</openerp>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import crossovered_budget_report
+import analytic_account_budget_report
+import budget_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ </style>
+ </head>
+<body>
+</br>
+</br>
+</br>
+ %for o in objects:
+ </br>
+ <table width="100%">
+ <tr>
+ <td align="center">
+ <h4>
+ <b>Analytic Budget </b></h4>
+ </td>
+ </tr>
+ </table>
+<br/>
+ <table width="100%" class="basic_table">
+ <tr >
+ <td width="40%"><b>
+ ${_('Analysis from')}
+ </td></b>
+ <td width="40%"><b>
+ ${_('Analytic Account')}</b>
+ </td>
+ <td width="20%">
+ <b>
+ ${_('Currency')} </b>
+ </td></b>
+ </tr>
+
+ <tr>
+ <td>
+ ${formatLang(data['form']['date_from'],date=True)} to ${formatLang(data['form']['date_to'],date=True)}
+ </td>
+ <td>
+ ${o.name}
+ </td>
+ <td>
+ ${company.currency_id.name}
+ </td>
+ </tr>
+
+ </table>
+ <br/>
+ <table width="100%" class="list_table">
+ <tr >
+ <td width="40%"><b>
+ ${_('Description')}</b>
+ </td>
+ <td width="15%"><b>
+ ${_('Theoretical Amt')}</b>
+ </td>
+ <td width="12%"><b>
+ ${_('Planned Amt')}</b>
+ </td>
+ <td width="13%"><b>
+ ${_('Practical Amt')}</b>
+ </td>
+ <td width="10%" align="right"><b>
+ ${_('Perc(%)')}</b>
+ </td>
+ </tr>
+ %for a in funct(o,data['form']):
+ <tr>
+ <td>
+ ${a['name']}
+ </td>
+ <td>
+ ${formatLang(a['theo'], currency_obj=company.currency_id) }
+ </td>
+ <td>
+ ${ formatLang(a['pln'], currency_obj=company.currency_id) }
+ </td>
+ <td>
+ ${ formatLang(a['prac'], currency_obj=company.currency_id) }
+ </td>
+ <td>
+ ${ formatLang(a['perc']) }%
+ </td>
+ </tr>
+ %endfor
+ </table>
+ %for b in funct_total(data['form']):
+ <table width="100%">
+
+ <tr>
+ <td width="40%"><b><h5>
+ ${ } Total:</h5></b>
+ </td>
+ <td width="15%" align="right"><h5>
+ <b>${ formatLang(b['tot_theo'], currency_obj=company.currency_id) }</b></h5>
+ </td>
+ <td width="12%" align="right"><b><h5>
+ ${ formatLang(b['tot_pln'], currency_obj=company.currency_id) }</b></h5>
+ </td>
+ <td width="13%" align="right"><b><h5>
+ ${ formatLang(b['tot_prac'], currency_obj=company.currency_id) }</h5></b>
+ <td width="10%" align="right"><b><h5>
+ ${ formatLang(b['tot_perc']) }%</h5></b>
+ </td>
+ </tr></h5>
+ %endfor
+ </table>
+ <p style="page-break-after:always">
+ </p>
+
+%endfor
+</body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+import datetime
+
+from openerp import pooler
+from openerp.report import report_sxw
+
+class analytic_account_budget_report(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'funct': self.funct,
+ 'funct_total': self.funct_total,
+ 'time': time,
+ })
+ self.context = context
+
+ def funct(self, object, form, ids=None, done=None, level=1):
+ if ids is None:
+ ids = {}
+ if not ids:
+ ids = self.ids
+ if not done:
+ done = {}
+
+ global tot
+ tot = {
+ 'theo':0.00,
+ 'pln':0.00,
+ 'prac':0.00,
+ 'perc':0.00
+ }
+ result = []
+ accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy())
+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
+ obj_c_budget = self.pool.get('crossovered.budget')
+
+ for account_id in accounts:
+ res = {}
+ b_line_ids = []
+ for line in account_id.crossovered_budget_line:
+ b_line_ids.append(line.id)
+ if not b_line_ids:
+ return []
+ d_from = form['date_from']
+ d_to = form['date_to']
+
+ self.cr.execute('SELECT DISTINCT(crossovered_budget_id) FROM crossovered_budget_lines WHERE id =ANY(%s)',(b_line_ids,))
+ budget_ids = self.cr.fetchall()
+
+ context = {'wizard_date_from':d_from,'wizard_date_to':d_to}
+ for i in range(0, len(budget_ids)):
+ budget_name = obj_c_budget.browse(self.cr, self.uid, [budget_ids[i][0]])
+ res= {
+ 'b_id':'-1',
+ 'a_id':'-1',
+ 'name':budget_name[0].name,
+ 'status':1,
+ 'theo':0.00,
+ 'pln':0.00,
+ 'prac':0.00,
+ 'perc':0.00
+ }
+ result.append(res)
+
+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])])
+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
+ tot_theo = tot_pln = tot_prac = tot_perc = 0
+
+ done_budget = []
+ for line in line_id:
+ if line.id in b_line_ids:
+ theo = pract = 0.00
+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
+ if line.general_budget_id.id in done_budget:
+ for record in result:
+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
+ record['theo'] += theo
+ record['pln'] += line.planned_amount
+ record['prac'] += pract
+ record['perc'] += line.percentage
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += line.percentage
+ else:
+ res1 = {
+ 'b_id': line.general_budget_id.id,
+ 'a_id': line.analytic_account_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': theo,
+ 'pln': line.planned_amount,
+ 'prac': pract,
+ 'perc': line.percentage
+ }
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += line.percentage
+ result.append(res1)
+ done_budget.append(line.general_budget_id.id)
+ else:
+ if line.general_budget_id.id in done_budget:
+ continue
+ else:
+ res1={
+ 'b_id': line.general_budget_id.id,
+ 'a_id': line.analytic_account_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
+ }
+ result.append(res1)
+ done_budget.append(line.general_budget_id.id)
+ if tot_theo == 0.00:
+ tot_perc = 0.00
+ else:
+ tot_perc = float(tot_prac / tot_theo) * 100
+
+ result[-(len(done_budget) +1)]['theo'] = tot_theo
+ tot['theo'] +=tot_theo
+ result[-(len(done_budget) +1)]['pln'] = tot_pln
+ tot['pln'] +=tot_pln
+ result[-(len(done_budget) +1)]['prac'] = tot_prac
+ tot['prac'] +=tot_prac
+ result[-(len(done_budget) +1)]['perc'] = tot_perc
+ if tot['theo'] == 0.00:
+ tot['perc'] = 0.00
+ else:
+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
+ return result
+
+ def funct_total(self, form):
+ result = []
+ res = {}
+ res = {
+ 'tot_theo': tot['theo'],
+ 'tot_pln': tot['pln'],
+ 'tot_prac': tot['prac'],
+ 'tot_perc': tot['perc']
+ }
+ result.append(res)
+ return result
+
+report_sxw.report_sxw('report.account.analytic.account.budget.webkit', 'account.analytic.account', 'account_budget_webkit/report/analytic_account_budget_report.mako',parser=analytic_account_budget_report,header='internal')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+</br>
+</br>
+</br>
+ %for o in objects:
+ <br/>
+ <table width="100%">
+ <tr>
+ <td align="center">
+ <h4>
+ <b> Budget </b></h4>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" class="line">
+ <tr>
+ <td width="1%"></td>
+ <td width="49%">
+ <b>Currency:</b>${ company.currency_id.name }
+ </td>
+ <td width="49%" align="right">
+ Printed at: ${ formatLang(time.strftime('%Y-%m-%d'),date=True) } at ${ time.strftime('%H:%M:%S') }
+ </td>
+ <td width="1%"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <b>Analysis from</b> ${ formatLang(data['form']['date_from'],date=True) } to ${ formatLang(data['form']['date_to'],date=True) }
+ </td>
+ <td align="right">
+ <b>Budget :</b> <font color="Blue">${ o.name }</font>
+
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ <br/>
+ <br/>
+ <table width="100%" class="list_table">
+
+ <tr >
+ <td width="40%" >
+ <b>
+ ${_('Description')}
+ </b>
+ </td>
+ <td width="15%" align="right">
+ <b>
+ ${_('Theoretical Amt')}
+ </b>
+ </td>
+ <td width="12%" align="right">
+ <b>
+ ${_('Planned Amt')}
+ </b>
+ </td>
+ <td width="13%" align="right">
+ <b>
+ ${_('Practical Amt')}
+ </b>
+ </td>
+ <td width="10%" align="right">
+ <b>
+ ${_('Perc(%)')}
+ </b>
+ </td>
+ </tr>
+ </table>
+
+ %for a in funct(o,data['form']):
+ <table width="100%" style="border-bottom: 1px solid #ccc !important;text-align:left;font-size:12;">
+ <tr>
+ <td width="40%">
+ %if a['status'] == 1 :
+ ${a['name']}
+ %endif
+ %if a['status'] == 2:
+ <p style="padding-left:12px;">${a['name']} </p>
+ %endif
+ </td>
+ <td align="right" width="15%">
+ ${formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
+ </td>
+ <td align="right" width="12%">
+ ${formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
+ </td>
+ <td align="right" width="13%">
+ ${formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="10%" align="right">
+ ${formatLang(a['perc'], digits=2) }
+ </td>
+
+ </tr>
+
+ </table>
+ %endfor
+ %for b in funct_total(data['form']):
+ <table width="100%" class="top">
+ <tr>
+ <td width="40%">
+ Total:
+ </td>
+ <td width="15%" align="right">
+ ${ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="12%" align="right">
+ ${ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="13%" align="right">
+ ${ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="10%" align="right">
+ ${ formatLang(b['tot_perc'], digits=2) }%
+ </td>
+ </tr>
+ </table>
+ %endfor
+ <p style="page-break-after:always">
+ </p>
+
+%endfor
+</body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+
+tot = {}
+
+class budget_report(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(budget_report, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'funct': self.funct,
+ 'funct_total': self.funct_total,
+ 'time': time,
+ })
+ self.context = context
+
+ def funct(self, object, form, ids=None, done=None, level=1):
+ if ids is None:
+ ids = {}
+ if not ids:
+ ids = self.ids
+ if not done:
+ done = {}
+ global tot
+ tot = {
+ 'theo':0.00,
+ 'pln':0.00,
+ 'prac':0.00,
+ 'perc':0.00
+ }
+ result = []
+
+ budgets = self.pool.get('account.budget.post').browse(self.cr, self.uid, [object.id], self.context.copy())
+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
+ acc_analytic_obj = self.pool.get('account.analytic.account')
+ for budget_id in budgets:
+ res = {}
+ budget_ids = []
+ d_from = form['date_from']
+ d_to = form['date_to']
+
+ for line in budget_id.crossovered_budget_line:
+ budget_ids.append(line.id)
+
+ if not budget_ids:
+ return []
+ self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
+ an_ids = self.cr.fetchall()
+
+ context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
+ for i in range(0, len(an_ids)):
+ if not an_ids[i][0]:
+ continue
+ analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
+ res={
+ 'b_id': '-1',
+ 'a_id': '-1',
+ 'name': analytic_name[0].name,
+ 'status': 1,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
+ }
+ result.append(res)
+
+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
+ tot_theo = tot_pln = tot_prac = tot_perc = 0.00
+
+ done_budget = []
+ for line in line_id:
+ if line.id in budget_ids:
+ theo = pract = 0.00
+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
+ if line.general_budget_id.id in done_budget:
+ for record in result:
+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
+ record['theo'] += theo
+ record['pln'] += line.planned_amount
+ record['prac'] += pract
+ if record['theo'] <> 0.00:
+ perc = (record['prac'] / record['theo']) * 100
+ else:
+ perc = 0.00
+ record['perc'] = perc
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += perc
+ else:
+ if theo <> 0.00:
+ perc = (pract / theo) * 100
+ else:
+ perc = 0.00
+ res1 = {
+ 'a_id': line.analytic_account_id.id,
+ 'b_id': line.general_budget_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': theo,
+ 'pln': line.planned_amount,
+ 'prac': pract,
+ 'perc': perc,
+ }
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += perc
+ if form['report'] == 'analytic-full':
+ result.append(res1)
+ done_budget.append(line.general_budget_id.id)
+ else:
+
+ if line.general_budget_id.id in done_budget:
+ continue
+ else:
+ res1={
+ 'a_id': line.analytic_account_id.id,
+ 'b_id': line.general_budget_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
+ }
+ if form['report'] == 'analytic-full':
+ result.append(res1)
+ done_budget.append(line.general_budget_id.id)
+ if tot_theo == 0.00:
+ tot_perc = 0.00
+ else:
+ tot_perc = float(tot_prac / tot_theo) * 100
+ if form['report'] == 'analytic-full':
+ result[-(len(done_budget) +1)]['theo'] = tot_theo
+ tot['theo'] += tot_theo
+ result[-(len(done_budget) +1)]['pln'] = tot_pln
+ tot['pln'] += tot_pln
+ result[-(len(done_budget) +1)]['prac'] = tot_prac
+ tot['prac'] += tot_prac
+ result[-(len(done_budget) +1)]['perc'] = tot_perc
+ else:
+ result[-1]['theo'] = tot_theo
+ tot['theo'] += tot_theo
+ result[-1]['pln'] = tot_pln
+ tot['pln'] += tot_pln
+ result[-1]['prac'] = tot_prac
+ tot['prac'] += tot_prac
+ result[-1]['perc'] = tot_perc
+ if tot['theo'] == 0.00:
+ tot['perc'] = 0.00
+ else:
+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
+ return result
+
+ def funct_total(self, form):
+ result = []
+ res = {}
+ res = {
+ 'tot_theo': tot['theo'],
+ 'tot_pln': tot['pln'],
+ 'tot_prac': tot['prac'],
+ 'tot_perc': tot['perc']
+ }
+ result.append(res)
+ return result
+
+report_sxw.report_sxw('report.account.budget.webkit', 'account.budget.post', 'account_budget_webkit/report/budget_report.mako', parser=budget_report, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+</br>
+</br>
+</br>
+ %for o in objects:
+ <br/>
+ <table width="100%">
+ <tr>
+ <td align="center">
+ <h4>
+ <b> Budget </b></h4>
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <table width="100%" class="basic_table">
+ <tr>
+ <td>
+ ${_('Analysis from')}
+ </td>
+ <td>
+ ${_('Budget')}
+ </td>
+ <td>
+ ${_('Currency')}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${ formatLang(data['form']['date_from'],date=True) } to ${ formatLang(data['form']['date_to'],date=True) }
+ </td>
+ <td>
+ ${ o.name }
+ </td>
+ <td>
+ ${ company.currency_id.name }
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <br/>
+ <table width="100%" class="list_table">
+
+ <tr >
+ <td width="40%" >
+ <b>
+ ${_('Description')}
+ </b>
+ </td>
+ <td width="15%" align="right">
+ <b>
+ ${_('Theoretical Amt')}
+ </b>
+ </td>
+ <td width="12%" align="right">
+ <b>
+ ${_('Planned Amt')}
+ </b>
+ </td>
+ <td width="13%" align="right">
+ <b>
+ ${_('Practical Amt')}
+ </b>
+ </td>
+ <td width="10%" align="right">
+ <b>
+ ${_('Perc(%)')}
+ </b>
+ </td>
+ </tr>
+ </table>
+ %for a in funct(o,data['form']):
+ <table width="100%" style="border-bottom: 1px solid #ccc !important;text-align:left;font-size:12;">
+ <tr>
+ <td width="40%">
+ %if a['status'] == 1 :
+ ${a['name']}
+ %endif
+ %if a['status'] == 2:
+ <p style="padding-left:12px;">${a['name']} </p>
+ %endif
+ </td>
+ <td align="right" width="15%">
+ ${formatLang(a['theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
+ </td>
+ <td align="right" width="12%">
+ ${formatLang(a['pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id)}
+ </td>
+ <td align="right" width="13%">
+ ${formatLang(a['prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="10%" align="right">
+ ${formatLang(a['perc'], digits=2) }
+ </td>
+ </tr>
+ </table>
+ %endfor
+ %for b in funct_total(data['form']):
+ <table width="100%" class="top">
+ <tr>
+ <td width="40%">
+ Total:
+ </td>
+ <td width="15%" align="right">
+ ${ formatLang(b['tot_theo'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="12%" align="right">
+ ${ formatLang(b['tot_pln'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="13%" align="right">
+ ${ formatLang(b['tot_prac'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }
+ </td>
+ <td width="10%" align="right">
+ ${ formatLang(b['tot_perc'], digits=2) }%
+ </td>
+ </tr>
+ </table>
+ %endfor
+ <p style="page-break-after:always">
+ </p>
+%endfor
+</body>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import time
+import datetime
+
+from openerp import pooler
+from openerp.report import report_sxw
+import operator
+from openerp import osv
+
+class budget_report(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(budget_report, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'funct': self.funct,
+ 'funct_total': self.funct_total,
+ 'time': time,
+ })
+ self.context = context
+
+ def funct(self, object, form, ids=None, done=None, level=1):
+ if ids is None:
+ ids = {}
+ if not ids:
+ ids = self.ids
+ if not done:
+ done = {}
+ global tot
+ tot = {
+ 'theo':0.00,
+ 'pln':0.00,
+ 'prac':0.00,
+ 'perc':0.00
+ }
+ result = []
+
+ budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy())
+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
+ acc_analytic_obj = self.pool.get('account.analytic.account')
+ for budget_id in budgets:
+ res = {}
+ budget_lines = []
+ budget_ids = []
+ d_from = form['date_from']
+ d_to = form['date_to']
+
+ for line in budget_id.crossovered_budget_line:
+ budget_ids.append(line.id)
+
+ if not budget_ids:
+ return []
+
+ self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
+ an_ids = self.cr.fetchall()
+
+ context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
+ for i in range(0, len(an_ids)):
+ if not an_ids[i][0]:
+ continue
+ analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
+ res={
+ 'b_id': '-1',
+ 'a_id': '-1',
+ 'name': analytic_name[0].name,
+ 'status': 1,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
+ }
+ result.append(res)
+
+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
+ tot_theo = tot_pln = tot_prac = tot_perc = 0.00
+
+ done_budget = []
+ for line in line_id:
+ if line.id in budget_ids:
+ theo = pract = 0.00
+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
+ if line.general_budget_id.id in done_budget:
+ for record in result:
+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
+ record['theo'] += theo
+ record['pln'] += line.planned_amount
+ record['prac'] += pract
+ if record['theo'] <> 0.00:
+ perc = (record['prac'] / record['theo']) * 100
+ else:
+ perc = 0.00
+ record['perc'] = perc
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += perc
+ else:
+ if theo <> 0.00:
+ perc = (pract / theo) * 100
+ else:
+ perc = 0.00
+ res1 = {
+ 'a_id': line.analytic_account_id.id,
+ 'b_id': line.general_budget_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': theo,
+ 'pln': line.planned_amount,
+ 'prac': pract,
+ 'perc': perc,
+ }
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += perc
+ if form['report'] == 'analytic-full':
+ result.append(res1)
+ done_budget.append(line.general_budget_id.id)
+ else:
+
+ if line.general_budget_id.id in done_budget:
+ continue
+ else:
+ res1={
+ 'a_id': line.analytic_account_id.id,
+ 'b_id': line.general_budget_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
+ }
+ if form['report'] == 'analytic-full':
+ result.append(res1)
+ done_budget.append(line.general_budget_id.id)
+ if tot_theo == 0.00:
+ tot_perc = 0.00
+ else:
+ tot_perc = float(tot_prac / tot_theo) * 100
+ if form['report'] == 'analytic-full':
+ result[-(len(done_budget) +1)]['theo'] = tot_theo
+ tot['theo'] += tot_theo
+ result[-(len(done_budget) +1)]['pln'] = tot_pln
+ tot['pln'] += tot_pln
+ result[-(len(done_budget) +1)]['prac'] = tot_prac
+ tot['prac'] += tot_prac
+ result[-(len(done_budget) +1)]['perc'] = tot_perc
+ else:
+ result[-1]['theo'] = tot_theo
+ tot['theo'] += tot_theo
+ result[-1]['pln'] = tot_pln
+ tot['pln'] += tot_pln
+ result[-1]['prac'] = tot_prac
+ tot['prac'] += tot_prac
+ result[-1]['perc'] = tot_perc
+ if tot['theo'] == 0.00:
+ tot['perc'] = 0.00
+ else:
+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
+ return result
+
+ def funct_total(self, form):
+ result = []
+ res = {}
+ res = {
+ 'tot_theo': tot['theo'],
+ 'tot_pln': tot['pln'],
+ 'tot_prac': tot['prac'],
+ 'tot_perc': tot['perc']
+ }
+ result.append(res)
+ return result
+
+report_sxw.report_sxw('report.crossovered.budget.report.webkit', 'crossovered.budget', 'account_budget_webkit/report/crossovered_budget_report.mako',parser=budget_report,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import account_budget_crossovered_report
+import account_budget_analytic
+import account_budget_crossovered_summary_report
+import account_budget_report
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import time
+
+from openerp.osv import fields, osv
+
+class account_budget_analytic(osv.osv_memory):
+
+ _inherit = "account.budget.analytic"
+
+ def check_report(self, cr, uid, ids, context=None):
+
+ res = super(account_budget_analytic,self).check_report( cr, uid, ids, context=context)
+ res['report_name']= 'account.analytic.account.budget.webkit'
+ return res
+
+account_budget_analytic()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import time
+
+from openerp.osv import fields, osv
+
+class account_budget_crossvered_report(osv.osv_memory):
+
+ _inherit="account.budget.crossvered.report"
+
+ def check_report(self, cr, uid, ids, context=None):
+
+ res = super(account_budget_crossvered_report,self).check_report( cr, uid, ids, context=context)
+ res['report_name']= 'crossovered.budget.report.webkit'
+ return res
+
+account_budget_crossvered_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import time
+
+from openerp.osv import fields, osv
+
+class account_budget_crossvered_summary_report(osv.osv_memory):
+ """
+ This wizard provides the crossovered budget summary report'
+ """
+ _inherit = "account.budget.crossvered.summary.report"
+
+ def check_report(self, cr, uid, ids, context=None):
+
+ res = super(account_budget_crossvered_summary_report,self).check_report( cr, uid, ids, context=context)
+ res['report_name']= 'crossovered.budget.report.webkit'
+ return res
+
+account_budget_crossvered_summary_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import time
+
+from openerp.osv import fields, osv
+
+
+class account_budget_report(osv.osv_memory):
+ _inherit = "account.budget.report"
+
+ def check_report(self, cr, uid, ids, context=None):
+
+ res = super(account_budget_report,self).check_report( cr, uid, ids, context=context)
+ res['report_name']= 'account.budget.webkit'
+ return res
+
+
+account_budget_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import report
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+{
+ 'name' : 'Accounting Consistency Tests',
+ 'version' : '1.0',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'Accounting & Finance',
+ 'website': 'http://www.serpentcs.com',
+ 'description': """
+Asserts on accounting.
+======================
+It is conversion of rml report to Webkit Report.
+
+""",
+ 'depends' : ['account_test','report_webkit'],
+ 'data' : [
+ 'account_test_report.xml',
+ ],
+ 'active': False,
+ 'installable': True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+ <record id="account_test_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[ ]]>
+ </field>
+ <field name="name">Account Test webkit header</field>
+ </record>
+
+ <report
+ id="account_assert_test_report"
+ model="accounting.assert.test"
+ name="account.test.assert.print.webkit"
+ file="account_test_webkit/report/account_test.mako"
+ webkit_header="account_test_header"
+ report_type="webkit"
+ string="Accounting Tests"/>
+</data>
+</openerp>
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import account_test_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<html>
+<head>
+ <style type="text/css">
+ .list_table2 {
+ text-align:left;
+ border-collapse: collapse;
+ }
+ .list_table2 td {
+ border:1px solid black;
+ border-collapse: collapse;
+ font-family:"Times New Roman";
+ font-size:12px;
+ padding: 5px 5px 5px 5px;
+ }
+
+ </style>
+ <title>Account_Test.pdf</title>
+</head>
+<body>
+<table width="100%" style="font-family: Times New Roman ;font-size:20px;">
+ <tr>
+ <td align="center">
+ Accouting tests on ${ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") }
+ </td>
+ </tr>
+</table>
+</br>
+%for o in objects:
+ <table width="100%" class="list_table2">
+ <tr>
+ <td>
+ ${o.name}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <i>${ o.desc or '' }</i>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" style="font-family: Times New Roman;font-size:12px;">
+ %for test_result in execute_code(o.code_exec):
+ <tr>
+ <td>
+ ${ test_result }
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+%endfor
+</body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import datetime
+import time
+from report import report_sxw
+from openerp.tools.translate import _
+#
+# Use period and Journal for selection or resources
+#
+class report_assert_account(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_assert_account, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'time': time,
+ 'datetime': datetime,
+ 'execute_code': self.execute_code,
+ })
+
+ def execute_code(self, code_exec):
+ def reconciled_inv():
+ """
+ returns the list of invoices that are set as reconciled = True
+ """
+ return self.pool.get('account.invoice').search(self.cr, self.uid, [('reconciled','=',True)])
+
+ def order_columns(item, cols=None):
+ """
+ This function is used to display a dictionary as a string, with its columns in the order chosen.
+
+ :param item: dict
+ :param cols: list of field names
+ :returns: a list of tuples (fieldname: value) in a similar way that would dict.items() do except that the
+ returned values are following the order given by cols
+ :rtype: [(key, value)]
+ """
+ if cols is None:
+ cols = item.keys()
+ return [(col, item.get(col)) for col in cols if col in item.keys()]
+
+ localdict = {
+ 'cr': self.cr,
+ 'uid': self.uid,
+ 'reconciled_inv': reconciled_inv, #specific function used in different tests
+ 'result': None, #used to store the result of the test
+ 'column_order': None, #used to choose the display order of columns (in case you are returning a list of dict)
+ }
+ exec code_exec in localdict
+ result = localdict['result']
+ column_order = localdict.get('column_order', None)
+
+ if not isinstance(result, (tuple, list, set)):
+ result = [result]
+ if not result:
+ result = [_('The test was passed successfully')]
+ else:
+ def _format(item):
+ if isinstance(item, dict):
+ return ', '.join(["%s: %s" % (tup[0], tup[1]) for tup in order_columns(item, column_order)])
+ else:
+ return item
+ result = [_(_format(rec)) for rec in result]
+
+ return result
+
+report_sxw.report_sxw('report.account.test.assert.print.webkit', 'accounting.assert.test', 'addons/account_test_webkit/report/account_test.mako', parser=report_assert_account, header=False)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+##############################################################################
+
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+##############################################################################
+
+{
+ 'name' : 'eInvoicing & Payments',
+ 'version' : '1.0',
+ 'author' : 'Serpent Consulting Services',
+ 'summary': 'Send Invoices and Track Payments',
+ 'description': """
+Invoicing & Payments by Accounting Voucher & Receipts
+=====================================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'category': 'Accounting & Finance',
+ 'sequence': 4,
+ 'website' : 'http://serpentcs.com',
+ 'depends' : ['account_voucher','report_webkit'],
+ 'data' : [
+ 'account_voucher_report.xml',
+ ],
+ 'auto_install': False,
+ 'application': True,
+ 'installable': True,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="voucher_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-top: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
+ </tr>
+ <tr >
+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>
+ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+
+ </html>]]>
+ </field>
+ <field eval="17.0" name="margin_top"/>
+ <field eval="25.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica;
+ }
+
+ body {
+
+ font-size:9;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16px;
+ width:100%;
+ font-weight: bold;
+ font-family: Helvetica;
+ text-align:center;
+ padding-bottom:20px;
+ }
+
+ .tbl_header{
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+ .tbl_grey_line {
+ width:100%;
+ border:1px solid Grey;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ }
+ .tbl_grey_line td{
+ border:1px solid Grey;
+ font-size:11px;
+ font-family: Helvetica;
+ }
+ .tbl_line{
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ font-weight: bold;
+ border:1px solid grey;
+ border-left:0px;
+ border-right:0px;
+ }
+
+ .font{
+ width:100%;
+ font-size:12px;
+ font-family:Helvetica;
+ }
+ .font tr{
+ padding-top:10px;
+ }
+ .font td{
+ padding-top:5px;
+ }
+ ]]>
+ </field>
+ <field name="name">Voucher Header</field>
+ </record>
+
+ <report id="report_account_voucher"
+ string="Voucher"
+ model="account.voucher"
+ name="voucher.cash_receipt.drcr.webkit"
+ file="account_voucher_webkit/report/account_voucher.mako"
+ auto="False"
+ report_type="webkit"
+ webkit_header="voucher_header"
+ menu="True"/>
+
+<!-- This report is awfull so it's better to hide it -->
+
+ <report id="report_account_voucher_print"
+ string="Voucher Print"
+ model="account.voucher"
+ name="voucher.print.webkit"
+ file="account_voucher_webkit/report/account_voucher_print.mako"
+ auto="False"
+ menu="True"
+ report_type="webkit"
+ webkit_header="voucher_header"/>
+ </data>
+</openerp>
=== 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 @@
+serpentcs ,serpentcs,serpentcs-desktop,17.09.2013 13:01,file:///home/serpentcs/.libreoffice/3;
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+##############################################################################
+
+import account_voucher
+import account_voucher_print
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ %for voucher in objects:
+ <table class="title">
+ <tr>
+ <td>
+ ${get_title(voucher.type)}
+ </td>
+ </tr>
+ </table>
+ <table class="tbl_grey_line">
+ <tr>
+ <td width="20%"><b>
+ ${_('Journal:')}</b>
+ </td>
+ <td colspan="3" width="30%">
+ ${ voucher.type}
+ </td>
+ <td width="20%">
+ <b>${_('Number:')}</b>
+ </td>
+ <td width="30%">
+ ${ voucher.number }
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b> ${_('Status:')} </b>
+ </td>
+ <td width="10%">
+ %if voucher.state == 'proforma':
+ PRO-FORMA
+ %endif
+ %if voucher.state == 'draft':
+ Draft
+ %endif
+ %if voucher.state == 'cancel':
+ Canceled
+ %endif
+ %if voucher.state == 'posted':
+ Posted
+ %endif
+ </td>
+ <td width="10%">
+ <b>${_('Ref. :')}</b>
+ </td>
+ <td width="10%">
+ ${ voucher.reference or '' }
+ </td>
+ <td>
+ <b>${_('Date:')}</b>
+ </td>
+ <td>
+ ${ formatLang(voucher.date , date=True) or '' }
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="tbl_line">
+ <tr>
+ <td width="50%">
+ ${_('Particulars')}
+ </td>
+ <td width="25%" align="right">
+ ${_('Debit')}
+ </td>
+ <td width="25%" align="right">
+ ${_('Credit')}
+ </td>
+ </tr>
+ </table>
+ <table class="font">
+ %for move_ids in voucher.move_ids:
+ <tr>
+ <td style="padding-left:5px" width="50%">
+ <b> ${ (move_ids.partner_id and move_ids.partner_id.name) or 'Account' }</b>
+ </td>
+ <td style="padding-left:15px" width="25%" align="right">
+ ${ formatLang(move_ids.debit) }
+ </td>
+ <td style="padding-left:15px" width="25%" align="right">
+ ${ formatLang(move_ids.credit) }
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" style="padding-left:15px">
+ ${ move_ids.account_id.name }
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" style="padding-left:15px" width="25%">
+ <i>${ move_ids.name } - ${ get_ref(voucher.id,move_ids) }</i>
+ </td>
+ </tr>
+ %endfor
+ <tr>
+ <td colspan="3">
+ <b>${_('Through :')}
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" style="padding-left:15px" >
+ ${ voucher.narration or ''}
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" >
+ <b>${_('On Account of : ')}</b>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" style="padding-left:15px >
+ ${ voucher.name or ''}
+ </td>
+ </tr>
+ <tr >
+ <td colspan="3">
+ <b> ${_('Amount (in words) :') }</b>
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:15px">
+ ${ convert(voucher.amount,voucher.currency_id.name) or '' }
+ </td>
+ <td></td><td></td>
+ </tr>
+ </table>
+ <table class="tbl_line">
+ <tr>
+ <td width="50%">
+
+ </td>
+ <td width="25%" align="right" >
+ ${ debit(voucher.move_ids)}
+ </td>
+ <td width="25%" align="right">
+ ${ credit(voucher.move_ids)}
+ </td>
+ </tr>
+ <table>
+ </br>
+ <table class="tbl_header">
+ <tr>
+ <td width="50%">
+ Receiver's Signature
+ </td>
+ <td align="right" width="50%">
+ Authorised Signatory
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+##############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.tools import amount_to_text_en
+
+class report_voucher(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_voucher, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'time': time,
+ 'convert':self.convert,
+ 'get_title': self.get_title,
+ 'debit':self.debit,
+ 'credit':self.credit,
+ 'get_ref': self._get_ref
+ })
+
+ def convert(self, amount, cur):
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
+ return amt_en
+
+ def get_title(self, type):
+
+ title = ''
+ if type:
+ title = type[0].swapcase() + type[1:] + " Voucher"
+ return title
+
+ def debit(self, move_ids):
+ debit = 0.0
+ for move in move_ids:
+ debit += move.debit
+ return debit
+
+ def credit(self, move_ids):
+ credit = 0.0
+ for move in move_ids:
+ credit += move.credit
+ return credit
+
+ def _get_ref(self, voucher_id, move_ids):
+ voucher_line_obj = self.pool.get('account.voucher.line')
+ voucher_line = voucher_line_obj.search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)])
+ if voucher_line:
+ voucher = voucher_line_obj.browse(self.cr, self.uid, voucher_line)[0]
+ return voucher.name
+ else:
+ return
+report_sxw.report_sxw(
+ 'report.voucher.cash_receipt.drcr.webkit',
+ 'account.voucher',
+ 'addons/account_voucher_webkit/report/account_voucher.mako',
+ parser=report_voucher,header="external"
+)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ %for voucher in objects:
+ <table class="title">
+ <tr>
+ <td>
+ ${ get_title(voucher.type) }
+ </td>
+ </tr>
+ </table>
+ <table class="tbl_header">
+ <tr>
+ <td width="10%">
+ <b>${_('Number:')}</b>
+ </td>
+ <td width="40%">
+ ${_('voucher.number')}
+ <td align="right" width="40%">
+ <b>${_('Date:')}</b>
+ </td>
+ <td align="right" width="10%">
+ ${ formatLang(voucher.date , date=True) or '' }
+ </td>
+ </tr>
+ <tr>
+ <td width="10%">
+ <b> ${_('Status:')}</b>
+ </td>
+ <td width="40%">
+ %if voucher.state == 'proforma':
+ PRO-FORMA
+ %endif
+ %if voucher.state == 'draft':
+ Draft
+ %endif
+ %if voucher.state == 'cancel':
+ Canceled
+ %endif
+ %if voucher.state == 'posted':
+ Posted
+ %endif
+ </td>
+ <td align="right" width="40%">
+ <b>${_('Currency:')}</b>
+ </td>
+ <td align="right" width="10%">
+ ${ voucher.currency_id.symbol }
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="tbl_line">
+ <tr width="70%">
+ <td>
+ ${_('Particulars')}
+ </td>
+ <td width="30%" align="right">
+ ${_('Amount')}
+ </td>
+ </tr>
+ </table>
+
+ <table class="font">
+ %for p in get_lines(voucher):
+ <tr>
+ <td width="70%" style="padding-left:5px"><b>
+ ${_('Account :')}</b>
+ </td>
+ </tr>
+
+ <tr>
+ <td style="padding-left:10px">
+ ${ p['pname'] }
+ </td>
+ <td align="right">
+ ${ formatLang(p['amount'], currency_obj=voucher.currency_id) }
+ </td>
+ </tr>
+
+ <tr>
+ <td style="padding-left:10px">
+ ${ p['ref'] }
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:10px">
+ ${_('Account :')} ${ p['aname']}
+ </td>
+ </tr>
+ %endfor
+ <tr>
+ <td style="padding-left:5px">
+ <b>${_('Through :')}</b>
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:10px">
+ ${ voucher.journal_id.name or '' }
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:5px">
+ <b>${_('On Account of :')}</b>
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:10px">
+ ${ get_on_account(voucher) }
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:5px">
+ <b>Amount (in words) :</b>
+ </td>
+ </tr>
+ <tr>
+ <td style="padding-left:10px">
+ ${ convert(voucher.amount,voucher.currency_id.name) }
+ </td>
+ </tr>
+ </table>
+
+ <table class="tbl_line">
+ <tr>
+ <td width="70%">
+ </td>
+ <td align="right" width="30%">
+ ${ formatLang(voucher.amount, currency_obj=voucher.currency_id) }
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+##############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.tools import amount_to_text_en
+
+class report_voucher_print(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_voucher_print, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_title': self.get_title,
+ 'get_lines':self.get_lines,
+ 'get_on_account':self.get_on_account,
+ 'convert':self.convert
+ })
+
+ def convert(self, amount, cur):
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
+ return amt_en
+
+ def get_lines(self, voucher):
+ result = []
+ if voucher.type in ('payment','receipt'):
+ type = voucher.line_ids and voucher.line_ids[0].type or False
+ for move in voucher.move_ids:
+ res = {}
+ amount = move.credit
+ if type == 'dr':
+ amount = move.debit
+ if amount > 0.0:
+ res['pname'] = move.partner_id.name
+ res['ref'] = 'Agst Ref'+" "+str(move.name)
+ res['aname'] = move.account_id.name
+ res['amount'] = amount
+ result.append(res)
+ else:
+ type = voucher.line_ids and voucher.line_ids[0].type or False
+ for move in voucher.move_ids:
+ res = {}
+ amount = move.credit
+ if type == 'dr':
+ amount = move.debit
+ if amount > 0.0:
+ res['pname'] = move.partner_id.name
+ res['ref'] = move.name
+ res['aname'] = move.account_id.name
+ res['amount'] = amount
+ result.append(res)
+ return result
+
+ def get_title(self, type):
+ print "type:::><><><><>",type
+ title = ''
+ if type:
+ title = type[0].swapcase() + type[1:] + " Voucher"
+ return title
+
+ def get_on_account(self, voucher):
+ name = ""
+ if voucher.type == 'receipt':
+ name = "Received cash from "+str(voucher.partner_id.name)
+ elif voucher.type == 'payment':
+ name = "Payment from "+str(voucher.partner_id.name)
+ elif voucher.type == 'sale':
+ name = "Sale to "+str(voucher.partner_id.name)
+ elif voucher.type == 'purchase':
+ name = "Purchase from "+str(voucher.partner_id.name)
+ return name
+
+report_sxw.report_sxw(
+ 'report.voucher.print.webkit',
+ 'account.voucher',
+ 'addons/account_voucher_webkit/report/account_voucher_print.mako',
+ parser=report_voucher_print,header="external"
+)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import report
+import wizard
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+{
+ 'name' : 'eInvoicing Webkit',
+ 'version' : '1.1',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'Accounting & Finance',
+ 'description' : """
+Accounting and Financial Management.
+====================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'website': 'http://www.serpentcs.com',
+ 'depends' : ["account", "report_webkit"],
+ 'init_xml': [],
+ 'update_xml': [
+ 'account_report.xml',
+ ],
+ 'test': [
+ ],
+ 'installable': True,
+ 'auto_install': False,
+
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== 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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="account_tax_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="78%">${company.partner_id.name |entity}</td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:12;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:12;
+
+
+ }
+
+ .list_table {
+ border-color:black;
+ text-align:center;
+ border-collapse: collapse;
+
+ }
+ .list_table td {
+ border-color:gray;
+ border-top:1px solid gray;
+ text-align:right;
+ font-size:12;
+ padding-left:3px
+ padding-right:3px
+ padding-top:3px
+ padding-bottom:3px
+ }
+
+ .list_table th {
+ border-bottom:2px solid black;
+ text-align:right;
+ font-size:12;
+ font-weight:bold;
+ padding-left:3px
+ padding-right:3px
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+
+
+ .total {
+ width:100%;
+ }
+ .lib {
+ width:10.3%;
+ }
+ .tot {
+ text-align:left;
+ width:15%;
+ }
+ .righttot {
+ width:74%;
+ }
+ .tax {
+ width:50%;
+ }
+
+ .cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+ }
+
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ }
+ .tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f10{
+ font-size:10px;
+ }
+ .td_f10_right{
+ font-size:10px;
+ text-align:right;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f12_right{
+ font-size:12px;
+ text-align:right;
+ }
+ table.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.table_header{
+ font-weight: bold;
+ font-family: sans-serif, serif;
+ font-size: 14px;
+ caption-side: top;
+ padding: 5px;
+ }
+ tr.table_parent_data{
+ font-family: Helvetica-Bold;
+ font-size: 12px;
+ caption-side: top;
+ font-weight: bold;
+ }
+ tr.table_child_data{
+ font-family: Helvetica;
+ font-size: 12px;
+ caption-side: top;
+ }
+ tr.report_header{
+ font-size: 30px;
+ caption-side: top;
+ font-family: Helvetica-Bold
+ padding: 5px;
+ border-bottom: 15px solid black;
+ align: center
+ }
+
+ .top{
+ border-top:thin solid;
+ border-color:#cccccc;
+ }
+ .bottom {
+ border-bottom:thin solid;
+ border-color:#cccccc;
+ }
+ .head_bottom_border{
+ border-bottom:thin solid;
+ border-color:black;
+ }
+ .left {
+ border-left:thin solid;
+ border-color:#cccccc;
+ }
+ .right {
+ border-right:thin solid;
+ border-color:#cccccc;account_wbkit
+ }
+
+ ]]>
+ </field>
+ <field name="name">Account Tax Webkit Header</field>
+ </record>
+ <record id="account_print_invoice_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-top: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
+ </tr>
+ <tr >
+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>
+ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {account_wbkit
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p>
+ </html>]]>
+ </field>
+ <field eval="25.0" name="margin_top"/>
+ <field eval="25.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:9;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:12;
+
+
+ }
+
+ .list_table {
+ border-color:black;
+ text-align:center;
+ border-collapse: collapse;
+
+ }
+ .list_table td {
+ border-color:gray;
+ border-top:1px solid gray;
+ text-align:right;
+ font-size:12;
+ padding-left:3px
+ padding-right:3px
+ padding-top:3px
+ padding-bottom:3px
+ }
+
+ .list_table th {
+ border-bottom:2px solid black;
+ text-align:right;
+ font-size:12;
+ font-weight:bold;
+ padding-left:3px
+ padding-right:3px
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+
+
+ .total {
+ width:100%;
+ }
+ .lib {
+ width:10.3%;
+ }
+ .tot {
+ text-align:left;
+ width:15%;
+ }
+ .righttot {
+ width:74%;
+ }
+ .tax {
+ width:50%;
+ }
+
+ .cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+ }
+
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ }
+ .tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f10{
+ font-size:10px;
+ }
+ .td_f10_right{
+ font-size:10px;
+ text-align:right;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f12_right{
+ font-size:12px;
+ text-align:right;
+ }
+ table.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.table_header{
+ font-weight: bold;
+ font-family: sans-serif, serif;
+ font-size: 14px;
+ caption-side: top;
+ padding: 5px;
+ }
+ tr.table_parent_data{
+ font-family: Helvetica-Bold;
+ font-size: 12px;
+ caption-side: top;
+ font-weight: bold;
+ }
+ tr.table_child_data{
+ font-family: Helvetica;
+ font-size: 12px;
+ caption-side: top;
+ }
+ tr.report_header{
+ font-size: 30px;
+ caption-side: top;
+ font-family: Helvetica-Bold
+ padding: 5px;
+ border-bottom: 15px solid black;
+ align: center
+ }
+
+ .top{
+ border-top:thin solid;
+ border-color:#cccccc;
+ }
+ .bottom {
+ border-bottom:thin solid;
+ border-color:#cccccc;
+ }
+ .head_bottom_border{
+ border-bottom:thin solid;
+ border-color:black;
+ }
+ .left {
+ border-left:thin solid;
+ border-color:#cccccc;
+ }
+ .right {
+ border-right:thin solid;
+ border-color:#cccccc;
+ }
+
+ ]]>
+ </field>
+ <field name="name">Invoice Webkit Header</field>
+ </record>
+
+ <report
+ auto="False"
+ id="account_general_ledger"
+ menu="False"
+ model="account.account"
+ name="account.general.ledger.webkit"
+ file="account_webkit/report/account_general_ledger.mako"
+ string="General Ledger"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ id="account_general_ledger_landscape"
+ menu="False"
+ model="account.account"
+ name="account.general.ledger_landscape.webkit"
+ file="account_webkit/report/account_general_ledger_landscape.mako"
+ string="General Ledger"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header"/>
+
+ <report
+ auto="False"
+ id="account_3rdparty_ledger"
+ menu="False"
+ model="res.partner"
+ name="account.third_party_ledger.webkit"
+ file="account_webkit/report/account_partner_ledger.mako"
+ string="Partner Ledger"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ id="account_3rdparty_ledger_other"
+ menu="False"
+ model="res.partner"
+ name="account.third_party_ledger_other.webkit"
+ file="account_webkit/report/account_partner_ledger_other.mako"
+ string="Partner Ledger"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ id="account_account_balance"
+ menu="False"
+ model="account.account"
+ name="account.account.balance.webkit"
+ file="account_webkit/report/account_balance.mako"
+ string="Trial Balance"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+
+ <report
+ auto="False"
+ id="account_3rdparty_account_balance"
+ menu="False"
+ model="account.account"
+ name="account.partner.balance.webkit"
+ file="account_webkit/report/account_partner_balance.mako"
+ string="Partner Balance"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto= "False"
+ id="account_central_journal"
+ model="account.journal.period"
+ name="account.central.journal.webkit"
+ file="account_webkit/report/account_central_journal.mako"
+ menu="False"
+ string="Central Journal"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+
+ <report
+ auto="False"
+ id="account.account_general_journal"
+ model="account.journal.period"
+ name="account.general.journal.webkit"
+ rml="account_webkit/report/account_general_journal.mako"
+ string="General Journal"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ id="account.account_journal"
+ model="account.journal.period"
+ name="account.journal.period.print.webkit"
+ file="account_webkit/report/account_journal.mako"
+ string="Journal"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ id="account.webkit_account_journal_sale_purchase"
+ model="account.journal.period"
+ name="account.journal.period.print.sale.purchase.webkit"
+ file="account_webkit/report/account_journal_sale_purchase.mako"
+ string="Sale/Purchase Journal"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ id="account.account_overdue"
+ model="res.partner"
+ name="account.overdue.webkit"
+ file="account_webkit/report/account_print_overdue.mako"
+ string="Overdue Payments"
+ report_type="webkit"
+ webkit_header="account_print_invoice_header" />
+
+
+ <report
+ auto="False"
+ id="account.account_invoices"
+ model="account.invoice"
+ name="account.invoice.webkit"
+ file="account_webkit/report/account_print_invoice.mako"
+ string="Invoices"
+ attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
+ attachment_use="True"
+ usage="default"
+ report_type="webkit"
+ webkit_header="account_print_invoice_header" />
+
+
+
+ <report
+ auto="False"
+ id="account_vat_declaration"
+ menu="False"
+ model="account.tax.code"
+ name="account.vat.declaration.webkit"
+ file="account_webkit/report/account_tax_report.mako"
+ string="Taxes Report"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header"/>
+
+ <report
+ auto="False"
+ menu="False"
+ id="report_webkit_central_journal_id"
+ model="res.partner"
+ name="account.aged_trial_balance.webkit"
+ file="account_webkit/report/account_aged_partner_balance.mako"
+ string="Account aged partner Balance"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header" />
+
+ <report
+ auto="False"
+ menu="False"
+ id="account_financial_report"
+ model="account.account"
+ name="account.financial.report.webkit"
+ file="account_webkit/report/account_financial_report.mako"
+ string="Account Financial Report"
+ report_type="webkit"
+ webkit_header="account_tax_webkit_header"/>
+
+ </data>
+</openerp>
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import account_central_journal
+import account_general_journal
+import account_journal
+import account_balance
+import account_partner_balance
+import account_general_ledger
+import account_partner_ledger
+#import invoice
+import account_print_invoice
+#import overdue
+import account_print_overdue
+import account_aged_partner_balance
+#import tax_report
+import account_tax_report
+import account_financial_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== 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 @@
+<html>
+ <head>
+ <style type="text/css">
+
+ table.mystyle{border-width: 0 0 0 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style: solid;
+ border: 1px solid grey;
+ font-size: 100%;}
+
+ .mystyle td, .mystyle th{
+ margin: 0;
+ padding: 4px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border: 1px solid grey;
+ font-size: 60%;}
+
+ table.mystyleone{border-width: 0 0 0 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-color: black;
+ font-weight:bold;
+ border-style: solid;
+ font-size: 100%;}
+
+ .mystyleone tr{
+ margin: 0;
+ padding: 4px;
+ border-width: 0 0 1px 0;
+ border-color: black;
+ font-weight:bold;
+ border-style: solid;
+ font-size: 60%;}
+ </style>
+ </head>
+
+ <body>
+
+ %for o in objects:
+ </br>
+ <center><h2>Aged Trial Balance</h2></center>
+
+ <table width="100%" class="mystyle">
+ <tr class="table_parent_data_header">
+ <td width="16%" class="cell">
+ <b>Chart of Accounts</b>
+ </td>
+ <td width="14%" class="cell">
+ <b>Fiscal Year</b>
+ </td>
+ <td width="14%" class="cell">
+ <b>Start Date</b>
+ </td>
+ <td width="14%" class="cell">
+ <b>Period Length(days)</b>
+ </td>
+ <td width="14%" class="cell">
+ <b>Partner's</b>
+ </td>
+ <td width="16%" class="cell">
+ <b>Analysis Direction</b>
+ </td>
+ <td width="14%" class="cell">
+ <b>Target Moves</b>
+ </td>
+ </tr>
+
+ <tr class="table_child_data_header">
+ <td width="16%" class="cell">
+ ${get_account(data) or ''}
+ </td>
+ <td width="14%" class="cell">
+ ${get_fiscalyear(data) or ''}
+ </td>
+ <td width="14%" class="cell">
+ ${formatLang(data['form']['date_from'],date=True)}
+ </td>
+ <td width="14%" class="cell">
+ ${data['form']['period_length'] }
+ </td>
+ <td width="14%" class="cell">
+ ${get_partners(data)}
+ </td>
+ <td width="16%" class="cell">
+ ${data['form']['direction_selection']}
+ </td>
+ <td width="14%" class="cell">
+ ${get_target_move(data)}
+ </td>
+ </tr>
+ </table>
+ </br></br>
+
+ <table width="100%" class="mystyleone">
+ <tr class="table_parent_data">
+ <td width="23%">
+ Partners
+ </td>
+ <%
+ direction = ''
+ if data['form']['direction_selection'] == 'future':
+ direction = 'Due'
+ else:
+ direction = 'Not due'
+ %>
+ <td width="11%" >
+ ${direction}
+ </td>
+ <td width="11%" >
+ ${ data['form']['4']['name']}
+ </td><td width="11%" >
+ ${ data['form']['3']['name']}
+ </td>
+ <td width="11%" >
+ ${ data['form']['2']['name']}
+ </td>
+ <td width="11%" >
+ ${ data['form']['1']['name']}
+ </td>
+ <td width="11%" >
+ ${ data['form']['0']['name']}
+ </td>
+ <td width="11%" >
+ ${_('Total')}
+ </td>
+ </tr>
+
+
+ %if get_lines(data['form']) != False or get_lines_with_out_partner(data['form']) != False:
+ <tr class="table_parent_data">
+ <td width="23%">
+ ${_('Account Total')}
+ </td>
+ <td width="11%" >
+ ${formatLang(get_direction('6'), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(get_for_period('4'), currency_obj=company.currency_id)}
+ </td><td width="11%" >
+ ${ formatLang(get_for_period('3'), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(get_for_period('2'), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(get_for_period('1'), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(get_for_period('0'), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${formatLang(get_total('5'), currency_obj=company.currency_id)}
+ </td>
+ </tr>
+
+
+ %for partner in get_lines(data['form']):
+ <tr class="table_child_data">
+ <td width="23%">
+ ${partner['name']}
+ </td>
+ <td width="11%" >
+ ${formatLang(partner['direction'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(partner['4'], currency_obj=company.currency_id)}
+ </td><td width="11%" >
+ ${ formatLang(partner['3'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(partner['2'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(partner['1'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(partner['0'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${formatLang(partner['total'], currency_obj=company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+
+ %for not_partner in get_lines_with_out_partner(data['form']):
+ <tr class="table_child_data">
+ <td width="23%">
+ ${not_partner['name']}
+ </td>
+ <td width="11%" >
+ ${formatLang(not_partner['direction'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(not_partner['4'], currency_obj=company.currency_id)}
+ </td><td width="11%" >
+ ${ formatLang(not_partner['3'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(not_partner['2'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(not_partner['1'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${ formatLang(not_partner['0'], currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" >
+ ${formatLang(not_partner['total'], currency_obj=company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+ %endif
+
+ </table >
+ %endfor
+
+ </body>
+</html>
\ No newline at end of file
=== 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 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+class aged_trial_report(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context):
+ super(aged_trial_report, self).__init__(cr, uid, name, context=context)
+ self.total_account = []
+ self.localcontext.update({
+ 'time': time,
+ 'get_lines_with_out_partner': self._get_lines_with_out_partner,
+ 'get_lines': self._get_lines,
+ 'get_total': self._get_total,
+ 'get_direction': self._get_direction,
+ 'get_for_period': self._get_for_period,
+ 'get_company': self._get_company,
+ 'get_currency': self._get_currency,
+ 'get_partners':self._get_partners,
+ 'get_account': self._get_account,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_target_move': self._get_target_move,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ obj_move = self.pool.get('account.move.line')
+ ctx = data['form'].get('used_context', {})
+ ctx.update({'fiscalyear': False, 'all_fiscalyear': True})
+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx)
+ self.direction_selection = data['form'].get('direction_selection', 'past')
+ self.target_move = data['form'].get('target_move', 'all')
+ self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
+ if (data['form']['result_selection'] == 'customer' ):
+ self.ACCOUNT_TYPE = ['receivable']
+ elif (data['form']['result_selection'] == 'supplier'):
+ self.ACCOUNT_TYPE = ['payable']
+ else:
+ self.ACCOUNT_TYPE = ['payable','receivable']
+ return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type)
+
+ def _get_lines(self, form):
+ res = []
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ self.cr.execute('SELECT DISTINCT res_partner.id AS id,\
+ res_partner.name AS name \
+ FROM res_partner,account_move_line AS l, account_account, account_move am\
+ WHERE (l.account_id=account_account.id) \
+ AND (l.move_id=am.id) \
+ AND (am.state IN %s)\
+ AND (account_account.type IN %s)\
+ AND account_account.active\
+ AND ((reconcile_id IS NULL)\
+ OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND (l.partner_id=res_partner.id)\
+ AND (l.date <= %s)\
+ AND ' + self.query + ' \
+ ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
+ partners = self.cr.dictfetchall()
+ ## mise a 0 du total
+ for i in range(7):
+ self.total_account.append(0)
+ #
+ # Build a string like (1,2,3) for easy use in SQL query
+ partner_ids = [x['id'] for x in partners]
+ if not partner_ids:
+ return []
+ # This dictionary will store the debit-credit for all partners, using partner_id as key.
+
+ totals = {}
+ self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
+ FROM account_move_line AS l, account_account, account_move am \
+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id) \
+ AND (am.state IN %s)\
+ AND (account_account.type IN %s)\
+ AND (l.partner_id IN %s)\
+ AND ((l.reconcile_id IS NULL)\
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND ' + self.query + '\
+ AND account_account.active\
+ AND (l.date <= %s)\
+ GROUP BY l.partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from, self.date_from,))
+ t = self.cr.fetchall()
+ for i in t:
+ totals[i[0]] = i[1]
+
+ # This dictionary will store the future or past of all partners
+ future_past = {}
+ if self.direction_selection == 'future':
+ self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
+ FROM account_move_line AS l, account_account, account_move am \
+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id) \
+ AND (am.state IN %s)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(l.date_maturity, l.date) < %s)\
+ AND (l.partner_id IN %s)\
+ AND ((l.reconcile_id IS NULL)\
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active\
+ AND (l.date <= %s)\
+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids),self.date_from, self.date_from,))
+ t = self.cr.fetchall()
+ for i in t:
+ future_past[i[0]] = i[1]
+ elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
+ self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit) \
+ FROM account_move_line AS l, account_account, account_move am \
+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
+ AND (am.state IN %s)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(l.date_maturity,l.date) > %s)\
+ AND (l.partner_id IN %s)\
+ AND ((l.reconcile_id IS NULL)\
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active\
+ AND (l.date <= %s)\
+ GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from, self.date_from,))
+ t = self.cr.fetchall()
+ for i in t:
+ future_past[i[0]] = i[1]
+
+ # Use one query per period and store results in history (a list variable)
+ # Each history will contain: history[1] = {'<partner_id>': <partner_debit-credit>}
+ history = []
+ for i in range(5):
+ args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids),self.date_from,)
+ dates_query = '(COALESCE(l.date_maturity,l.date)'
+ if form[str(i)]['start'] and form[str(i)]['stop']:
+ dates_query += ' BETWEEN %s AND %s)'
+ args_list += (form[str(i)]['start'], form[str(i)]['stop'])
+ elif form[str(i)]['start']:
+ dates_query += ' > %s)'
+ args_list += (form[str(i)]['start'],)
+ else:
+ dates_query += ' < %s)'
+ args_list += (form[str(i)]['stop'],)
+ args_list += (self.date_from,)
+ self.cr.execute('''SELECT l.partner_id, SUM(l.debit-l.credit)
+ FROM account_move_line AS l, account_account, account_move am
+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)
+ AND (am.state IN %s)
+ AND (account_account.type IN %s)
+ AND (l.partner_id IN %s)
+ AND ((l.reconcile_id IS NULL)
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))
+ AND ''' + self.query + '''
+ AND account_account.active
+ AND ''' + dates_query + '''
+ AND (l.date <= %s)
+ GROUP BY l.partner_id''', args_list)
+ t = self.cr.fetchall()
+ d = {}
+ for i in t:
+ d[i[0]] = i[1]
+ history.append(d)
+
+ for partner in partners:
+ values = {}
+ ## If choise selection is in the future
+ if self.direction_selection == 'future':
+ # Query here is replaced by one query which gets the all the partners their 'before' value
+ before = False
+ if future_past.has_key(partner['id']):
+ before = [ future_past[partner['id']] ]
+ self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
+ values['direction'] = before and before[0] or 0.0
+ elif self.direction_selection == 'past': # Changed this so people could in the future create new direction_selections
+ # Query here is replaced by one query which gets the all the partners their 'after' value
+ after = False
+ if future_past.has_key(partner['id']): # Making sure this partner actually was found by the query
+ after = [ future_past[partner['id']] ]
+
+ self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
+ values['direction'] = after and after[0] or 0.0
+
+ for i in range(5):
+ during = False
+ if history[i].has_key(partner['id']):
+ during = [ history[i][partner['id']] ]
+ # Ajout du compteur
+ self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
+ values[str(i)] = during and during[0] or 0.0
+ total = False
+ if totals.has_key( partner['id'] ):
+ total = [ totals[partner['id']] ]
+ values['total'] = total and total[0] or 0.0
+ ## Add for total
+ self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
+ values['name'] = partner['name']
+
+ res.append(values)
+
+ total = 0.0
+ totals = {}
+ for r in res:
+ total += float(r['total'] or 0.0)
+ for i in range(5)+['direction']:
+ totals.setdefault(str(i), 0.0)
+ totals[str(i)] += float(r[str(i)] or 0.0)
+ return res
+
+ def _get_lines_with_out_partner(self, form):
+ res = []
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ ## mise a 0 du total
+ for i in range(7):
+ self.total_account.append(0)
+ totals = {}
+ self.cr.execute('SELECT SUM(l.debit-l.credit) \
+ FROM account_move_line AS l, account_account, account_move am \
+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
+ AND (am.state IN %s)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND ((l.reconcile_id IS NULL) \
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND ' + self.query + '\
+ AND (l.date <= %s)\
+ AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
+ t = self.cr.fetchall()
+ for i in t:
+ totals['Unknown Partner'] = i[0]
+ future_past = {}
+ if self.direction_selection == 'future':
+ self.cr.execute('SELECT SUM(l.debit-l.credit) \
+ FROM account_move_line AS l, account_account, account_move am\
+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
+ AND (am.state IN %s)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(l.date_maturity, l.date) < %s)\
+ AND ((l.reconcile_id IS NULL)\
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
+ t = self.cr.fetchall()
+ for i in t:
+ future_past['Unknown Partner'] = i[0]
+ elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
+ self.cr.execute('SELECT SUM(l.debit-l.credit) \
+ FROM account_move_line AS l, account_account, account_move am \
+ WHERE (l.account_id=account_account.id) AND (l.move_id=am.id)\
+ AND (am.state IN %s)\
+ AND (l.partner_id IS NULL)\
+ AND (account_account.type IN %s)\
+ AND (COALESCE(l.date_maturity,l.date) > %s)\
+ AND ((l.reconcile_id IS NULL)\
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from))
+ t = self.cr.fetchall()
+ for i in t:
+ future_past['Unknown Partner'] = i[0]
+ history = []
+
+ for i in range(5):
+ args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from,)
+ dates_query = '(COALESCE(l.date_maturity,l.date)'
+ if form[str(i)]['start'] and form[str(i)]['stop']:
+ dates_query += ' BETWEEN %s AND %s)'
+ args_list += (form[str(i)]['start'], form[str(i)]['stop'])
+ elif form[str(i)]['start']:
+ dates_query += ' > %s)'
+ args_list += (form[str(i)]['start'],)
+ else:
+ dates_query += ' < %s)'
+ args_list += (form[str(i)]['stop'],)
+ args_list += (self.date_from,)
+ self.cr.execute('SELECT SUM(l.debit-l.credit)\
+ FROM account_move_line AS l, account_account, account_move am \
+ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\
+ AND (am.state IN %s)\
+ AND (account_account.type IN %s)\
+ AND (l.partner_id IS NULL)\
+ AND ((l.reconcile_id IS NULL)\
+ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
+ AND '+ self.query + '\
+ AND account_account.active\
+ AND ' + dates_query + '\
+ AND (l.date <= %s)\
+ GROUP BY l.partner_id', args_list)
+ t = self.cr.fetchall()
+ d = {}
+ for i in t:
+ d['Unknown Partner'] = i[0]
+ history.append(d)
+
+ values = {}
+ if self.direction_selection == 'future':
+ before = False
+ if future_past.has_key('Unknown Partner'):
+ before = [ future_past['Unknown Partner'] ]
+ self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
+ values['direction'] = before and before[0] or 0.0
+ elif self.direction_selection == 'past':
+ after = False
+ if future_past.has_key('Unknown Partner'):
+ after = [ future_past['Unknown Partner'] ]
+ self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
+ values['direction'] = after and after[0] or 0.0
+
+ for i in range(5):
+ during = False
+ if history[i].has_key('Unknown Partner'):
+ during = [ history[i]['Unknown Partner'] ]
+ self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
+ values[str(i)] = during and during[0] or 0.0
+
+ total = False
+ if totals.has_key( 'Unknown Partner' ):
+ total = [ totals['Unknown Partner'] ]
+ values['total'] = total and total[0] or 0.0
+ ## Add for total
+ self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
+ values['name'] = 'Unknown Partner'
+
+ if values['total']:
+ res.append(values)
+
+ total = 0.0
+ totals = {}
+ for r in res:
+ total += float(r['total'] or 0.0)
+ for i in range(5)+['direction']:
+ totals.setdefault(str(i), 0.0)
+ totals[str(i)] += float(r[str(i)] or 0.0)
+ return res
+
+ def _get_total(self,pos):
+ period = self.total_account[int(pos)]
+ return period or 0.0
+
+ def _get_direction(self,pos):
+ period = self.total_account[int(pos)]
+ return period or 0.0
+
+ def _get_for_period(self,pos):
+ period = self.total_account[int(pos)]
+ return period or 0.0
+
+ def _get_partners(self,data):
+ # TODO: deprecated, to remove in trunk
+ if data['form']['result_selection'] == 'customer':
+ return self._translate('Receivable Accounts')
+ elif data['form']['result_selection'] == 'supplier':
+ return self._translate('Payable Accounts')
+ elif data['form']['result_selection'] == 'customer_supplier':
+ return self._translate('Receivable and Payable Accounts')
+ return ''
+
+report_sxw.report_sxw('report.account.aged_trial_balance.webkit', 'res.partner',
+ 'addons/account_webkit/report/account_aged_partner_balance.mako',parser=aged_trial_report, header="internal landscape")
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_balance.mako'
--- account_webkit/report/account_balance.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_balance.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,132 @@
+<html>
+ <head>
+ <style type="text/css">
+
+ table.mystyle{border-width: 0 0 0 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style: solid;
+ text-align: center;
+ border: 1px solid grey;
+ font-size: 100%;}
+
+ .mystyle td, .mystyle th{
+ margin: 0;
+ padding: 4px;
+ text-align: center;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border: 1px solid grey;
+ font-size: 60%;}
+
+ table.mystyleone{border-width: 0 0 0 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style: solid;
+ font-size: 100%;}
+
+ .mystyleone tr{
+ margin: 0;
+ padding: 4px;
+ border-width: 0 0 1px 0;
+ border-style: solid;
+ font-size: 60%;}
+ </style>
+ </head>
+ <body direction rtl;>
+ <br/>
+ <center><h2>Trail Balance </h2></center>
+ <table cellspacing="0" class="mystyle" width="100%">
+ <tr>
+ <td class="cell td_f12" width="24%"><b>
+ %if data['model']=='account.account':
+ ${ _('Company') }
+ %endif
+ %if data['model']=='ir.ui.menu':
+ ${ _('Chart of Accounts') }
+ %endif</b>
+ </td>
+ <td class="cell td_f12" width="15%"><b>${ _('Fiscal Year') }</b></td>
+ <td class="cell td_f12" width="19%"><b>${ _('Display Account') }</b></td>
+ <td class="cell td_f12" width="25%"><b>${ _('Filter By') }
+ %if data['form']['filter']!='filter_no':
+ ${ get_filter(data) }
+ %endif</b>
+ </td>
+ <td class="cell td_f12" width="17%"><b>${ _('Target Moves') }</b></td>
+ </tr>
+ <tr>
+ <td class="cell">${ get_account(data) or '' }</td>
+ <td class="cell">${ get_fiscalyear(data) or '' }</td>
+ <td class="cell">
+ %if data['form']['display_account']=='all':
+ ${ _('All') }
+ %elif data['form']['display_account']=='movement':
+ ${ _('With movements') }
+ %else:
+ ${ _('With balance is not equal to 0') }
+ %endif
+ </td>
+ <td class="cell"><center>
+ %if data['form']['filter']=='filter_no':
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Date') }</td>
+ <td class="cell">${ _('End Date') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ formatLang(get_start_date(data),date=True) }</td>
+ <td class="cell">${ formatLang(get_end_date(data),date=True) }</td>
+ </tr>
+ </table>
+ %endif
+ %if data['form']['filter']=='filter_period':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Period') }</td>
+ <td class="cell">${ _('End Period') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ get_start_period(data) }</td>
+ <td class="cell">${ get_end_period(data) }</td>
+ </tr>
+ </table>
+ %endif</center>
+ </td>
+ <td class="cell">${ get_target_move(data) }</td>
+ </tr>
+ </table>
+ </br>
+ <table cellspacing="0" class="mystyleone" width="100%">
+ <tr border-color="black">
+ <td class="td_f12" width="15%"><b>${ _('Code') }</b></td>
+ <td class="td_f12" width="40%"><b>${ _('Account') }</b></td>
+ <td class="td_f12_right" width="15%"><b>${ _('Debit') }</b></td>
+ <td class="td_f12_right" width="15%"><b>${ _('Credit') }</b></td>
+ <td class="td_f12_right" width="15%"><b>${ _('Balance') }</b></td>
+ </tr>
+ %for a in lines(data['form']):
+ %if a['code']:
+ <tr border-color="grey">
+ %if a['type']!='view':
+ <td class="td_f10"><i>${ a['code'] }</i></td>
+ <td class="td_f10">${' '*(a['level']-1) }${ a['name'] }</td>
+ <td class="td_f10_right">${ formatLang(a['debit']) }</td>
+ <td class="td_f10_right">${ formatLang(a['credit']) }</td>
+ <td class="td_f10_right">${ formatLang(a['balance'], currency_obj=company.currency_id) }</td>
+ %else:
+ <td class="td_f10"><i><b>${ a['code'] }</b></i></td>
+ <td class="td_f10"><b>${' '*(a['level']-1) }${ a['name'] }</b></td>
+ <td class="td_f10"><b>${ formatLang(a['debit']) }</b></td>
+ <td class="td_f10"><b>${ formatLang(a['credit']) }</b></td>
+ <td class="td_f10"><b>${ formatLang(a['balance'], currency_obj=company.currency_id) }</b></td>
+ %endif
+ </tr>
+ %endif
+ %endfor
+ </table>
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_balance.py'
--- account_webkit/report/account_balance.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_balance.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,136 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+class account_balance(report_sxw.rml_parse, common_report_header):
+ _name = 'report.account.account.balance'
+
+ def __init__(self, cr, uid, name, context=None):
+ super(account_balance, self).__init__(cr, uid, name, context=context)
+ self.sum_debit = 0.00
+ self.sum_credit = 0.00
+ self.date_lst = []
+ self.date_lst_string = ''
+ self.result_acc = []
+ self.localcontext.update({
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_fiscalyear':self._get_fiscalyear,
+ 'get_filter': self._get_filter,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period ,
+ 'get_account': self._get_account,
+ 'get_journal': self._get_journal,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'get_target_move': self._get_target_move,
+ })
+ self.context = context
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
+ return super(account_balance, self).set_context(objects, data, new_ids, report_type=report_type)
+
+ #def _add_header(self, node, header=1):
+ # if header == 0:
+ # self.rml_header = ""
+ # return True
+
+ def _get_account(self, data):
+ if data['model']=='account.account':
+ return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
+ return super(account_balance ,self)._get_account(data)
+
+ def lines(self, form, ids=None, done=None):
+ def _process_child(accounts, disp_acc, parent):
+ account_rec = [acct for acct in accounts if acct['id']==parent][0]
+ currency_obj = self.pool.get('res.currency')
+ acc_id = self.pool.get('account.account').browse(self.cr, self.uid, account_rec['id'])
+ currency = acc_id.currency_id and acc_id.currency_id or acc_id.company_id.currency_id
+ res = {
+ 'id': account_rec['id'],
+ 'type': account_rec['type'],
+ 'code': account_rec['code'],
+ 'name': account_rec['name'],
+ 'level': account_rec['level'],
+ 'debit': account_rec['debit'],
+ 'credit': account_rec['credit'],
+ 'balance': account_rec['balance'],
+ 'parent_id': account_rec['parent_id'],
+ 'bal_type': '',
+ }
+ self.sum_debit += account_rec['debit']
+ self.sum_credit += account_rec['credit']
+ if disp_acc == 'movement':
+ if not currency_obj.is_zero(self.cr, self.uid, currency, res['credit']) or not currency_obj.is_zero(self.cr, self.uid, currency, res['debit']) or not currency_obj.is_zero(self.cr, self.uid, currency, res['balance']):
+ self.result_acc.append(res)
+ elif disp_acc == 'not_zero':
+ if not currency_obj.is_zero(self.cr, self.uid, currency, res['balance']):
+ self.result_acc.append(res)
+ else:
+ self.result_acc.append(res)
+ if account_rec['child_id']:
+ for child in account_rec['child_id']:
+ _process_child(accounts,disp_acc,child)
+
+ obj_account = self.pool.get('account.account')
+ if not ids:
+ ids = self.ids
+ if not ids:
+ return []
+ if not done:
+ done={}
+
+ ctx = self.context.copy()
+
+ ctx['fiscalyear'] = form['fiscalyear_id']
+ if form['filter'] == 'filter_period':
+ ctx['period_from'] = form['period_from']
+ ctx['period_to'] = form['period_to']
+ elif form['filter'] == 'filter_date':
+ ctx['date_from'] = form['date_from']
+ ctx['date_to'] = form['date_to']
+ ctx['state'] = form['target_move']
+ parents = ids
+ child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
+ if child_ids:
+ ids = child_ids
+ accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level','child_id'], ctx)
+
+ for parent in parents:
+ if parent in done:
+ continue
+ done[parent] = 1
+ _process_child(accounts,form['display_account'],parent)
+ return self.result_acc
+
+report_sxw.report_sxw('report.account.account.balance.webkit', 'account.account', 'addons/account_webkit/report/account_balance.mako', parser=account_balance, header="internal")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_central_journal.mako'
--- account_webkit/report/account_central_journal.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_central_journal.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,240 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+ %for o in objects:
+ <br/>
+ <br/>
+ <table width="100%">
+ <tr class ="report_header">
+ <td align="center">
+ <b>Centralized Journal</b>
+ </td>
+ </tr>
+ </table>
+ <br/>
+ <%
+ if data['model']=='account.journal.period':
+ account_info = 'Company'
+ endif
+
+ if data['model']=='ir.ui.menu':
+ account_info = 'Chart of Accounts'
+ endif
+ %>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td align="center" class="left top" width="16%">
+ <small> ${_(account_info) }</small>
+ </td>
+ <td align="center" class="left top" width="16%">
+ <small><b> ${_('Fiscal Year')}</small>
+ </td>
+ <td align="center" class="left top" width="16%">
+ <small><b> ${_('Journal')}</small>
+ </td>
+ <td align="center" class="left top" width="20%">
+ <small><b>${_('Filter By')}</b></small>
+ </td>
+ <td align="center" class="left top right" width="16%">
+ <small><b>${_('Target Moves')}</b></small>
+ </td>
+ </tr>
+ <tr class="table_child_data" >
+ <td align="center" class="left top bottom" width="16%">
+ <small> ${ get_account(data) or '' }</small>
+ </td>
+ <td align="center" class="left top bottom" width="16%">
+ <small> ${ get_fiscalyear(data) or '' }</small>
+ </td>
+ <td align="center" class="left top bottom" width="16%">
+ <small> ${ o.journal_id.name }</small>
+ </td>
+ <td align="center" class="left top bottom" width="16%">
+
+ %if data['form']['filter']=='filter_no':
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ <table>
+ <tr class="table_parent_data">
+ <td ><center><b>${_('Start Date')}</b></center></td>
+ <td class="left"><center><b>${_('End Date')}</b></center></td>
+ </tr>
+ <tr class="table_child_data">
+ <td ><center>${ formatLang(get_start_date(data),date=True) }</center></td>
+ <td class="left"><center>${ formatLang(get_end_date(data),date=True) }</center></td>
+ </tr>
+ </table>
+ %endif
+ %if data['form']['filter']=='filter_period':
+ <table >
+ <tr class="table_parent_data">
+ <td ><center><b>${_('Start Period')}</b></center></td>
+ <td class="left"><center><b>${_('End Period')}</b></center></td>
+ </tr>
+ <tr class="table_child_data">
+ <td ><center>
+ %if get_start_period(data):
+ ${ get_start_period(data) }
+ %endif
+ </center></td>
+ <td class="left"><center>
+ %if get_end_period(data):
+ ${ get_end_period(data) }
+ %endif
+ </center></td>
+ </tr>
+ </table>
+ %endif
+ </td>
+ <td align="center" class="left top bottom right" width="20%">
+ ${get_target_move(data)}
+ </td>
+ </tr>
+ </table>
+ <p>
+
+ %if display_currency(data)==False:
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="20%">
+ <small> ${_('A/C No.') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="35%">
+ <small><b> ${_('Account Name')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="15%">
+ <small><b> ${_('Debit')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="15%">
+ <small><b>${_('Credit')}</b></small>
+ </td>
+ <td align="center" class="head_bottom_border" width="15%">
+ <small><b>${_('Balance')}</b></small>
+ </td>
+ </tr>
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="20%">
+ <small> ${ _('Total:') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="35%">
+ <small> </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="15%">
+ <small> ${ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="15%">
+ <small> ${ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="15%">
+ <small> ${ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id ) }</small>
+ </td>
+ </tr>
+ </table>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ %for line in lines(o.period_id.id,o.journal_id.id):
+ <tr class="table_child_data" >
+ <td align="center" class="bottom" width="20%">
+ <small> ${ line['code'] }</small>
+ </td>
+ <td align="center" class="bottom" width="35%">
+ <small> ${ line['name'] }</small>
+ </td>
+ <td align="center" class="bottom" width="15%">
+ <small> ${ formatLang(line['debit']) }</small>
+ </td>
+ <td align="center" class="bottom" width="15%">
+ <small> ${ formatLang(line['credit']) }</small>
+ </td>
+ <td align="center" class="bottom" width="15%">
+ <small> ${ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) }</small>
+ </td>
+ </tr>
+ %endfor
+ </table>
+ %endif
+
+ %if display_currency(data):
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${_('A/C No.') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small><b> ${_('Account Name')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small><b> ${_('Debit')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small><b>${_('Credit')}</b></small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small><b>${_('Balance')}</b></small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small><b>${_('Currency')}</b></small>
+ </td>
+ </tr>
+
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ _('Total:') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small> </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang( sum_credit(o.period_id.id, o.journal_id.id)-sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id ) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> </small>
+ </td>
+ </tr>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ %for line in lines(o.period_id.id,o.journal_id.id):
+ <tr class="table_child_data" >
+ <td align="center" class="bottom" width="16%">
+ <small> ${ line['code'] }</small>
+ </td>
+ <td align="center" class="bottom" width="20%">
+ <small> ${ line['name'] }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['debit']) }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['credit']) }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) }</small>
+ </td>
+ %if line['currency_id']!=None or line['amount_currency']!=None :
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['amount_currency'] )} ${line['currency_code'] or '' }</small>
+ </td>
+ %endif
+ </tr>
+ %endfor
+ </table>
+ %endif
+ <p style="page-break-after:always;">
+ </p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_central_journal.py'
--- account_webkit/report/account_central_journal.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_central_journal.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+#
+# Use period and Journal for selection or resources
+#
+class journal_print(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(journal_print, self).__init__(cr, uid, name, context=context)
+ self.period_ids = []
+ self.journal_ids = []
+ self.localcontext.update({
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_filter': self._get_filter,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_sortby': self._get_sortby,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'display_currency':self._display_currency,
+ 'get_target_move': self._get_target_move,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ obj_move = self.pool.get('account.move.line')
+ new_ids = ids
+ self.query_get_clause = ''
+ self.target_move = data['form'].get('target_move', 'all')
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
+ self.query_get_clause = 'AND '
+ self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
+ if new_ids:
+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
+ res = self.cr.fetchall()
+ self.period_ids, self.journal_ids = zip(*res)
+ return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
+
+ def lines(self, period_id, journal_id):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ self.cr.execute('SELECT a.currency_id, a.code, a.name, c.symbol AS currency_code, l.currency_id, l.amount_currency, SUM(debit) AS debit, SUM(credit) AS credit \
+ from account_move_line l \
+ LEFT JOIN account_move am ON (l.move_id=am.id) \
+ LEFT JOIN account_account a ON (l.account_id=a.id) \
+ LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.symbol, a.currency_id,l.currency_id', (tuple(move_state), period_id, journal_id))
+ return self.cr.dictfetchall()
+
+ def _set_get_account_currency_code(self, account_id):
+ self.cr.execute("SELECT c.symbol as code "\
+ "FROM res_currency c,account_account as ac "\
+ "WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
+ result = self.cr.fetchone()
+ if result:
+ self.account_currency = result[0]
+ else:
+ self.account_currency = False
+
+ def _get_account(self, data):
+ if data['model'] == 'account.journal.period':
+ return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
+ return super(journal_print,self)._get_account(data)
+
+ def _get_fiscalyear(self, data):
+ if data['model'] == 'account.journal.period':
+ return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
+ return super(journal_print,self)._get_fiscalyear(data)
+
+ def _display_currency(self, data):
+ if data['model'] == 'account.journal.period':
+ return True
+ return data['form']['amount_currency']
+
+report_sxw.report_sxw('report.account.central.journal.webkit','account.journal.period','addons/account_webkit/report/account_central_journal.mako', parser=journal_print, header='external')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_financial_report.mako'
--- account_webkit/report/account_financial_report.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_financial_report.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,181 @@
+<html>
+ <head>
+ <style type="text/css">
+
+ table.mystyle{border-width: 0 0 0 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style: solid;
+ border: 1px solid grey;
+ font-size: 100%;}
+
+ .mystyle td, .mystyle th{
+ margin: 0;
+ padding: 4px;
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border: 1px solid grey;
+ font-size: 70%;}
+
+ table.mystyleone{border-width: 0 0 0 0;
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-color: black;
+ border-style: solid;
+ font-size: 100%;}
+
+ .mystyleone tr{
+ margin: 0;
+ padding: 4px;
+ border-width: 0 0 1px 0;
+ border-color: black;
+ border-style: solid;
+ font-size: 70%;}
+ </style>
+ </head>
+ <body>
+ <center><h2>${ data['form']['account_report_id'][1] }</h2></center>
+ <table cellspacing="0" class='mystyle' width="100%">
+ <tr>
+ <td class="cell td_f12" width="33%" align="center"><b>${ _('Chart of Accounts') }</b></td>
+ <td class="cell td_f12" width="33%" align="center"><b>${ _('Fiscal Year') }</b></td>
+ <td class="cell td_f12" width="34%" align="center"><b>${ _('Filter By') }
+ %if data['form']['filter']!='filter_no':
+ ${ get_filter(data) }
+ %endif</b>
+ </td>
+ </tr>
+ <tr>
+ <td class="cell" align="center">
+ %if get_account(data):
+ ${ get_account(data) }
+ %endif
+ </td>
+ <td class="cell" align="center">${ get_fiscalyear(data) or '' }</td>
+ <td class="cell" align="center">
+ %if get_filter(data)=='No Filters':
+ ${ get_filter(data) }
+ %endif
+ %if get_filter(data)=='Date':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Date') }</td>
+ <td class="cell">${ _('End Date') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ formatLang(get_start_date(data),date=True) }</td>
+ <td class="cell">${ formatLang(get_end_date(data),date=True) }</td>
+ </tr>
+ </table>
+ %endif
+ %if get_filter(data)=='Periods':
+ <table cellspacing="0" class="cell tbl_header">
+ <tr>
+ <td class="cell">${ _('Start Period') }</td>
+ <td class="cell">${ _('End Period') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ get_start_period(data) }</td>
+ <td class="cell">${ get_end_period(data) }</td>
+ </tr>
+ </table>
+ %endif
+ </td>
+ </tr>
+ </table>
+ <br/>
+ %if data['form']['debit_credit'] == 1:
+ <table class="mystyleone" width="100%">
+ <tr>
+ <td class="td_f12" width="44%"><b>${ _('Name') }</b></td>
+ <td class="td_f12_right" width="11%"><b>${ _('Debit') }</b></td>
+ <td class="td_f12_right" width="11%"><b>${ _('Credit') }</b></td>
+ <td class="td_f12_right" width="14%"><b>${ _('Balance') }</b></td>
+ </tr>
+ </table>
+ <table width="100%">
+ %for a in get_lines(data):
+ %if a.get('level') != 0:
+ <tr>
+ <td class="font${ min(6,a.get('level'))} padding${ min(6,a.get('level'))}" width="44%" style="font-size: 70%;"><b>${ a.get('name') }</b></td>
+ <td class="font${ min(6,a.get('level'))} right" width="11%">${ formatLang(a.get('debit',0.0), currency_obj = company.currency_id) }</td>
+ <td class="font${ min(6,a.get('level'))} right" width="11%">${ formatLang(a.get('credit',0.0), currency_obj = company.currency_id) }</td>
+ <td class="font${ min(6,a.get('level'))} right" width="14%">
+ %if (a.get('account_type') =='view' and a.get('level') != 1):
+ <u>${ formatLang(a.get('balance'), currency_obj = company.currency_id) }</u>
+ %endif
+ %if (a.get('account_type') !='view' or a.get('level') == 1):
+ ${ formatLang(a.get('balance'), currency_obj = company.currency_id) }
+ %endif
+ </td>
+ </tr>
+ %if a.get('level')==1:
+ <tr></tr>
+ %endif
+ %endif
+ %endfor
+ </table>
+ %endif
+ %if (not data['form']['enable_filter'] and not data['form']['debit_credit']):
+ <table class="mystyleone" width="100%">
+ <tr>
+ <td class="td_f12" width="80%"><b>${ _('Name') }</b></td>
+ <td class="td_f12_right" width="20%"><b>${ _('Balance') }</b></td>
+ </tr><tr></tr>
+ %for a in get_lines(data):
+ %if a.get('level') != 0:
+ <tr>
+ <td class="font${ min(6,a.get('level'))} padding${ min(6,a.get('level'))}">${ a.get('name') }</td>
+ <td class="font${ min(6,a.get('level'))} right">
+ %if (a.get('account_type') =='view' and a.get('level') != 1):
+ <u>${ formatLang(a.get('balance'), currency_obj = company.currency_id) }</u>
+ %endif
+ %if (a.get('account_type') !='view' or a.get('level') == 1):
+ ${ formatLang(a.get('balance'), currency_obj = company.currency_id) }
+ %endif
+ </td>
+ </tr>
+ %if a.get('level')==1:
+ <tr></tr>
+ %endif
+ %endif
+ %endfor
+ </table>
+ %endif
+ %if (data['form']['enable_filter'] == 1 and not data['form']['debit_credit']):
+ <table class="mystyleone" width="100%">
+ <tr>
+ <td class="td_f12" width="56%"><b>${ _('Name') }</b></td>
+ <td class="td_f12_right" width="22%"><b>${ _('Balance') }</b></td>
+ <td class="td_f12_right" width="22%"><b>${ data['form']['label_filter'] }</b></td>
+ </tr>
+ %for a in get_lines(data):
+ %if a.get('level') != 0:
+ <tr>
+ <td class="font${ min(6,a.get('level'))} padding${ min(6,a.get('level'))}">${ a.get('name') }</td>
+ <td class="font${ min(6,a.get('level'))} right">
+ %if (a.get('account_type') =='view' and a.get('level') != 1):
+ <u>${ formatLang(a.get('balance'), currency_obj = company.currency_id) }</u>
+ %endif
+ %if (a.get('account_type') !='view' or a.get('level') == 1):
+ ${ formatLang(a.get('balance'), currency_obj = company.currency_id) }
+ %endif
+ </td>
+ <td class="font${ min(6,a.get('level'))} right">
+ %if (a.get('account_type') =='view' and a.get('level') != 1):
+ <u>${ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) }</u>
+ %endif
+ %if (a.get('account_type') !='view' or a.get('level') == 1):
+ ${ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) }
+ %endif
+ </td>
+ </tr>
+ %if a.get('level')==1:
+ <tr></tr>
+ %endif
+ %endif
+ %endfor
+ </table>
+ %endif
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_financial_report.py'
--- account_webkit/report/account_financial_report.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_financial_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,113 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from openerp.tools.translate import _
+from account.report.common_report_header import common_report_header
+
+
+class report_account_common(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ super(report_account_common, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'get_lines': self.get_lines,
+ 'time': time,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_filter': self._get_filter,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ })
+ self.context = context
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'chart_account_id' in data['form'] and [data['form']['chart_account_id']] or []
+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
+ return super(report_account_common, self).set_context(objects, data, new_ids, report_type=report_type)
+
+ def get_lines(self, data):
+ lines = []
+ account_obj = self.pool.get('account.account')
+ currency_obj = self.pool.get('res.currency')
+ ids2 = self.pool.get('account.financial.report')._get_children_by_order(self.cr, self.uid, [data['form']['account_report_id'][0]], context=data['form']['used_context'])
+ for report in self.pool.get('account.financial.report').browse(self.cr, self.uid, ids2, context=data['form']['used_context']):
+ vals = {
+ 'name': report.name,
+ 'balance': report.balance * report.sign or 0.0,
+ 'type': 'report',
+ 'level': bool(report.style_overwrite) and report.style_overwrite or report.level,
+ 'account_type': report.type =='sum' and 'view' or False, #used to underline the financial report balances
+ }
+ if data['form']['debit_credit']:
+ vals['debit'] = report.debit
+ vals['credit'] = report.credit
+ if data['form']['enable_filter']:
+ vals['balance_cmp'] = self.pool.get('account.financial.report').browse(self.cr, self.uid, report.id, context=data['form']['comparison_context']).balance * report.sign or 0.0
+ lines.append(vals)
+ account_ids = []
+ if report.display_detail == 'no_detail':
+ #the rest of the loop is used to display the details of the financial report, so it's not needed here.
+ continue
+ if report.type == 'accounts' and report.account_ids:
+ account_ids = account_obj._get_children_and_consol(self.cr, self.uid, [x.id for x in report.account_ids])
+ elif report.type == 'account_type' and report.account_type_ids:
+ account_ids = account_obj.search(self.cr, self.uid, [('user_type','in', [x.id for x in report.account_type_ids])])
+ if account_ids:
+ for account in account_obj.browse(self.cr, self.uid, account_ids, context=data['form']['used_context']):
+ #if there are accounts to display, we add them to the lines with a level equals to their level in
+ #the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data
+ #financial reports for Assets, liabilities...)
+ if report.display_detail == 'detail_flat' and account.type == 'view':
+ continue
+ flag = False
+ vals = {
+ 'name': account.code + ' ' + account.name,
+ 'balance': account.balance != 0 and account.balance * report.sign or account.balance,
+ 'type': 'account',
+ 'level': report.display_detail == 'detail_with_hierarchy' and min(account.level + 1,6) or 6, #account.level + 1
+ 'account_type': account.type,
+ }
+
+ if data['form']['debit_credit']:
+ vals['debit'] = account.debit
+ vals['credit'] = account.credit
+ if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance']):
+ flag = True
+ if data['form']['enable_filter']:
+ vals['balance_cmp'] = account_obj.browse(self.cr, self.uid, account.id, context=data['form']['comparison_context']).balance * report.sign or 0.0
+ if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance_cmp']):
+ flag = True
+ if flag:
+ lines.append(vals)
+ return lines
+
+report_sxw.report_sxw('report.account.financial.report.webkit', 'account.financial.report',
+ 'addons/account_webkit/report/account_financial_report.mako', parser=report_account_common, header='internal')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_general_journal.mako'
--- account_webkit/report/account_general_journal.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_general_journal.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,348 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ %for o in periods(objects):
+ <br/>
+ <br/>
+ <table width="100%">
+ <tr class ="report_header">
+ <td align="center">
+ General Journal
+ </td>
+ </tr>
+ </table>
+ <p>
+ <%
+ if data['model']=='account.journal.period':
+ account_info = 'Company'
+ endif
+
+ if data['model']=='ir.ui.menu':
+ account_info = 'Chart of Accounts'
+ endif
+ %>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td align="center" class="left top" width="16%">
+ <small> ${_(account_info) }</small>
+ </td>
+ <td align="center" class="left top" width="16%">
+ <small>
+ <b> ${_('Fiscal Year')}</small>
+ </td>
+ <td align="center" class="left top" width="16%">
+ <small>
+ <b> ${_('Journal')}</small>
+ </td>
+ <td align="center" class="left top" width="20%">
+ <small>
+ <b>${_('Filter By')}</b>
+ </small>
+ </td>
+ <td align="center" class="left top right" width="16%">
+ <small>
+ <b>${_('Target Moves')}</b>
+ </small>
+ </td>
+ </tr>
+ <tr class="table_child_data" >
+ <td align="center" class="left top bottom" width="16%">
+ <small> ${ get_account(data) or '' }</small>
+ </td>
+ <td align="center" class="left top bottom" width="16%">
+ <small> ${ get_fiscalyear(data) or '' }</small>
+ </td>
+ <td align="center" class="left top bottom" width="16%">
+ <small> ${ ', '.join([ lt or '' for lt in get_journal(data) ])}</small>
+ </td>
+ <td align="center" class="left top bottom" width="16%">
+
+ %if data['form']['filter']=='filter_no':
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ <table>
+ <tr class="table_parent_data">
+ <td >
+ <center>
+ <b>${_('Start Date')}</b>
+ </center>
+ </td>
+ <td class="left">
+ <center>
+ <b>${_('End Date')}</b>
+ </center>
+ </td>
+ </tr>
+ <tr class="table_child_data">
+ <td >
+ <center>${ formatLang(get_start_date(data),date=True) }</center>
+ </td>
+ <td class="left">
+ <center>${ formatLang(get_end_date(data),date=True) }</center>
+ </td>
+ </tr>
+ </table>
+ %endif
+ %if data['form']['filter']=='filter_period':
+ <table >
+ <tr class="table_parent_data">
+ <td >
+ <center>
+ <b>${_('Start Period')}</b>
+ </center>
+ </td>
+ <td class="left">
+ <center>
+ <b>${_('End Period')}</b>
+ </center>
+ </td>
+ </tr>
+ <tr class="table_child_data">
+ <td >
+ <center>
+ %if get_start_period(data):
+ ${ get_start_period(data) }
+ %endif
+ </center>
+ </td>
+ <td class="left">
+ <center>
+ %if get_end_period(data):
+ ${ get_end_period(data) }
+ %endif
+ </center>
+ </td>
+ </tr>
+ </table>
+ %endif
+ </td>
+ <td align="center" class="left top bottom right" width="20%">
+ ${get_target_move(data)}
+ </td>
+ </tr>
+
+ </table>
+ <p>
+
+ %if display_currency(data)==False:
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${_('Code') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b> ${_('Journal Name')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b> ${_('Debit')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small>
+ <b>${_('Credit')}</b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>${_('Balance')}</b>
+ </small>
+ </td>
+ </tr>
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ _('Total:') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang(sum_debit()) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang( sum_credit()) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang( sum_debit()- sum_credit(), currency_obj=company.currency_id) }</small>
+ </td>
+ </tr>
+ </table>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ o.name } :</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b> ${ formatLang(sum_debit_period(o.id)) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small>
+ <b>${ formatLang(sum_credit_period(o.id)) }</b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>${formatLang(sum_credit_period(o.id)-sum_debit_period(o.id), currency_obj=company.currency_id)}</b>
+ </small>
+ </td>
+ </tr>
+ </table>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ %for line in (lines(o.id)):
+ <tr class="table_child_data" >
+ <td align="center" class="bottom" width="16%">
+ <small> ${ line['code'] }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ line['name'] }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['debit']) or ''}</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['credit']) or '' }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['credit']-line['debit'], currency_obj=company.currency_id ) }</small>
+ </td>
+ </tr>
+ %endfor
+ </table>
+ %endif
+
+ %if display_currency(data):
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${_('Code') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b> ${_('Journal Name')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b> ${_('Debit')}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small>
+ <b>${_('Credit')}</b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>${_('Balance')}</b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>${_('Currency')}</b>
+ </small>
+ </td>
+ </tr>
+
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ _('Total:') }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang(sum_debit()) or ''}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small> ${ formatLang( sum_credit()) or '' }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ formatLang( sum_debit()- sum_credit(), currency_obj=company.currency_id) or ''}</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ </td>
+ </tr>
+
+ </table>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header" >
+ <td align="center" class="head_bottom_border" width="16%">
+ <small> ${ o.name } :</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b> ${ formatLang(sum_debit_period(o.id)) }</small>
+ </td>
+ <td align="center" class="head_bottom_border" width="20%">
+ <small>
+ <b>${ formatLang(sum_credit_period(o.id)) }</b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>${formatLang(sum_credit_period(o.id)-sum_debit_period(o.id), currency_obj=company.currency_id) or ''}</b>
+ </small>
+ </td>
+ <td align="center" class="head_bottom_border" width="16%">
+ <small>
+ <b>
+ </b>
+ </small>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellspacing="0" cellpadding="0">
+ %for line in (lines(o.id)):
+ <tr class="table_child_data" >
+ <td align="center" class="bottom" width="16%">
+ <small> ${ line['code'] }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ line['name'] }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['debit']) or ''}</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['credit']) or '' }</small>
+ </td>
+ <td align="center" class="bottom" width="16%">
+ <small> ${ formatLang(line['credit']-line['debit'] , currency_obj=company.currency_id ) or ''}</small>
+ </td>
+ %if line['currency_id']!=None or line['amount_currency']!=None :
+ <td align="center" class="bottom" width="20%">
+ <small> ${ formatLang(line['amount_currency']) } ${line['currency_code'] or ''}</small>
+ </td>
+ %endif
+ </tr>
+ %endfor
+ </table>
+ %endif
+
+ <p style="page-break-after:always;">
+ </p>
+
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_general_journal.py'
--- account_webkit/report/account_general_journal.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_general_journal.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,164 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+
+class journal_print(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(journal_print, self).__init__(cr, uid, name, context=context)
+ self.period_ids = []
+ self.journal_ids = []
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'periods': self.periods,
+ 'sum_debit_period': self._sum_debit_period,
+ 'sum_credit_period': self._sum_credit_period,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_sortby': self._get_sortby,
+ 'get_filter': self._get_filter,
+ 'get_journal': self._get_journal,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'display_currency':self._display_currency,
+ 'get_target_move': self._get_target_move,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ obj_move = self.pool.get('account.move.line')
+ new_ids = ids
+ self.query_get_clause = ''
+ self.target_move = data['form'].get('target_move', 'all')
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
+ self.query_get_clause = 'AND '
+ self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
+ if new_ids:
+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
+ res = self.cr.fetchall()
+ self.period_ids, self.journal_ids = zip(*res)
+ return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
+
+ # returns a list of period objs
+ def periods(self, journal_period_objs):
+ dic = {}
+ def filter_unique(o):
+ key = o.period_id.id
+ res = key in dic
+ if not res:
+ dic[key] = True
+ return not res
+ filtered_objs = filter(filter_unique, journal_period_objs)
+ return map(lambda x: x.period_id, filtered_objs)
+
+ def lines(self, period_id):
+ if not self.journal_ids:
+ return []
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ self.cr.execute('SELECT j.code, j.name, l.amount_currency,c.symbol AS currency_code,l.currency_id, '
+ 'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
+ 'FROM account_move_line l '
+ 'LEFT JOIN account_move am ON (l.move_id=am.id) '
+ 'LEFT JOIN account_journal j ON (l.journal_id=j.id) '
+ 'LEFT JOIN res_currency c on (l.currency_id=c.id)'
+ 'WHERE am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' '
+ 'GROUP BY j.id, j.code, j.name, l.amount_currency, c.symbol, l.currency_id ',
+ (tuple(move_state), period_id, tuple(self.journal_ids)))
+ return self.cr.dictfetchall()
+
+ def _set_get_account_currency_code(self, account_id):
+ self.cr.execute("SELECT c.symbol AS code "\
+ "FROM res_currency c, account_account AS ac "\
+ "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
+ result = self.cr.fetchone()
+ if result:
+ self.account_currency = result[0]
+ else:
+ self.account_currency = False
+
+ def _get_account(self, data):
+ if data['model'] == 'account.journal.period':
+ return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
+ return super(journal_print, self)._get_account(data)
+
+ def _get_fiscalyear(self, data):
+ if data['model'] == 'account.journal.period':
+ return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
+ return super(journal_print, self)._get_fiscalyear(data)
+
+ def _display_currency(self, data):
+ if data['model'] == 'account.journal.period':
+ return True
+ return data['form']['amount_currency']
+
+ def _sum_debit_period(self, period_id, journal_id=False):
+ if journal_id:
+ journals = [journal_id]
+ else:
+ journals = self.journal_ids
+ if not journals:
+ return 0.0
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ self.cr.execute('SELECT SUM(l.debit) FROM account_move_line l '
+ 'LEFT JOIN account_move am ON (l.move_id=am.id) '
+ 'WHERE am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ' \
+ 'AND l.state<>\'draft\'',
+ (tuple(move_state), period_id, tuple(journals)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _sum_credit_period(self, period_id, journal_id=None):
+ if journal_id:
+ journals = [journal_id]
+ else:
+ journals = self.journal_ids
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ if not journals:
+ return 0.0
+ self.cr.execute('SELECT SUM(l.credit) FROM account_move_line l '
+ 'LEFT JOIN account_move am ON (l.move_id=am.id) '
+ 'WHERE am.state IN %s AND l.period_id=%s AND l.journal_id IN %s '+ self.query_get_clause + ' ' \
+ 'AND l.state<>\'draft\'',
+ (tuple(move_state), period_id, tuple(journals)))
+ return self.cr.fetchone()[0] or 0.0
+
+report_sxw.report_sxw('report.account.general.journal.webkit', 'account.journal.period', 'account/report/general_journal.mako', parser=journal_print, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_general_ledger.mako'
--- account_webkit/report/account_general_ledger.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_general_ledger.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,150 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ %for a in objects:
+ </br>
+ <center><h2>General Ledger</h2></center>
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell td_f12" width="19%"><b>${ _('Chart of Accounts') }</b></td>
+ <td class="cell td_f12" width="19%"><b>${ _('Fiscal Year') }</b></td>
+ <td class="cell td_f12" width="19%"><b>${ _('Journals') }</b></td>
+ <td class="cell td_f12" width="19%"><b>${ _('Filter By') }
+ %if data['form']['filter']!='filter_no':
+ ${ get_filter(data) }
+ %endif</b>
+ </td>
+ <td class="cell td_f12" width="24%"><b>${ _('Target Moves') }</b></td>
+ </tr>
+ <tr>
+ <td class="cell">${ get_account(data) or '' }</td>
+ <td class="cell">${ get_fiscalyear(data) or '' }</td>
+ <td class="cell">${ ', '.join([ lt or '' for lt in get_journal(data) ]) }</td>
+ <td class="cell">
+ %if data['form']['filter']=='filter_no':
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Date') }</td>
+ <td class="cell">${ _('End Date') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ formatLang(get_start_date(data),date=True) }</td>
+ <td class="cell">${ formatLang(get_end_date(data),date=True) }</td>
+ </tr>
+ </table>
+ %endif
+ %if data['form']['filter']=='filter_period':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Period') }</td>
+ <td class="cell">${ _('End Period') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ get_start_period(data) or '' }</td>
+ <td class="cell">${ get_end_period(data) or '' }</td>
+ </tr>
+ </table>
+ %endif
+ </td>
+ <td class="cell">${ get_target_move(data) }</td>
+ </tr>
+ </table>
+ %if data['form']['amount_currency'] == True:
+ </br>
+ <table class="tbl_header">
+ <tr>
+ <td class="td_f12" width="7%"><b>${ _('Date') }</b></td>
+ <td class="td_f12" width="5%"><b>${ _('JRNL') }</b></td>
+ <td class="td_f12" width="9%"><b>${ _('Partner') }</b></td>
+ <td class="td_f12" width="8%"><b>${ _('Ref') }</b></td>
+ <td class="td_f12" width="8%"><b>${ _('Move') }</b></td>
+ <td class="td_f12" width="9%"><b>${ _('Entry Label') }</b></td>
+ <td class="td_f12" width="5%"><b>${ _('Counterpart') }</b></td>
+ <td class="td_f12_right" width="11%"><b>${ _('Debit') }</b></td>
+ <td class="td_f12_right" width="11%"><b>${ _('Credit') }</b></td>
+ <td class="td_f12_right" width="14%"><b>${ _('Balance') }</b></td>
+ <td class="td_f12_right" width="14%"><b>${ _('Currency') }</b></td>
+ </tr><tr><td colspan="11"><table class="tr_bottom_line"></table></td></tr>
+ %for o in get_children_accounts(a):
+ <tr>
+ <td class="td_f12" colspan="7"><b>${ ' '*(o.level-1) } ${ o.code } ${ o.name }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>
+ %if o.currency_id:
+ ${ formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account'),currency_obj=o.currency_id) or '' }
+ %endif</b>
+ </td>
+ </tr><tr><td colspan="11"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %for line in lines(o):
+ <tr height="5.5mm">
+ <td class="td_f10">${ formatLang(line['ldate'],date=True) }</td>
+ <td class="td_f10">${ line['lcode'] }</td>
+ <td class="td_f10">${ strip_name(line['partner_name'] or '',10) }</td>
+ <td class="td_f10">${ line['lref'] and strip_name(line['lref'],9) }</td>
+ <td class="td_f10">${ strip_name(line['move'],9) }</td>
+ <td class="td_f10">${ strip_name(line['lname'],10) }</td>
+ <td class="td_f10">${ strip_name(line['line_corresp'],10) }</td>
+ <td class="td_f10_right">${ formatLang(line['debit'], digits=get_digits(dp='Account')) }</td>
+ <td class="td_f10_right">${ formatLang(line['credit'], digits=get_digits(dp='Account')) }</td>
+ <td class="td_f10_right">${ formatLang(line['progress'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }</td>
+ <td class="td_f10_right">
+ %if not (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None):
+ ${ formatLang(line['amount_currency']) } ${ line['currency_code'] or '' }
+ %endif
+ </td>
+ </tr><tr><td colspan="11"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endfor
+ </table>
+ %endif
+ %if data['form']['amount_currency'] == False:
+ </br>
+ <table class="tbl_header" >
+ <tr>
+ <td class="td_f12" width="8%"><b>${ _('Date') }</b></td>
+ <td class="td_f12" width="6%"><b>${ _('JRNL') }</b></td>
+ <td class="td_f12" width="10%"><b>${ _('Partner') }</b></td>
+ <td class="td_f12" width="9%"><b>${ _('Ref') }</b></td>
+ <td class="td_f12" width="9%"><b>${ _('Move') }</b></td>
+ <td class="td_f12" width="10%"><b>${ _('Entry Label') }</b></td>
+ <td class="td_f12" width="8%"><b>${ _('Counterpart') }</b></td>
+ <td class="td_f12_right" width="12%"><b>${ _('Debit') }</b></td>
+ <td class="td_f12_right" width="13%"><b>${ _('Credit') }</b></td>
+ <td class="td_f12_right" width="15%"><b>${ _('Balance') }</b></td>
+ </tr><tr><td colspan="10"><table class="tr_bottom_line"></table></td></tr>
+ %for o in get_children_accounts(a):
+ <tr>
+ <td class="td_f12" colspan="7"><b>${ ' '*(o.level-1) } ${ o.code } ${ o.name }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) }</b></td>
+ </tr><tr><td colspan="10"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %for line in lines(o):
+ <tr height="5.5mm">
+ <td class="td_f10">${ formatLang(line['ldate'],date=True) }</td>
+ <td class="td_f10">${ line['lcode'] }</td>
+ <td class="td_f10">${ strip_name(line['partner_name'] or '',10) }</td>
+ <td class="td_f10">${ line['lref'] and strip_name(line['lref'],9) }</td>
+ <td class="td_f10">${ strip_name(line['move'],9) }</td>
+ <td class="td_f10">${ strip_name(line['lname'],10) }</td>
+ <td class="td_f10">${ strip_name(line['line_corresp'],10) }</td>
+ <td class="td_f10_right">${ formatLang(line['debit'], digits=get_digits(dp='Account')) }</td>
+ <td class="td_f10_right">${ formatLang(line['credit'], digits=get_digits(dp='Account')) }</td>
+ <td class="td_f10_right">${ formatLang(line['progress'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }</td>
+ </tr><tr><td colspan="10"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endfor
+ </table>
+ %endif
+ %endfor
+ </body>
+</html>
=== added file 'account_webkit/report/account_general_ledger.py'
--- account_webkit/report/account_general_ledger.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_general_ledger.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,304 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import time
+from openerp.report import report_sxw
+from account.report.common_report_header import common_report_header
+
+class general_ledger(report_sxw.rml_parse,common_report_header):
+ _name = 'report.account.general.ledger'
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ obj_move = self.pool.get('account.move.line')
+ self.sortby = data['form'].get('sortby', 'sort_date')
+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{}))
+ ctx2 = data['form'].get('used_context',{}).copy()
+ self.init_balance = data['form'].get('initial_balance', True)
+ if self.init_balance:
+ ctx2.update({'initial_bal': True})
+ self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2)
+ self.display_account = data['form']['display_account']
+ self.target_move = data['form'].get('target_move', 'all')
+ ctx = self.context.copy()
+ ctx['fiscalyear'] = data['form']['fiscalyear_id']
+ if data['form']['filter'] == 'filter_period':
+ ctx['periods'] = data['form']['periods']
+ elif data['form']['filter'] == 'filter_date':
+ ctx['date_from'] = data['form']['date_from']
+ ctx['date_to'] = data['form']['date_to']
+ ctx['state'] = data['form']['target_move']
+ self.context.update(ctx)
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = [data['form']['chart_account_id']]
+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
+ return super(general_ledger, self).set_context(objects, data, new_ids, report_type=report_type)
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(general_ledger, self).__init__(cr, uid, name, context=context)
+ self.query = ""
+ self.tot_currency = 0.0
+ self.period_sql = ""
+ self.sold_accounts = {}
+ self.sortby = 'sort_date'
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit_account': self._sum_debit_account,
+ 'sum_credit_account': self._sum_credit_account,
+ 'sum_balance_account': self._sum_balance_account,
+ 'sum_currency_amount_account': self._sum_currency_amount_account,
+ 'get_children_accounts': self.get_children_accounts,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_journal': self._get_journal,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_filter': self._get_filter,
+ 'get_sortby': self._get_sortby,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'get_target_move': self._get_target_move,
+ })
+ self.context = context
+
+ def _sum_currency_amount_account(self, account):
+ self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
+ FROM account_move_line l \
+ WHERE l.account_id = %s AND %s' %(account.id, self.query))
+ sum_currency = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
+ FROM account_move_line l \
+ WHERE l.account_id = %s AND %s '%(account.id, self.init_query))
+ sum_currency += self.cr.fetchone()[0] or 0.0
+ return sum_currency
+
+ def get_children_accounts(self, account):
+ res = []
+ currency_obj = self.pool.get('res.currency')
+ ids_acc = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id)
+ currency = account.currency_id and account.currency_id or account.company_id.currency_id
+ for child_account in self.pool.get('account.account').browse(self.cr, self.uid, ids_acc, context=self.context):
+ sql = """
+ SELECT count(id)
+ FROM account_move_line AS l
+ WHERE %s AND l.account_id = %%s
+ """ % (self.query)
+ self.cr.execute(sql, (child_account.id,))
+ num_entry = self.cr.fetchone()[0] or 0
+ sold_account = self._sum_balance_account(child_account)
+ self.sold_accounts[child_account.id] = sold_account
+ if self.display_account == 'movement':
+ if child_account.type != 'view' and num_entry <> 0:
+ res.append(child_account)
+ elif self.display_account == 'not_zero':
+ if child_account.type != 'view' and num_entry <> 0:
+ if not currency_obj.is_zero(self.cr, self.uid, currency, sold_account):
+ res.append(child_account)
+ else:
+ res.append(child_account)
+ if not res:
+ return [account]
+ return res
+
+ def lines(self, account):
+ """ Return all the account_move_line of account with their account code counterparts """
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted', '']
+ # First compute all counterpart strings for every move_id where this account appear.
+ # Currently, the counterpart info is used only in landscape mode
+ sql = """
+ SELECT m1.move_id,
+ array_to_string(ARRAY(SELECT DISTINCT a.code
+ FROM account_move_line m2
+ LEFT JOIN account_account a ON (m2.account_id=a.id)
+ WHERE m2.move_id = m1.move_id
+ AND m2.account_id<>%%s), ', ') AS counterpart
+ FROM (SELECT move_id
+ FROM account_move_line l
+ LEFT JOIN account_move am ON (am.id = l.move_id)
+ WHERE am.state IN %s and %s AND l.account_id = %%s GROUP BY move_id) m1
+ """% (tuple(move_state), self.query)
+ self.cr.execute(sql, (account.id, account.id))
+ counterpart_res = self.cr.dictfetchall()
+ counterpart_accounts = {}
+ for i in counterpart_res:
+ counterpart_accounts[i['move_id']] = i['counterpart']
+ del counterpart_res
+
+ # Then select all account_move_line of this account
+ if self.sortby == 'sort_journal_partner':
+ sql_sort='j.code, p.name, l.move_id'
+ else:
+ sql_sort='l.date, l.move_id'
+ sql = """
+ SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id,
+ m.name AS move_name, m.id AS mmove_id,per.code as period_code,
+ c.symbol AS currency_code,
+ i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number,
+ p.name AS partner_name
+ FROM account_move_line l
+ JOIN account_move m on (l.move_id=m.id)
+ LEFT JOIN res_currency c on (l.currency_id=c.id)
+ LEFT JOIN res_partner p on (l.partner_id=p.id)
+ LEFT JOIN account_invoice i on (m.id =i.move_id)
+ LEFT JOIN account_period per on (per.id=l.period_id)
+ JOIN account_journal j on (l.journal_id=j.id)
+ WHERE %s AND m.state IN %s AND l.account_id = %%s ORDER by %s
+ """ %(self.query, tuple(move_state), sql_sort)
+ self.cr.execute(sql, (account.id,))
+ res_lines = self.cr.dictfetchall()
+ res_init = []
+ if res_lines and self.init_balance:
+ #FIXME: replace the label of lname with a string translatable
+ sql = """
+ SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
+ '' AS move_name, '' AS mmove_id, '' AS period_code,
+ '' AS currency_code,
+ NULL AS currency_id,
+ '' AS invoice_id, '' AS invoice_type, '' AS invoice_number,
+ '' AS partner_name
+ FROM account_move_line l
+ LEFT JOIN account_move m on (l.move_id=m.id)
+ LEFT JOIN res_currency c on (l.currency_id=c.id)
+ LEFT JOIN res_partner p on (l.partner_id=p.id)
+ LEFT JOIN account_invoice i on (m.id =i.move_id)
+ JOIN account_journal j on (l.journal_id=j.id)
+ WHERE %s AND m.state IN %s AND l.account_id = %%s
+ """ %(self.init_query, tuple(move_state))
+ self.cr.execute(sql, (account.id,))
+ res_init = self.cr.dictfetchall()
+ res = res_init + res_lines
+ account_sum = 0.0
+ for l in res:
+ l['move'] = l['move_name'] != '/' and l['move_name'] or ('*'+str(l['mmove_id']))
+ l['partner'] = l['partner_name'] or ''
+ account_sum += l['debit'] - l['credit']
+ l['progress'] = account_sum
+ l['line_corresp'] = l['mmove_id'] == '' and ' ' or counterpart_accounts[l['mmove_id']].replace(', ',',')
+ # Modification of amount Currency
+ if l['credit'] > 0:
+ if l['amount_currency'] != None:
+ l['amount_currency'] = abs(l['amount_currency']) * -1
+ if l['amount_currency'] != None:
+ self.tot_currency = self.tot_currency + l['amount_currency']
+ return res
+
+ def _sum_debit_account(self, account):
+ if account.type == 'view':
+ return account.debit
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT sum(debit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_debit = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(debit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_debit += self.cr.fetchone()[0] or 0.0
+ return sum_debit
+
+ def _sum_credit_account(self, account):
+ if account.type == 'view':
+ return account.credit
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT sum(credit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_credit = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(credit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_credit += self.cr.fetchone()[0] or 0.0
+ return sum_credit
+
+ def _sum_balance_account(self, account):
+ if account.type == 'view':
+ return account.balance
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_balance = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_balance += self.cr.fetchone()[0] or 0.0
+ return sum_balance
+
+ def _get_account(self, data):
+ if data['model'] == 'account.account':
+ return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
+ return super(general_ledger ,self)._get_account(data)
+
+ def _get_sortby(self, data):
+ if self.sortby == 'sort_date':
+ return self._translate('Date')
+ elif self.sortby == 'sort_journal_partner':
+ return self._translate('Journal & Partner')
+ return self._translate('Date')
+
+report_sxw.report_sxw('report.account.general.ledger.webkit', 'account.account', 'addons/account_webkit/report/account_general_ledger.mako', parser=general_ledger, header='internal')
+report_sxw.report_sxw('report.account.general.ledger_landscape.webkit', 'account.account', 'addons/account_webkit/report/account_general_ledger_landscape.mako', parser=general_ledger, header='internal landscape')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_general_ledger_landscape.mako'
--- account_webkit/report/account_general_ledger_landscape.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_general_ledger_landscape.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,178 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body direction: rtl;>
+ %for a in objects:
+ </br>
+ <center><h2>General Ledger</h2></center>
+ <table cellspacing="0" class="cell" >
+ <tr>
+ <td class="cell td_f12" width="14%"><b>
+ %if data['model']=='account.account':
+ ${ _('Company') }
+ %endif
+ %if data['model']=='ir.ui.menu':
+ ${ _('Chart of Accounts') }
+ %endif</b>
+ </td>
+ <td class="cell td_f12" width="14%"><b>${ _('Fiscal Year') }</b></td>
+ <td class="cell td_f12" width="14%"><b>${ _('Journals') }</b></td>
+ <td class="cell td_f12" width="14%"><b>${ _('Display Account') }</b></td>
+ <td class="cell td_f12" width="14%"><b>${ _('Filter By') }
+ %if data['form']['filter']!='filter_no':
+ ${ get_filter(data) }
+ %endif</b>
+ </td>
+ <td class="cell td_f12" width="17%"><b>${ _('Entries Sorted By') }</b></td>
+ <td class="cell td_f12" width="13%"><b>${ _('Target Moves') }</b></td>
+ </tr>
+ <tr>
+ <td class="cell">
+ %if get_account(data):
+ ${ get_account(data) }
+ %endif
+ </td>
+ <td class="cell">${ get_fiscalyear(data) or '' }</td>
+ <td class="cell">${ ', '.join([ lt or '' for lt in get_journal(data) ]) }</td>
+ <td class="cell">
+ %if data['form']['display_account']=='all':
+ ${ _('All') }
+ %elif data['form']['display_account']=='movement':
+ ${ _('With movements') }
+ %else:
+ ${ _('With balance is not equal to 0') }
+ %endif
+ </td>
+ <td class="cell">
+ %if data['form']['filter']=='filter_no':
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Date') }</td>
+ <td class="cell">${ _('End Date') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ formatLang(get_start_date(data),date=True) }</td>
+ <td class="cell">${ formatLang(get_end_date(data),date=True) }</td>
+ </tr>
+ </table>
+ %endif
+ %if data['form']['filter']=='filter_period':
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell">${ _('Start Period') }</td>
+ <td class="cell">${ _('End Period') }</td>
+ </tr>
+ <tr>
+ <td class="cell">${ get_start_period(data) }</td>
+ <td class="cell">${ get_end_period(data) }</td>
+ </tr>
+ </table>
+ %endif
+ </td>
+ <td class="cell">${ get_sortby(data) }</td>
+ <td class="cell">${ get_target_move(data) }</td>
+ </tr>
+ </table>
+ %if data['form']['amount_currency'] == True:
+ </br>
+ <table class="tbl_header">
+ <tr>
+ <td class="td_f12" width="6%"><b>${ _('Date') }</b></td>
+ <td class="td_f12" width="5%"><b>${ _('Period') }</b></td>
+ <td class="td_f12" width="4%"><b>${ _('JRNL') }</b></td>
+ <td class="td_f12" width="12%"><b>${ _('Partner') }</b></td>
+ <td class="td_f12" width="8%"><b>${ _('Ref') }</b></td>
+ <td class="td_f12" width="7%"><b>${ _('Move') }</b></td>
+ <td class="td_f12" width="13%"><b>${ _('Entry Label') }</b></td>
+ <td class="td_f12" width="9%"><b>${ _('Counterpart') }</b></td>
+ <td class="td_f12_right" width="8%"><b>${ _('Debit') }</b></td>
+ <td class="td_f12_right" width="8%"><b>${ _('Credit') }</b></td>
+ <td class="td_f12_right" width="10%"><b>${ _('Balance') }</b></td>
+ <td class="td_f12_right" width="10%"><b>${ _('Currency') }</b></td>
+ </tr><tr><td colspan="12"><table class="tr_bottom_line"></table></td></tr>
+ %for o in get_children_accounts(a):
+ <tr>
+ <td class="td_f12" colspan="8"><b>${ ' '*(o.level-1) } ${ o.code } ${ o.name }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>
+ %if o.currency_id:
+ ${ formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account'),currency_obj=o.currency_id) or '' }
+ %endif</b>
+ </td>
+ </tr><tr><td colspan="12"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %for line in lines(o):
+ <tr height="5.5mm">
+ <td class="td_f10"><div class="nobrk">${ formatLang(line['ldate'],date=True) }</div></td>
+ <td class="td_f10"><div class="nobrk">${ line['period_code'] }</div></td>
+ <td class="td_f10"><div class="nobrk">${ line['lcode'] }</div></td>
+ <td class="td_f10"><div class="nobrk">${ strip_name(line['partner_name'] or '',20) }</div></td>
+ <td class="td_f10"><div class="nobrk">${ line['lref'] and strip_name(line['lref'],17) }</div></td>
+ <td class="td_f10"><div class="nobrk">${ line['move'] }</div></td>
+ <td class="td_f10"><div class="nobrk">${ strip_name(line['lname'],22) }</div></td>
+ <td class="td_f10"><div class="nobrk">${ strip_name(line['line_corresp'],18) }</div></td>
+ <td class="td_f10_right"><div class="nobrk">${ formatLang(line['debit'], digits=get_digits(dp='Account')) }</div></td>
+ <td class="td_f10_right"><div class="nobrk">${ formatLang(line['credit'], digits=get_digits(dp='Account')) }</div></td>
+ <td class="td_f10_right"><div class="nobrk">${ formatLang(line['progress'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }</div></td>
+ <td class="td_f10_right"><div class="nobrk">
+ %if not (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None):
+ ${ formatLang(line['amount_currency']) } ${ line['currency_code'] or '' }
+ %endif
+ </div></td>
+ </tr><tr><td colspan="12"><div class="nobrk"><table class="tr_bottom_line_light_grey"></table></div></td></tr>
+ %endfor
+ %endfor
+ </table>
+ %endif
+ %if data['form']['amount_currency'] == False:
+ </br>
+ <table class="tbl_header">
+ <tr>
+ <td class="td_f12" width="7%"><b>${ _('Date') }</b></td>
+ <td class="td_f12" width="6%"><b>${ _('Period') }</b></td>
+ <td class="td_f12" width="5%"><b>${ _('JRNL') }</b></td>
+ <td class="td_f12" width="13%"><b>${ _('Partner') }</b></td>
+ <td class="td_f12" width="9%"><b>${ _('Ref') }</b></td>
+ <td class="td_f12" width="8%"><b>${ _('Move') }</b></td>
+ <td class="td_f12" width="13%"><b>${ _('Entry Label') }</b></td>
+ <td class="td_f12" width="10%"><b>${ _('Counterpart') }</b></td>
+ <td class="td_f12_right" width="9%"><b>${ _('Debit') }</b></td>
+ <td class="td_f12_right" width="9%"><b>${ _('Credit') }</b></td>
+ <td class="td_f12_right" width="11%"><b>${ _('Balance') }</b></td>
+ </tr><tr><td colspan="11"><table class="tr_bottom_line"></table></td></tr>
+ %for o in get_children_accounts(a):
+ <tr>
+ <td class="td_f12" colspan="8"><b>${ ' '*(o.level-1) } ${ o.code } ${ o.name }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) }</b></td>
+ </tr><tr><td colspan="11"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %for line in lines(o):
+ <tr height="5.5mm">
+ <td class="td_f10">${ formatLang(line['ldate'],date=True) }</td>
+ <td class="td_f10">${ line['period_code'] }</td>
+ <td class="td_f10">${ line['lcode'] }</td>
+ <td class="td_f10">${ strip_name(line['partner_name'] or '',20) }</td>
+ <td class="td_f10">${ line['lref'] and strip_name(line['lref'],17) }</td>
+ <td class="td_f10">${ line['move'] }</td>
+ <td class="td_f10">${ strip_name(line['lname'],22) }</td>
+ <td class="td_f10">${ strip_name(line['line_corresp'],18) }</td>
+ <td class="td_f10_right">${ formatLang(line['debit'], digits=get_digits(dp='Account')) }</td>
+ <td class="td_f10_right">${ formatLang(line['credit'], digits=get_digits(dp='Account')) }</td>
+ <td class="td_f10_right">${ formatLang(line['progress'], digits=get_digits(dp='Account'), currency_obj=company.currency_id) }</td>
+ </tr><tr><td colspan="11"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endfor
+ </table>
+ %endif
+ <p style="page-break-after:always"></p>
+ %endfor
+ </body>
+</html>
=== added file 'account_webkit/report/account_journal.mako'
--- account_webkit/report/account_journal.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_journal.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,292 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+
+ <body>
+
+
+ <br/>
+ <br/>
+ <table width="100%">
+ <tr class ="report_header">
+ <td align="center">
+ Journal
+ </td>
+ </tr>
+ </table>
+ <%
+ if data['model']=='account.journal.period':
+ account_info = 'Company'
+ endif
+
+ if data['model']=='ir.ui.menu':
+ account_info = 'Chart of Accounts'
+ endif
+ %>
+ %for o in objects:
+ <table width="100%" cellspacing="0" cellpadding="0" class="cell">
+ <tr class="table_parent_data" >
+ <td align="center" class="cell">
+ <small> ${ _(account_info) }</small>
+ </td>
+ <td align="center" class="cell">
+ <small><b> ${_('Fiscal Year')}</small>
+ </td>
+ <td align="center" class="cell">
+ <small><b> ${_('Journal')}</small>
+ </td>
+ <td align="center" class="cell">
+ <small><b> ${_('Periods')}</small>
+ </td>
+ <td align="center" class="cell">
+ <small><b>${_('Entries Sorted By')}</b></small>
+ </td>
+ <td align="center" class="cell">
+ <small><b>${_('Target Moves')}</b></small>
+ </td>
+ </tr>
+ <tr class="table_child_data" >
+ <td align="center" class="cell">
+ <small> ${ get_account(data) or '' }</small>
+ </td>
+ <td align="center" class="cell">
+ <small> ${ get_fiscalyear(data) or '' }</small>
+ </td>
+ <td align="center" class="cell">
+ <small> ${ o.journal_id.name or ''}</small>
+ </td>
+ <td align="center" class="cell">
+ <small> ${ o.period_id.name or '' }</small>
+ </td>
+ <td align="center" class="cell">
+ <small>${ get_sortby(data) }</small>
+ </td>
+ <td align="center" class="cell">
+ <small>${ get_target_move(data) }</b></small>
+ </td>
+ </tr>
+
+ </table>
+ <p>
+
+ %if display_currency(data) == False:
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data" >
+ <td class="head_bottom_border" width="16%">
+ <small> ${ _('Move') }</small>
+ </td>
+ <td class="head_bottom_border" width="16%">
+ <small><b> ${_('Date')}</small>
+ </td>
+ <td class="head_bottom_border" width="16%">
+ <small><b> ${_('Account')}</small>
+ </td>
+ <td class="head_bottom_border" width="16%">
+ <small><b> ${_('Partner')}</small>
+ </td>
+ <td class="head_bottom_border" width="16%">
+ <small><b>${_('Label')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%" align="right">
+ <small><b>${_('Debit')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%" align="right">
+ <small><b>${_('Credit')}</b></small>
+ </td>
+ </tr>
+ <%
+ counter = 0
+ %>
+
+ %for line in lines(o.period_id.id, o.journal_id.id):
+
+ <% counter += 1 %>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data">
+ <td width="16%" >
+ <%
+ if line.move_id.name <> '/':
+ name = line.move_id.name
+ else:
+ name = ('*'+str(line.move_id.id))
+ %>
+ ${_(name)}
+ </td>
+ <td width="16%" >
+ ${formatLang(line.date,date=True)}
+ </td >
+ <td width="16%" >
+ ${line.account_id.code}
+ </td>
+ <td width="16%" >
+ ${line.partner_id and strip_name(line.partner_id.name,15)}
+ </td>
+ <td width="16%" >
+ ${strip_name(line.name,25)}
+ </td>
+ <td width="10%" align="right" >
+ ${formatLang(line.debit, currency_obj=company.currency_id)}
+ </td>
+ <td width="10%" align="right" >
+ ${formatLang(line.credit, currency_obj=company.currency_id)}
+ </td>
+ </tr>
+
+ </table>
+ %if counter % 2==0:
+
+ <table width="100%">
+ <tr>
+ <td class="tr_bottom_line_light_grey">
+ </td>
+ </tr>
+ </table>
+ %endif
+ %endfor
+ <table width="100%">
+ <tr>
+ <td width="100%" colspan="2"></td>
+ </tr>
+ <tr>
+ <td width="70%"></td>
+ <td width="30%" class="tr_bottom_line_black" align="right"></td>
+ </tr>
+ </table>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td width="57%"></td>
+ <td width="11%">
+ ${_('Total')}:
+ </td>
+ <td width="11%" align="right">
+ ${formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" align="right">
+ ${formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </td>
+ </tr>
+ </table>
+ %endif
+
+ %if display_currency(data):
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data" >
+ <td class="head_bottom_border" width="12%">
+ <small> ${ _('Move') }</small>
+ </td>
+ <td class="head_bottom_border" width="12%">
+ <small><b> ${_('Date')}</small>
+ </td>
+ <td class="head_bottom_border" width="12%">
+ <small><b> ${_('Account')}</small>
+ </td>
+ <td class="head_bottom_border" width="12%">
+ <small><b> ${_('Partner')}</small>
+ </td>
+ <td class="head_bottom_border" width="20%">
+ <small><b>${_('Label')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="11%" align="right">
+ <small><b>${_('Debit')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="11%" align="right">
+ <small><b>${_('Credit')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%" align="right">
+ <small><b>${_('Currency')}</b></small>
+ </td>
+ </tr>
+
+ <%
+ counter1 = 0
+ %>
+
+ %for line in lines(o.period_id.id, o.journal_id.id):
+
+ <% counter1 += 1 %>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data">
+ <td width="12%" >
+ <%
+ if line.move_id.name <> '/':
+ name = line.move_id.name
+ else:
+ name = ('*'+str(line.move_id.id))
+ %>
+ ${_(name)}
+ </td>
+ <td width="12%" >
+ ${formatLang(line.date,date=True)}
+ </td >
+ <td width="12%" >
+ ${line.account_id.code}
+ </td>
+ <td width="12%" >
+ ${line.partner_id and strip_name(line.partner_id.name,12)}
+ </td>
+ <td width="20%" >
+ ${strip_name(line.name,16)}
+ </td>
+ <td width="11%" align="right" >
+ ${formatLang(line.debit, currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" align="right" >
+ ${formatLang(line.credit, currency_obj=company.currency_id)}
+ </td>
+ <td width="10%" align="center" >
+ ${line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or ''}
+ </td>
+ </tr>
+
+ </table>
+ %if counter1 % 2 ==0:
+ <table width="100%">
+ <tr>
+ <td class="tr_bottom_line_light_grey">
+ </td>
+ </tr>
+ </table>
+ %endif
+ %endfor
+
+ <table width="100%">
+ <tr>
+ <td width="100%" colspan="2"></td>
+ </tr>
+ <tr>
+ <td width="60%"></td>
+ <td width="40%" class="tr_bottom_line_black" align="right"></td>
+ </tr>
+ </table>
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td width="57%"></td>
+ <td width="11%" align="center">
+ ${_('Total')}:
+ </td>
+ <td width="11%" align="right">
+ ${formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </td>
+ <td width="11%" align="right">
+ ${formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </td>
+ <td width="10%"></td>
+ </tr>
+ </table>
+ %endif
+
+ <p style="page-break-after:always">
+ </p>
+
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_journal.py'
--- account_webkit/report/account_journal.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_journal.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,204 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+
+class journal_print(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(journal_print, self).__init__(cr, uid, name, context=context)
+ self.period_ids = []
+ self.last_move_id = False
+ self.journal_ids = []
+ self.sort_selection = 'am.name'
+ self.localcontext.update({
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_account': self._get_account,
+ 'get_filter': self._get_filter,
+ 'get_start_date': self._get_start_date,
+ 'get_end_date': self._get_end_date,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'display_currency':self._display_currency,
+ 'get_sortby': self._get_sortby,
+ 'get_target_move': self._get_target_move,
+ 'check_last_move_id': self.check_last_move_id,
+ 'set_last_move_id': self.set_last_move_id,
+ 'tax_codes': self.tax_codes,
+ 'sum_vat': self._sum_vat,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ obj_move = self.pool.get('account.move.line')
+ new_ids = ids
+ self.query_get_clause = ''
+ self.target_move = data['form'].get('target_move', 'all')
+ if (data['model'] == 'ir.ui.menu'):
+ self.period_ids = tuple(data['form']['periods'])
+ self.journal_ids = tuple(data['form']['journal_ids'])
+ new_ids = data['form'].get('active_ids', [])
+ self.query_get_clause = 'AND '
+ self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
+ self.sort_selection = data['form'].get('sort_selection', 'date')
+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
+ elif new_ids:
+ #in case of direct access from account.journal.period object, we need to set the journal_ids and periods_ids
+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
+ res = self.cr.fetchall()
+ self.period_ids, self.journal_ids = zip(*res)
+ return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
+
+ def set_last_move_id(self, move_id):
+ self.last_move_id = move_id
+
+ def check_last_move_id(self, move_id):
+ '''
+ return True if we need to draw a gray line above this line, used to separate moves
+ '''
+ if self.last_move_id:
+ return not(self.last_move_id == move_id)
+ return False
+
+ def tax_codes(self, period_id, journal_id):
+ ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid,
+ [('journal_id', '=', journal_id), ('period_id', '=', period_id)])
+ self.cr.execute(
+ 'select distinct tax_code_id from account_move_line ' \
+ 'where period_id=%s and journal_id=%s and tax_code_id is not null and state<>\'draft\'',
+ (period_id, journal_id)
+ )
+ ids = map(lambda x: x[0], self.cr.fetchall())
+ tax_code_ids = []
+ if ids:
+ self.cr.execute('select id from account_tax_code where id in %s order by code', (tuple(ids),))
+ tax_code_ids = map(lambda x: x[0], self.cr.fetchall())
+ tax_codes = self.pool.get('account.tax.code').browse(self.cr, self.uid, tax_code_ids)
+ return tax_codes
+
+ def _sum_vat(self, period_id, journal_id, tax_code_id):
+ self.cr.execute('select sum(tax_amount) from account_move_line where ' \
+ 'period_id=%s and journal_id=%s and tax_code_id=%s and state<>\'draft\'',
+ (period_id, journal_id, tax_code_id))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _sum_debit(self, period_id=False, journal_id=False):
+ if journal_id and isinstance(journal_id, int):
+ journal_id = [journal_id]
+ if period_id and isinstance(period_id, int):
+ period_id = [period_id]
+ if not journal_id:
+ journal_id = self.journal_ids
+ if not period_id:
+ period_id = self.period_ids
+ if not (period_id and journal_id):
+ return 0.0
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ self.cr.execute('SELECT SUM(debit) FROM account_move_line l, account_move am '
+ 'WHERE l.move_id=am.id AND am.state IN %s AND l.period_id IN %s AND l.journal_id IN %s ' + self.query_get_clause + ' ',
+ (tuple(move_state), tuple(period_id), tuple(journal_id)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def _sum_credit(self, period_id=False, journal_id=False):
+ if journal_id and isinstance(journal_id, int):
+ journal_id = [journal_id]
+ if period_id and isinstance(period_id, int):
+ period_id = [period_id]
+ if not journal_id:
+ journal_id = self.journal_ids
+ if not period_id:
+ period_id = self.period_ids
+ if not (period_id and journal_id):
+ return 0.0
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ self.cr.execute('SELECT SUM(l.credit) FROM account_move_line l, account_move am '
+ 'WHERE l.move_id=am.id AND am.state IN %s AND l.period_id IN %s AND l.journal_id IN %s '+ self.query_get_clause+'',
+ (tuple(move_state), tuple(period_id), tuple(journal_id)))
+ return self.cr.fetchone()[0] or 0.0
+
+ def lines(self, period_id, journal_id=False):
+ if not journal_id:
+ journal_id = self.journal_ids
+ else:
+ journal_id = [journal_id]
+ obj_mline = self.pool.get('account.move.line')
+ self.cr.execute('update account_journal_period set state=%s where journal_id IN %s and period_id=%s and state=%s', ('printed', self.journal_ids, period_id, 'draft'))
+
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + ', l.move_id',(tuple(move_state), period_id, tuple(journal_id) ))
+ ids = map(lambda x: x[0], self.cr.fetchall())
+ return obj_mline.browse(self.cr, self.uid, ids)
+
+ def _set_get_account_currency_code(self, account_id):
+ self.cr.execute("SELECT c.symbol AS code "\
+ "FROM res_currency c,account_account AS ac "\
+ "WHERE ac.id = %s AND ac.currency_id = c.id" % (account_id))
+ result = self.cr.fetchone()
+ if result:
+ self.account_currency = result[0]
+ else:
+ self.account_currency = False
+
+ def _get_fiscalyear(self, data):
+ if data['model'] == 'account.journal.period':
+ return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name
+ return super(journal_print, self)._get_fiscalyear(data)
+
+ def _get_account(self, data):
+ if data['model'] == 'account.journal.period':
+ return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name
+ return super(journal_print, self)._get_account(data)
+
+ def _display_currency(self, data):
+ if data['model'] == 'account.journal.period':
+ return True
+ return data['form']['amount_currency']
+
+ def _get_sortby(self, data):
+ # TODO: deprecated, to remove in trunk
+ if self.sort_selection == 'date':
+ return self._translate('Date')
+ elif self.sort_selection == 'ref':
+ return self._translate('Reference Number')
+ return self._translate('Date')
+
+report_sxw.report_sxw('report.account.journal.period.print.webkit', 'account.journal.period', 'addons/account_webkit/report/account_journal.mako', parser=journal_print, header='external')
+report_sxw.report_sxw('report.account.journal.period.print.sale.purchase.webkit', 'account.journal.period', 'addons/account_webkit/report/account_journal_sale_purchase.mako', parser=journal_print, header='external')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_journal_sale_purchase.mako'
--- account_webkit/report/account_journal_sale_purchase.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_journal_sale_purchase.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,306 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+
+
+ </br>
+ </br>
+ <table width="100%">
+ <tr class ="report_header">
+ <td align="center">
+ Journal
+ </td>
+ </tr>
+ </table>
+ <%
+ if data['model']=='account.journal.period':
+ account_info = 'Company'
+ endif
+
+ if data['model']=='ir.ui.menu':
+ account_info = 'Chart of Accounts'
+ endif
+ %>
+ %for o in objects:
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td align="center" class="left top">
+ <small> ${ _(account_info) }</small>
+ </td>
+ <td align="center" class="left top">
+ <small><b> ${_('Fiscal Year')}</small>
+ </td>
+ <td align="center" class="left top">
+ <small><b> ${_('Journal')}</small>
+ </td>
+ <td align="center" class="left top">
+ <small><b> ${_('Periods')}</small>
+ </td>
+ <td align="center" class="left top">
+ <small><b>${_('Entries Sorted By')}</b></small>
+ </td>
+ <td align="center" class="left top right">
+ <small><b>${_('Target Moves')}</b></small>
+ </td>
+ </tr>
+ <tr class="table_child_data" >
+ <td align="center" class="left top bottom">
+ <small> ${ get_account(data) or '' }</small>
+ </td>
+ <td align="center" class="left top bottom">
+ <small> ${ get_fiscalyear(data) or '' }</small>
+ </td>
+ <td align="center" class="left top bottom">
+ <small> ${ o.journal_id.name or ''}</small>
+ </td>
+ <td align="center" class="left top bottom">
+ <small> ${ o.period_id.name or '' }</small>
+ </td>
+ <td align="center" class="left top bottom">
+ <small>${ get_sortby(data) }</small>
+ </td>
+ <td align="center" class="left top bottom right">
+ <small>${ get_target_move(data) }</b></small>
+ </td>
+ </tr>
+
+ </table>
+ <p>
+
+ %if display_currency(data) == False:
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data" >
+ <td class="head_bottom_border" width="11%">
+ <small> ${ _('Move') }</small>
+ </td>
+ <td " class="head_bottom_border" width="11%">
+ <small><b> ${_('Date')}</small>
+ </td>
+ <td class="head_bottom_border" width="11%">
+ <small><b> ${_('Account')}</small>
+ </td>
+ <td class="head_bottom_border" width="11%">
+ <small><b> ${_('Partner')}</small>
+ </td>
+ <td class="head_bottom_border" width="11%">
+ <small><b>${_('Label')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="11%">
+ </td>
+ <td class="head_bottom_border" width="11%">
+ <small><b>${_('Tax')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="11%" align="right">
+ <small><b>${_('Debit')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="12%" align="right">
+ <small><b>${_('Credit')}</b></small>
+ </td>
+ </tr>
+
+ %for line in lines(o.period_id.id, o.journal_id.id):
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data">
+ <td width="11%" ><div class="nobrk">
+ <%
+ if line.move_id.name <> '/':
+ name = line.move_id.name
+ else:
+ name = ('*'+str(line.move_id.id))
+ %>
+ ${_(name)}
+ </div></td>
+ <td width="11%" ><div class="nobrk">
+ ${formatLang(line.date,date=True)}
+ </div></td >
+ <td width="11%" ><div class="nobrk">
+ ${line.account_id.code}
+ </div></td>
+ <td width="11%" ><div class="nobrk">
+ ${line.partner_id and strip_name(line.partner_id.name,15)}
+ </div></td>
+ <td width="11%" ><div class="nobrk">
+ ${strip_name(line.name,25)}
+ </div></td>
+ <td width="11%" ><div class="nobrk">
+ %if line.tax_code_id:
+ %if line.tax_code_id.code:
+ ${ line.tax_code_id.code + ':' }
+ %endif
+ %endif
+ </div></td>
+ <td width="11%" ><div class="nobrk">
+ ${line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id)}
+ </div></td>
+ <td width="11%" align="right" ><div class="nobrk">
+ ${formatLang(line.debit, currency_obj=company.currency_id)}
+ </div></td>
+ <td width="12%" align="right" ><div class="nobrk">
+ ${formatLang(line.credit, currency_obj=company.currency_id)}
+ </div></td>
+ </tr>
+
+ </table>
+ %endfor
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td width="11%"><div class="nobrk"></div></td>
+ <td width="11%"><div class="nobrk"></div></td>
+ <td width="11%"><div class="nobrk"></div></td>
+ <td width="11%"><div class="nobrk"></div> </td>
+ <td width="11%"><div class="nobrk"></div></td>
+ <td width="11%"><div class="nobrk"></div></td>
+ <td width="11%" class="head_bottom_border"><div class="nobrk">
+ ${_('Total')}:
+ </div></td>
+ <td width="11%" align="right" class="head_bottom_border"><div class="nobrk">
+ ${formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </div></td>
+ <td width="12%" align="right" class="head_bottom_border"><div class="nobrk">
+ ${formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </div></td>
+ </tr>
+ </table>
+ %endif
+
+ %if display_currency(data):
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data" >
+ <td class="head_bottom_border" width="10%">
+ <small> ${ _('Move') }</small>
+ </td>
+ <td " class="head_bottom_border" width="10%">
+ <small><b> ${_('Date')}</small>
+ </td>
+ <td class="head_bottom_border" width="10%">
+ <small><b> ${_('Account')}</small>
+ </td>
+ <td class="head_bottom_border" width="10%">
+ <small><b> ${_('Partner')}</small>
+ </td>
+ <td class="head_bottom_border" width="10%">
+ <small><b>${_('Label')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%">
+ </td>
+ <td class="head_bottom_border" width="10%">
+ <small><b>${_('Tax')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%" align="right">
+ <small><b>${_('Debit')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%" align="right">
+ <small><b>${_('Credit')}</b></small>
+ </td>
+ <td class="head_bottom_border" width="10%" align="right">
+ <small><b>${_('Currency')}</b></small>
+ </td>
+ </tr>
+
+ %for line in lines(o.period_id.id, o.journal_id.id):
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_child_data">
+ <td width="10%" ><div class="nobrk">
+ <%
+ if line.move_id.name <> '/':
+ name = line.move_id.name
+ else:
+ name = ('*'+str(line.move_id.id))
+ %>
+ ${_(name)}
+ </div></td>
+ <td width="10%" ><div class="nobrk">
+ ${formatLang(line.date,date=True)}
+ </div></td >
+ <td width="10%" ><div class="nobrk">
+ ${line.account_id.code}
+ </div></td>
+ <td width="10%" ><div class="nobrk">
+ ${line.partner_id and strip_name(line.partner_id.name,12)}
+ </div></td>
+ <td width="10%" ><div class="nobrk">
+ ${strip_name(line.name,16)}
+ </div></td>
+ <td width="10%" ><div class="nobrk">
+ %if line.tax_code_id:
+ %if line.tax_code_id.code:
+ ${ line.tax_code_id.code + ':' }
+ %endif
+ %endif
+ </div></td>
+
+ <td width="10%" ><div class="nobrk">
+ ${line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id)}
+ </div></td>
+ <td width="10%" align="right" ><div class="nobrk">
+ ${formatLang(line.debit, currency_obj=company.currency_id)}
+ </div></td>
+ <td width="10%" align="right" ><div class="nobrk">
+ ${formatLang(line.credit, currency_obj=company.currency_id)}
+ </div></td>
+ <td width="10%" align="center" ><div class="nobrk">
+ ${line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or ''}
+ </div></td>
+ </tr>
+
+ </table>
+ %endfor
+
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_parent_data" >
+ <td width="20%"><div class="nobrk"></div></td>
+ <td width="20%"><div class="nobrk"></div></td>
+ <td width="10%"><div class="nobrk"></div></td>
+ <td width="20%" align="center"><div class="nobrk">
+ ${_('Total')}:
+ </div></td>
+ <td width="10%" align="right"><div class="nobrk">
+ ${formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </div></td>
+ <td width="10%" align="right"><div class="nobrk">
+ ${formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id)}
+ </div></td>
+ <td width="10%"><div class="nobrk"></div></td>
+ </tr>
+ </table>
+ %endif
+ <p>
+ <table width="100%" cellspacing="0" cellpadding="0" align="center">
+ <tr>
+ <td width="25%" class="head_bottom_border"> Tax Declaration</td>
+ <td width="25%" class="head_bottom_border"></td>
+ <td width="25%" class="head_bottom_border"></td>
+ <td width="25%" class="head_bottom_border"></td>
+ </tr>
+ </table>
+ <table width="100%" cellspacing="0" cellpadding="0" align="center">
+
+ <tr>
+ %for t in (tax_codes(o.period_id.id,o.journal_id.id)):
+ <td width="40%>
+ %if t.code:
+ ${ t.code + ': ' }
+ %endif
+ </td>
+ <td width="10%>${ formatLang(sum_vat( o.period_id.id, o.journal_id.id, t.id)) }</td>
+ <td width="20%></td>
+ <td width="30%> ${ t.name }</td>
+ %endfor
+ </tr>
+ </table>
+ </p>
+ <p style="page-break-after:always">
+ </p>
+
+ %endfor
+
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_partner_balance.mako'
--- account_webkit/report/account_partner_balance.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_partner_balance.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,119 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body direction: rtl;>
+ <center><h2>Partner Balance</h2></center>
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell" width="15%" ><center><b>${_('Chart of Accounts')}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Fiscal Year')}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Journals')}</b></center></td>
+ <td class="cell" width="25%"><center><b>${_('Filter By')}
+ %if data['form']['filter']!='filter_no' and get_filter(data):
+ ${ data['form']['filter']!='filter_no' and get_filter(data) }
+ %endif
+ </b></center></td>
+ <td class="cell" width="15%"><center><b>${_("Partner's")}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Target Moves')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell" "><center>
+ %if get_account(data):
+ ${ get_account(data) }
+ %endif
+ </center></td>
+
+ <td class="cell"><center>
+ %if get_fiscalyear(data):
+ ${ get_fiscalyear(data) }
+ %endif
+ </center></td>
+
+ <td class="cell"><center>${ ', '.join([ lt or '' for lt in get_journal(data) ]) }</center></td>
+
+ <td class="cell"><center>
+ %if data['form']['filter']=='filter_no':
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ <table class="cell">
+ <tr>
+ <td class="cell"><center><b>${_('Start Date')}</b></center></td>
+ <td class="cell"><center><b>${_('End Date')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>${ formatLang(get_start_date(data),date=True) }</center></td>
+ <td class="cell"><center>${ formatLang(get_end_date(data),date=True) }</center></td>
+ </tr>
+ </table>
+ %endif
+ %if data['form']['filter']=='filter_period':
+ <table class="cell">
+ <tr>
+ <td class="cell"><center><b>${_('Start Period')}</b></center></td>
+ <td class="cell"><center><b>${_('End Period')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>
+ %if get_start_period(data):
+ ${ get_start_period(data) }
+ %endif
+ </center></td>
+ <td class="cell"><center>
+ %if get_end_date(data):
+ ${ get_end_date(data) }
+ %endif
+ </center></td>
+ </tr>
+ </table>
+ %endif
+ </center></td>
+ <td class="cell"><center>${ get_partners() }</center></td>
+ <td class="cell"><center>${ get_target_move(data) }</center></td>
+ </tr>
+ </table>
+ </br>
+ <table class="tbl_header">
+ <tr>
+ <td align="center"><b>${_('Code')}</b></td>
+ <td align="center"><b>${_('Partner Name/Account Name')}</b></td>
+ <td align="right"><b>${_('Debit')}</b></td>
+ <td align="right"><b>${_('Credit')}</b></td>
+ <td align="right"><b>${_('Balance')}</b></td>
+ <td align="right"><b>${_('In dispute')}</b></td>
+ </tr>
+ <tr><td colspan="6"><table class="tr_bottom_line"></table></td></tr>
+ <tr>
+ <td align="center"><b>${_('Total:')}</b></td>
+ <td align="center"><b></b></td>
+ <td align="right"><b><u>${ formatLang(sum_debit()) }</u></b></td>
+ <td align="right"><b><u>${ formatLang(sum_credit()) }</u></b></td>
+ <td align="right"><b><u>${ formatLang((sum_debit()-sum_credit()), currency_obj=company.currency_id) }</u></b></td>
+ <td align="right"><b><u>${ formatLang(sum_litige(), currency_obj=company.currency_id) }</u></b></td>
+ </tr>
+ <tr><td colspan="6"><table class="tr_bottom_line"></table></td></tr>
+ %for a in lines():
+ <tr class="tr_bottom_line">
+ %if a['type']==3:
+ <td align="center"><b>${ a['ref'] or '' } ${ a['type']==3 and a['code'] or '' }</b></td>
+ <td align="center"><b>${ a['name'] }</b></td>
+ <td align="right"><b>${ formatLang(a['debit']) }</b></td>
+ <td align="right"><b>${ formatLang(a['credit']) }</b></td>
+ <td align="right"><b>${ formatLang(a['balance'],currency_obj=company.currency_id) }</b></td>
+ <td align="right"><b>${ formatLang(a['enlitige'] or 0.0,currency_obj=company.currency_id) }</b></td>
+ %elif a['type']!=3:
+ <td align="center">${ a['ref'] or '' } ${ a['type']==3 and a['code'] or '' }</td>
+ <td align="center">${ a['name'] }</td>
+ <td align="right">${ formatLang(a['debit']) }</td>
+ <td align="right">${ formatLang(a['credit']) }</td>
+ <td align="right">${ formatLang(a['balance'],currency_obj=company.currency_id) }</td>
+ <td align="right">${ formatLang(a['enlitige'] or 0.0,currency_obj=company.currency_id) }</td>
+ %endif
+ </tr><tr><td colspan="6"><table class="tr_bottom_line"></table></td></tr>
+ %endfor
+ </table>
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_partner_balance.py'
--- account_webkit/report/account_partner_balance.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_partner_balance.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,309 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+
+from openerp.tools.translate import _
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+
+class partner_balance(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ super(partner_balance, self).__init__(cr, uid, name, context=context)
+ self.account_ids = []
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'sum_litige': self._sum_litige,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_journal': self._get_journal,
+ 'get_filter': self._get_filter,
+ 'get_account': self._get_account,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_partners':self._get_partners,
+ 'get_target_move': self._get_target_move,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ self.display_partner = data['form'].get('display_partner', 'non-zero_balance')
+ obj_move = self.pool.get('account.move.line')
+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
+ self.result_selection = data['form'].get('result_selection')
+ self.target_move = data['form'].get('target_move', 'all')
+
+ if (self.result_selection == 'customer' ):
+ self.ACCOUNT_TYPE = ('receivable',)
+ elif (self.result_selection == 'supplier'):
+ self.ACCOUNT_TYPE = ('payable',)
+ else:
+ self.ACCOUNT_TYPE = ('payable', 'receivable')
+
+ self.cr.execute("SELECT a.id " \
+ "FROM account_account a " \
+ "LEFT JOIN account_account_type t " \
+ "ON (a.type = t.code) " \
+ "WHERE a.type IN %s " \
+ "AND a.active", (self.ACCOUNT_TYPE,))
+ self.account_ids = [a for (a,) in self.cr.fetchall()]
+ return super(partner_balance, self).set_context(objects, data, ids, report_type=report_type)
+
+ def lines(self):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ full_account = []
+ self.cr.execute(
+ "SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code,p.name, sum(debit) AS debit, sum(credit) AS credit, " \
+ "CASE WHEN sum(debit) > sum(credit) " \
+ "THEN sum(debit) - sum(credit) " \
+ "ELSE 0 " \
+ "END AS sdebit, " \
+ "CASE WHEN sum(debit) < sum(credit) " \
+ "THEN sum(credit) - sum(debit) " \
+ "ELSE 0 " \
+ "END AS scredit, " \
+ "(SELECT sum(debit-credit) " \
+ "FROM account_move_line l " \
+ "WHERE partner_id = p.id " \
+ "AND " + self.query + " " \
+ "AND blocked = TRUE " \
+ ") AS enlitige " \
+ "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
+ "JOIN account_account ac ON (l.account_id = ac.id)" \
+ "JOIN account_move am ON (am.id = l.move_id)" \
+ "WHERE ac.type IN %s " \
+ "AND am.state IN %s " \
+ "AND " + self.query + "" \
+ "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
+ "ORDER BY l.account_id,p.name",
+ (self.ACCOUNT_TYPE, tuple(move_state)))
+ res = self.cr.dictfetchall()
+
+
+ if self.display_partner == 'non-zero_balance':
+ full_account = [r for r in res if r['sdebit'] > 0 or r['scredit'] > 0]
+ else:
+ full_account = [r for r in res]
+
+ for rec in full_account:
+ if not rec.get('name', False):
+ rec.update({'name': _('Unknown Partner')})
+
+ ## We will now compute Total
+ subtotal_row = self._add_subtotal(full_account)
+ return subtotal_row
+
+ def _add_subtotal(self, cleanarray):
+ i = 0
+ completearray = []
+ tot_debit = 0.0
+ tot_credit = 0.0
+ tot_scredit = 0.0
+ tot_sdebit = 0.0
+ tot_enlitige = 0.0
+ for r in cleanarray:
+ # For the first element we always add the line
+ # type = 1 is the line is the first of the account
+ # type = 2 is an other line of the account
+ if i==0:
+ # We add the first as the header
+ #
+ ##
+ new_header = {}
+ new_header['ref'] = ''
+ new_header['name'] = r['account_name']
+ new_header['code'] = r['code']
+ new_header['debit'] = r['debit']
+ new_header['credit'] = r['credit']
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = r['debit'] - r['credit']
+ new_header['type'] = 3
+ ##
+ completearray.append(new_header)
+ #
+ r['type'] = 1
+ r['balance'] = float(r['sdebit']) - float(r['scredit'])
+
+ completearray.append(r)
+ #
+ tot_debit = r['debit']
+ tot_credit = r['credit']
+ tot_scredit = r['scredit']
+ tot_sdebit = r['sdebit']
+ tot_enlitige = (r['enlitige'] or 0.0)
+ #
+ else:
+ if cleanarray[i]['account_id'] <> cleanarray[i-1]['account_id']:
+
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+ # we reset the counter
+ tot_debit = r['debit']
+ tot_credit = r['credit']
+ tot_scredit = r['scredit']
+ tot_sdebit = r['sdebit']
+ tot_enlitige = (r['enlitige'] or 0.0)
+ #
+ ##
+ new_header = {}
+ new_header['ref'] = ''
+ new_header['name'] = r['account_name']
+ new_header['code'] = r['code']
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+ ##get_fiscalyear
+ ##
+
+ completearray.append(new_header)
+ ##
+ #
+ r['type'] = 1
+ #
+ r['balance'] = float(r['sdebit']) - float(r['scredit'])
+
+ completearray.append(r)
+
+ if cleanarray[i]['account_id'] == cleanarray[i-1]['account_id']:
+ # we reset the counter
+
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+ new_header['type'] = 3
+
+ tot_debit = tot_debit + r['debit']
+ tot_credit = tot_credit + r['credit']
+ tot_scredit = tot_scredit + r['scredit']
+ tot_sdebit = tot_sdebit + r['sdebit']
+ tot_enlitige = tot_enlitige + (r['enlitige'] or 0.0)
+
+ new_header['debit'] = tot_debit
+ new_header['credit'] = tot_credit
+ new_header['scredit'] = tot_scredit
+ new_header['sdebit'] = tot_sdebit
+ new_header['enlitige'] = tot_enlitige
+ new_header['balance'] = float(tot_sdebit) - float(tot_scredit)
+
+ #
+ r['type'] = 2
+ #
+ r['balance'] = float(r['sdebit']) - float(r['scredit'])
+ #
+
+ completearray.append(r)
+
+ i = i + 1
+ return completearray
+
+ def _sum_debit(self):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ if not self.ids:
+ return 0.0
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line AS l " \
+ "JOIN account_move am ON (am.id = l.move_id)" \
+ "WHERE l.account_id IN %s" \
+ "AND am.state IN %s" \
+ "AND " + self.query + "",
+ (tuple(self.account_ids), tuple(move_state)))
+ temp_res = float(self.cr.fetchone()[0] or 0.0)
+ return temp_res
+
+ def _sum_credit(self):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ if not self.ids:
+ return 0.0
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line AS l " \
+ "JOIN account_move am ON (am.id = l.move_id)" \
+ "WHERE l.account_id IN %s" \
+ "AND am.state IN %s" \
+ "AND " + self.query + "",
+ (tuple(self.account_ids), tuple(move_state)))
+ temp_res = float(self.cr.fetchone()[0] or 0.0)
+ return temp_res
+
+ def _sum_litige(self):
+ #gives the total of move lines with blocked boolean set to TRUE for the report selection
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ if not self.ids:
+ return 0.0
+ self.cr.execute(
+ "SELECT sum(debit-credit) " \
+ "FROM account_move_line AS l " \
+ "JOIN account_move am ON (am.id = l.move_id)" \
+ "WHERE l.account_id IN %s" \
+ "AND am.state IN %s" \
+ "AND " + self.query + " " \
+ "AND l.blocked=TRUE ",
+ (tuple(self.account_ids), tuple(move_state), ))
+ temp_res = float(self.cr.fetchone()[0] or 0.0)
+ return temp_res
+
+ def _get_partners(self):
+
+ if self.result_selection == 'customer':
+ return _('Receivable Accounts')
+ elif self.result_selection == 'supplier':
+ return _('Payable Accounts')
+ elif self.result_selection == 'customer_supplier':
+ return _('Receivable and Payable Accounts')
+ return ''
+
+report_sxw.report_sxw('report.account.partner.balance.webkit', 'res.partner', 'addons/account_webkit/report/account_partner_balance.mako',parser=partner_balance, header="internal")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_partner_ledger.mako'
--- account_webkit/report/account_partner_ledger.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_partner_ledger.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,172 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body direction: rtl; onload="subst()">
+ %for p in objects:
+ <% setLang(p.lang) %>
+ </br>
+ <center><h2>Partner Ledger</h2></center>
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell" width="15%" ><center><b>${_('Chart of Accounts')}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Fiscal Year')}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Journals')}</b></center></td>
+ <td class="cell" width="25%"><center><b>${_('Filter By')}
+ %if data['form']['filter'] not in ('filter_no','unreconciled'):
+ ${ get_filter(data) }
+ %endif
+ </b></center></td>
+ <td class="cell" width="15%"><center><b>${_("Partner's")}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Target Moves')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>
+ %if get_account(data):
+ ${ get_account(data) }
+ %endif
+ </center></td>
+
+ <td class="cell"><center>
+ %if get_fiscalyear(data):
+ ${ get_fiscalyear(data) }
+ %endif
+ </center></td>
+
+ <td class="cell"><center>${ ', '.join([ lt or '' for lt in get_journal(data) ]) }</center></td>
+
+ <td class="cell"><center>
+ %if data['form']['filter'] in ('filter_no','unreconciled'):
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ ${ get_filter(data) }
+ %if data['form']['filter']=='filter_date':
+ <table class="cell">
+ <tr>
+ <td class="cell"><center><b>${_('Start Date')}</b></center></td>
+ <td class="cell"><center><b>${_('End Date')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>${ formatLang(get_start_date(data),date=True) }</center></td>
+ <td class="cell"><center>${ formatLang(get_end_date(data),date=True) }</center></td>
+ </tr>
+ </table>
+ %endif
+ %endif
+ %if data['form']['filter']=='filter_period':
+ ${ get_filter(data) }
+ <table class="cell">
+ <tr>
+ <td class="cell"><center><b>${_('Start Period')}</b></center></td>
+ <td class="cell"><center><b>${_('End Period')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>
+ ${ get_start_period(data) }
+ </center></td>
+ <td class="cell"><center>
+ ${ get_end_period(data) }
+ </center></td>
+ </tr>
+ </table>
+
+ %endif
+ </center></td>
+ <td class="cell"><center>${ get_partners() }</center></td>
+ <td class="cell"><center>${ get_target_move(data) }</center></td>
+ </tr>
+ </table>
+ </br>
+ <table class="tbl_header">
+ %if display_currency(data) == False:
+ <tr>
+ <td class="td_f12" width="9%"><b>${_('Date')}</b></td>
+ <td class="td_f12" width="5%"><b>${_('JRNL')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Ref')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Account')}</b></td>
+ <td class="td_f12" width="24%"><b>${_('Entry Label')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Debit')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Credit')}</b></td>
+ <td class="td_f12_right" width="14%"><b>${_('Balance')}</b></td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line"></table></td></tr>
+ <tr>
+ <td colspan="5" class="td_f12"><b> ${p.ref or ''} - ${p.name or ''}</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_credit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) }</b></td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %if data['form']['initial_balance']==True:
+ <tr>
+ <td colspan="5" class="td_f12"><b>Initial Balance</b></td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][0]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][1]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) }</td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %endif
+ %for line in lines(p):
+ <tr>
+ <td class="td_f10">${ formatLang(line['date'],date=True) }</td>
+ <td class="td_f10">${ line['code'] }</td>
+ <td class="td_f10">${ line['move_name'] }</td>
+ <td class="td_f10">${ line['a_code'] }</td>
+ <td class="td_f10">${ line['ref'] and strip_name(line['ref'],10) } - ${ strip_name(line['name'],15) }</td>
+ <td class="td_f10_right">${ formatLang((line['debit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['credit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['progress']), currency_obj=company.currency_id) }</td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endif
+ %if display_currency(data) == True:
+ <tr>
+ <td class="td_f12" width="9%"><b>${_('Date')}</b></td>
+ <td class="td_f12" width="5%"><b>${_('JRNL')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Ref')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Account')}</b></td>
+ <td class="td_f12" width="24%"><b>${_('Entry Label')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Debit')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Credit')}</b></td>
+ <td class="td_f12_right" width="7%"><b>${_('Balance')}</b></td>
+ <td class="td_f12_right" width="7%"><b>${_('Currency')}</b></td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line"></table></td></tr>
+ <tr>
+ <td colspan="5" class="td_f12"><b> ${p.ref or ''} - ${p.name or ''}</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_credit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) }</b></td>
+ <td> </td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %if data['form']['initial_balance']==True:
+ <tr>
+ <td colspan="5" class="td_f12"><b>${_('Initial Balance')}</b></td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][0]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][1]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) }</td>
+ <td> </td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %endif
+ %for line in lines(p):
+ <tr>
+ <td class="td_f10">${ formatLang(line['date'],date=True) }</td>
+ <td class="td_f10">${ line['code'] }</td>
+ <td class="td_f10">${ line['move_name'] }</td>
+ <td class="td_f10">${ line['a_code'] }</td>
+ <td class="td_f10">${ line['ref'] and strip_name(line['ref'],10) } - ${ strip_name(line['name'],15) }</td>
+ <td class="td_f10_right">${ formatLang((line['debit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['credit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['progress']), currency_obj=company.currency_id) }</td>
+ <td class="td_f10_right">
+ %if (line['currency_id']==None or line['amount_currency']==None):
+ ${ formatLang(line['amount_currency']) } ${ line['currency_code'] or '' }
+ %endif
+ </td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endif
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_partner_ledger.py'
--- account_webkit/report/account_partner_ledger.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_partner_ledger.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,311 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import re
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from openerp.tools.translate import _
+from account.report.common_report_header import common_report_header
+
+
+class third_party_ledger(report_sxw.rml_parse, common_report_header):
+
+ def __init__(self, cr, uid, name, context=None):
+ super(third_party_ledger, self).__init__(cr, uid, name, context=context)
+ self.init_bal_sum = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit_partner': self._sum_debit_partner,
+ 'sum_credit_partner': self._sum_credit_partner,
+ 'get_currency': self._get_currency,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_account': self._get_account,
+ 'get_filter': self._get_filter,
+ 'get_start_date': self._get_start_date,
+ 'get_end_date': self._get_end_date,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_journal': self._get_journal,
+ 'get_partners':self._get_partners,
+ 'get_intial_balance':self._get_intial_balance,
+ 'display_initial_balance':self._display_initial_balance,
+ 'display_currency':self._display_currency,
+ 'get_target_move': self._get_target_move,
+ })
+
+ def _get_filter(self, data):
+ if data['form']['filter'] == 'unreconciled':
+ return _('Unreconciled Entries')
+ return super(third_party_ledger, self)._get_filter(data)
+
+ def set_context(self, objects, data, ids, report_type=None):
+ obj_move = self.pool.get('account.move.line')
+ obj_partner = self.pool.get('res.partner')
+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
+ ctx2 = data['form'].get('used_context',{}).copy()
+ self.initial_balance = data['form'].get('initial_balance', True)
+ if self.initial_balance:
+ ctx2.update({'initial_bal': True})
+ self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2)
+ self.reconcil = True
+ if data['form']['filter'] == 'unreconciled':
+ self.reconcil = False
+ self.result_selection = data['form'].get('result_selection', 'customer')
+ self.amount_currency = data['form'].get('amount_currency', False)
+ self.target_move = data['form'].get('target_move', 'all')
+ PARTNER_REQUEST = ''
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ if self.result_selection == 'supplier':
+ self.ACCOUNT_TYPE = ['payable']
+ elif self.result_selection == 'customer':
+ self.ACCOUNT_TYPE = ['receivable']
+ else:
+ self.ACCOUNT_TYPE = ['payable','receivable']
+
+ self.cr.execute(
+ "SELECT a.id " \
+ "FROM account_account a " \
+ "LEFT JOIN account_account_type t " \
+ "ON (a.type=t.code) " \
+ 'WHERE a.type IN %s' \
+ "AND a.active", (tuple(self.ACCOUNT_TYPE), ))
+ self.account_ids = [a for (a,) in self.cr.fetchall()]
+ params = [tuple(move_state), tuple(self.account_ids)]
+ #if we print from the partners, add a clause on active_ids
+ if (data['model'] == 'res.partner') and ids:
+ PARTNER_REQUEST = "AND l.partner_id IN %s"
+ params += [tuple(ids)]
+ self.cr.execute(
+ "SELECT DISTINCT l.partner_id " \
+ "FROM account_move_line AS l, account_account AS account, " \
+ " account_move AS am " \
+ "WHERE l.partner_id IS NOT NULL " \
+ "AND l.account_id = account.id " \
+ "AND am.id = l.move_id " \
+ "AND am.state IN %s"
+# "AND " + self.query +" " \
+ "AND l.account_id IN %s " \
+ " " + PARTNER_REQUEST + " " \
+ "AND account.active ", params)
+ self.partner_ids = [res['partner_id'] for res in self.cr.dictfetchall()]
+ objects = obj_partner.browse(self.cr, self.uid, self.partner_ids)
+ return super(third_party_ledger, self).set_context(objects, data, self.partner_ids, report_type)
+
+ def lines(self, partner):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ full_account = []
+ if self.reconcil:
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND l.reconcile_id IS NULL"
+ self.cr.execute(
+ "SELECT l.id, l.date, j.code, acc.code as a_code, acc.name as a_name, l.ref, m.name as move_name, l.name, l.debit, l.credit, l.amount_currency,l.currency_id, c.symbol AS currency_code " \
+ "FROM account_move_line l " \
+ "LEFT JOIN account_journal j " \
+ "ON (l.journal_id = j.id) " \
+ "LEFT JOIN account_account acc " \
+ "ON (l.account_id = acc.id) " \
+ "LEFT JOIN res_currency c ON (l.currency_id=c.id)" \
+ "LEFT JOIN account_move m ON (m.id=l.move_id)" \
+ "WHERE l.partner_id = %s " \
+ "AND l.account_id IN %s AND " + self.query +" " \
+ "AND m.state IN %s " \
+ " " + RECONCILE_TAG + " "\
+ "ORDER BY l.date",
+ (partner.id, tuple(self.account_ids), tuple(move_state)))
+ res = self.cr.dictfetchall()
+ sum = 0.0
+ if self.initial_balance:
+ sum = self.init_bal_sum
+ for r in res:
+ sum += r['debit'] - r['credit']
+ r['progress'] = sum
+ full_account.append(r)
+ return full_account
+
+ def _get_intial_balance(self, partner):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+ if self.reconcil:
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND l.reconcile_id IS NULL"
+ self.cr.execute(
+ "SELECT COALESCE(SUM(l.debit),0.0), COALESCE(SUM(l.credit),0.0), COALESCE(sum(debit-credit), 0.0) " \
+ "FROM account_move_line AS l, " \
+ "account_move AS m "
+ "WHERE l.partner_id = %s " \
+ "AND m.id = l.move_id " \
+ "AND m.state IN %s "
+ "AND account_id IN %s" \
+ " " + RECONCILE_TAG + " "\
+ "AND " + self.init_query + " ",
+ (partner.id, tuple(move_state), tuple(self.account_ids)))
+ res = self.cr.fetchall()
+ self.init_bal_sum = res[0][2]
+ return res
+
+ def _sum_debit_partner(self, partner):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ result_tmp = 0.0
+ result_init = 0.0
+ if self.reconcil:
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND reconcile_id IS NULL"
+ if self.initial_balance:
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line AS l, " \
+ "account_move AS m "
+ "WHERE l.partner_id = %s" \
+ "AND m.id = l.move_id " \
+ "AND m.state IN %s "
+ "AND account_id IN %s" \
+ " " + RECONCILE_TAG + " " \
+ "AND " + self.init_query + " ",
+ (partner.id, tuple(move_state), tuple(self.account_ids)))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_init = contemp[0] or 0.0
+ else:
+ result_init = result_tmp + 0.0
+
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line AS l, " \
+ "account_move AS m "
+ "WHERE l.partner_id = %s " \
+ "AND m.id = l.move_id " \
+ "AND m.state IN %s "
+ "AND account_id IN %s" \
+ " " + RECONCILE_TAG + " " \
+ "AND " + self.query + " ",
+ (partner.id, tuple(move_state), tuple(self.account_ids),))
+
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+
+ return result_tmp + result_init
+
+ def _sum_credit_partner(self, partner):
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted']
+
+ result_tmp = 0.0
+ result_init = 0.0
+ if self.reconcil:
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND reconcile_id IS NULL"
+ if self.initial_balance:
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line AS l, " \
+ "account_move AS m "
+ "WHERE l.partner_id = %s" \
+ "AND m.id = l.move_id " \
+ "AND m.state IN %s "
+ "AND account_id IN %s" \
+ " " + RECONCILE_TAG + " " \
+ "AND " + self.init_query + " ",
+ (partner.id, tuple(move_state), tuple(self.account_ids)))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_init = contemp[0] or 0.0
+ else:
+ result_init = result_tmp + 0.0
+
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line AS l, " \
+ "account_move AS m "
+ "WHERE l.partner_id=%s " \
+ "AND m.id = l.move_id " \
+ "AND m.state IN %s "
+ "AND account_id IN %s" \
+ " " + RECONCILE_TAG + " " \
+ "AND " + self.query + " ",
+ (partner.id, tuple(move_state), tuple(self.account_ids),))
+
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+ return result_tmp + result_init
+
+ def _get_partners(self):
+ # TODO: deprecated, to remove in trunk
+ if self.result_selection == 'customer':
+ return _('Receivable Accounts')
+ elif self.result_selection == 'supplier':
+ return _('Payable Accounts')
+ elif self.result_selection == 'customer_supplier':
+ return _('Receivable and Payable Accounts')
+ return ''
+
+ def _sum_currency_amount_account(self, account, form):
+ self._set_get_account_currency_code(account.id)
+ self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,))
+ total = self.cr.fetchone()
+ if self.account_currency:
+ return_field = str(total[0]) + self.account_currency
+ return return_field
+ else:
+ currency_total = self.tot_currency = 0.0
+ return currency_total
+
+ def _display_initial_balance(self, data):
+ if self.initial_balance:
+ return True
+ return False
+
+ def _display_currency(self, data):
+ if self.amount_currency:
+ return True
+ return False
+
+report_sxw.report_sxw('report.account.third_party_ledger.webkit', 'res.partner',
+ 'addons/account_webkit/report/account_partner_ledger.mako',parser=third_party_ledger,
+ header='internal')
+
+report_sxw.report_sxw('report.account.third_party_ledger_other.webkit', 'res.partner',
+ 'addons/account_webkit/report/account_partner_ledger_other.mako',parser=third_party_ledger,
+ header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_partner_ledger_other.mako'
--- account_webkit/report/account_partner_ledger_other.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_partner_ledger_other.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,175 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body direction: rtl;>
+ <center><h2>Partner Ledger</h2></center>
+ <table cellspacing="0" class="cell">
+ <tr>
+ <td class="cell" width="15%" ><center><b>${_('Chart of Accounts')}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Fiscal Year')}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Journals')}</b></center></td>
+ <td class="cell" width="25%"><center><b>${_('Filter By')}
+ %if data['form']['filter'] not in ('filter_no','unreconciled'):
+ ${ get_filter(data) }
+ %endif
+ </b></center></td>
+ <td class="cell" width="15%"><center><b>${_("Partner's")}</b></center></td>
+ <td class="cell" width="15%"><center><b>${_('Target Moves')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>
+ %if get_account(data):
+ ${ get_account(data) }
+ %endif
+ </center></td>
+
+ <td class="cell"><center>
+ %if get_fiscalyear(data):
+ ${ get_fiscalyear(data) }
+ %endif
+ </center></td>
+
+ <td class="cell"><center>${ ', '.join([ lt or '' for lt in get_journal(data) ]) }</center></td>
+
+ <td class="cell"><center>
+ %if data['form']['filter'] in ('filter_no','unreconciled'):
+ ${ get_filter(data) }
+ %endif
+ %if data['form']['filter']=='filter_date':
+ ${ get_filter(data) }
+ %if data['form']['filter']=='filter_date':
+ <table class="cell">
+ <tr>
+ <td class="cell"><center><b>${_('Start Date')}</b></center></td>
+ <td class="cell"><center><b>${_('End Date')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>${ formatLang(get_start_date(data),date=True) }</center></td>
+ <td class="cell"><center>${ formatLang(get_end_date(data),date=True) }</center></td>
+ </tr>
+ </table>
+ %endif
+ %endif
+ %if data['form']['filter']=='filter_date':
+ ${ get_filter(data) }
+ %if data['form']['filter']=='filter_period':
+
+ <table class="cell">
+ <tr>
+ <td class="cell"><center><b>${_('Start Period')}</b></center></td>
+ <td class="cell"><center><b>${_('End Period')}</b></center></td>
+ </tr>
+ <tr>
+ <td class="cell"><center>
+ ${ get_start_period(data) }
+ </center></td>
+ <td class="cell"><center>
+ ${ get_end_period(data) }
+ </center></td>
+ </tr>
+ </table>
+ %endif
+ %endif
+ </center></td>
+ <td class="cell"><center>${ get_partners() }</center></td>
+ <td class="cell"><center>${ get_target_move(data) }</center></td>
+ </tr>
+ </table>
+ </br>
+ <table class="tbl_header">
+ %if display_currency(data) == False:
+ <tr>
+ <td class="td_f12" width="9%"><b>${_('Date')}</b></td>
+ <td class="td_f12" width="5%"><b>${_('JRNL')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Ref')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Account')}</b></td>
+ <td class="td_f12" width="24%"><b>${_('Entry Label')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Debit')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Credit')}</b></td>
+ <td class="td_f12_right" width="14%"><b>${_('Balance')}</b></td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line"></table></td></tr>
+ %for p in objects:
+ <% setLang(p.lang) %>
+ <tr>
+ <td colspan="5" class="td_f12"><b> ${p.ref or ''} - ${p.name or ''}</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_credit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) }</b></td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %if data['form']['initial_balance']==True:
+ <tr>
+ <td colspan="5" class="td_f12"><b>Initial Balance</b></td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][0]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][1]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) }</td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %endif
+ %for line in lines(p):
+ <tr>
+ <td class="td_f10">${ formatLang(line['date'],date=True) }</td>
+ <td class="td_f10">${ line['code'] }</td>
+ <td class="td_f10">${ line['move_name'] }</td>
+ <td class="td_f10">${ line['a_code'] }</td>
+ <td class="td_f10">${ line['ref'] and strip_name(line['ref'],10) } - ${ strip_name(line['name'],15) }</td>
+ <td class="td_f10_right">${ formatLang((line['debit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['credit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['progress']), currency_obj=company.currency_id) }</td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endfor
+ %endif
+ %if display_currency(data) == True:
+ <tr>
+ <td class="td_f12" width="9%"><b>${_('Date')}</b></td>
+ <td class="td_f12" width="5%"><b>${_('JRNL')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Ref')}</b></td>
+ <td class="td_f12" width="12%"><b>${_('Account')}</b></td>
+ <td class="td_f12" width="24%"><b>${_('Entry Label')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Debit')}</b></td>
+ <td class="td_f12_right" width="12%"><b>${_('Credit')}</b></td>
+ <td class="td_f12_right" width="7%"><b>${_('Balance')}</b></td>
+ <td class="td_f12_right" width="7%"><b>${_('Currency')}</b></td>
+ </tr><tr><td colspan="9"><table class="tr_bottom_line"></table></td></tr>
+ %for p in objects:
+ <% setLang(p.lang) %>
+ <tr>
+ <td colspan="5" class="td_f12"><b> ${p.ref or ''} - ${p.name or ''}</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_credit_partner(p))) }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((sum_debit_partner(p) - sum_credit_partner(p)), currency_obj=company.currency_id) }</b></td>
+ <td> </td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %if data['form']['initial_balance']==True:
+ <tr>
+ <td colspan="5" class="td_f12"><b>${_('Initial Balance')}</b></td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][0]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][1]) }</td>
+ <td class="td_f12_right">${ formatLang(get_intial_balance(p)[0][2], currency_obj=company.currency_id) }</td>
+ <td> </td>
+ </tr><tr><td colspan="5"><table class="tr_bottom_line_dark_grey"></table></td></tr>
+ %endif
+ %for line in lines(p):
+ <tr>
+ <td class="td_f10">${ formatLang(line['date'],date=True) }</td>
+ <td class="td_f10">${ line['code'] }</td>
+ <td class="td_f10">${ line['move_name'] }</td>
+ <td class="td_f10">${ line['a_code'] }</td>
+ <td class="td_f10">${ line['ref'] and strip_name(line['ref'],10) } - ${ strip_name(line['name'],15) }</td>
+ <td class="td_f10_right">${ formatLang((line['debit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['credit'])) }</td>
+ <td class="td_f10_right">${ formatLang((line['progress']), currency_obj=company.currency_id) }</td>
+ <td class="td_f10_right">
+ %if (line['currency_id']==None or line['amount_currency']==None):
+ ${ formatLang(line['amount_currency']) } ${ line['currency_code'] or '' }
+ %endif
+ </td>
+ </tr><tr><td colspan="9"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endfor
+ %endfor
+ %endif
+ </table>
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_print_invoice.mako'
--- account_webkit/report/account_print_invoice.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_print_invoice.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,164 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body >
+
+ %for o in objects:
+ <% setLang(o.partner_id.lang) %>
+ </br></br></br>
+ <table class="td_f12 tr_bottom_line_dark" width="40%" >
+ <tr>
+ <td width="25%">Phone</td>
+ <td>: ${ company.phone or ''}</td>
+ </tr>
+ <tr>
+ <td>Mail</td>
+ <td>: ${ company.email or '' }</td>
+ </tr>
+ </table>
+ <table cellspacing="0" width="100%">
+ <tr>
+ <td width="80%" >
+
+ </td>
+ <td width="20%" class="td_f12">
+ ${ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' }${ (o.partner_id and o.partner_id.name) or '' }</br>
+ ${ o.partner_id.parent_id.name or '' }</br>
+ ${ o.partner_id.street or '' }</br>
+ ${ o.partner_id.city or '' } ${ o.partner_id.zip or '' }</br>
+ ${ o.partner_id.country_id.name or '' }</br>
+ </br>
+ %if (o.partner_id.phone):
+ Tel. : ${ o.partner_id.phone or '' }</br>
+ %endif
+ %if o.partner_id.fax:
+ Fax : ${ o.partner_id.fax or '' }</br>
+ %endif
+ %if o.partner_id.vat:
+ ${ o.partner_id.vat or '' }
+ %endif
+ </td>
+ </tr>
+ </table>
+ </br>
+ <h2>
+ %if (o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')):
+ ${ _('Invoice')} ${ o.number }
+ %endif
+ %if (o.type == 'out_invoice' and o.state == 'proforma2'):
+ ${ _('PRO-FORMA') }
+ %endif
+ %if (o.type == 'out_invoice' and o.state == 'draft'):
+ ${ _('Draft Invoice') }
+ %endif
+ %if (o.type == 'out_invoice' and o.state == 'cancel'):
+ ${ _('Cancelled Invoice') } ${ o.number }
+ %endif
+ %if o.type=='out_refund':
+ ${ _('Refund') } ${ o.number }
+ %endif
+ %if o.type=='in_refund':
+ ${ _('Supplier Refund') } ${ o.number }
+ %endif
+ %if o.type=='in_invoice':
+ ${ _('Supplier Invoice') } ${ o.number }
+ %endif
+ </h2>
+ </br>
+ <table class="tbl_header" cellspacing="0">
+ <tr>
+ <td class="cell" width="25%"><b>${_('Description')}</b></td>
+ <td class="cell" width="25%"><b>${_('Invoice Date')}</b></td>
+ <td class="cell" width="25%"><b>${_('Source')}</b></td>
+ <td class="cell" width="25%"><b>${_('Customer Code')}</b></td>
+ </tr>
+ <tr>
+ <td class="tb_f10 cell">${ o.name or '' }</td>
+ <td class="tb_f10 cell">${ formatLang(o.date_invoice,date=True) }</td>
+ <td class="tb_f10 cell">${ o.origin or '' }</td>
+ <td class="tb_f10 cell">${ o.partner_id.ref or '' }</td>
+ </tr>
+ </table>
+ </br>
+ <table class="tbl_header" cellspacing="0">
+ <tr>
+ <td class="tb_f12" width="35%"><b>${_('Description')}</b></td>
+ <td class="tb_f12" width="13%"><center><b>${_('Taxes')}</b></center></td>
+ <td class="tb_f12_right" width="15%"><b>${_('Quantity')}</b></td>
+ <td class="tb_f12_right" width="11%"><b>${_('Unit Price')}</b></td>
+ <td class="tb_f12_right" width="09%"><b>${_('Disc.(%)')}</b></td>
+ <td class="tb_f12_right" width="16%"><b>${_('Price')}</b></td>
+ </tr><tr><td colspan="6"><table class="tr_bottom_line"></table></td></tr>
+ <% rec = len(o.invoice_line) %>
+ <% i = 1 %>
+ %for l in o.invoice_line:
+ <tr>
+ <td class="tb_f10">${ format(l.name) }</b></td>
+ <td class="tb_f10"><center>${ ', '.join([ lt.name or '' for lt in l.invoice_line_tax_id ]) }</center></td>
+ <td class="tb_f10">${ formatLang(l.quantity) } ${ (l.uos_id and l.uos_id.name) or '' }</td>
+ <td class="tb_f10">${ formatLang(l.price_unit) }</td>
+ <td class="tb_f10">${ formatLang(l.discount, dp='Account') }</td>
+ <td class="tb_f10">${ formatLang(l.price_subtotal, dp='Account', currency_obj=o.currency_id) }</td>
+ </tr>
+ %if i != rec:
+ <tr><td colspan="6"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %else:
+ <tr><td colspan="3"><table class="tr_bottom_line_light_grey"></table></td><td colspan="3"><table class="tr_bottom_line"></table></td></tr>
+ %endif
+ <% i=i+1 %>
+ %endfor
+ <tr>
+ <td colspan="3"></td>
+ <td class="tb_f12" colspan="2">${ _('Net Total:') }</td>
+ <td class="tb_f12">${ formatLang(o.amount_untaxed, digits=get_digits(dp='Account'), currency_obj=o.currency_id) }</td>
+ </tr>
+ <tr>
+ <td colspan="3"></td>
+ <td class="tb_f12" colspan="2">${ _('Taxes:') }</td>
+ <td class="tb_f12">${ formatLang(o.amount_tax, dp='Account', currency_obj=o.currency_id) }</td>
+ </tr><tr><td colspan="3"></td><td colspan="3"><table class="tr_bottom_line"></table></td></tr>
+ <tr>
+ <td colspan="3"></td>
+ <td class="tb_f12" colspan="2"><b>${ _('Total:') }</b></td>
+ <td class="tb_f12"><b>${ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) }</b></td>
+ </tr>
+ </table>
+ </br>
+ %if o.tax_line!=[]:
+ <table class="tbl_header" cellspacing="0">
+ <tr>
+ <td class="tb_f12" width="39%"><b>${_('Tax')}</b></td>
+ <td class="tb_f12" width="13%"><b>${_('Base')}</b></td>
+ <td class="tb_f12" width="13%"><b>${_('Amount')}</b></td>
+ <td class="tb_f12" width="35%"><b>${_('')}</b></td>
+ </tr><tr><td colspan="3"><table class="tr_bottom_line"></table></td></tr>
+ %for t in o.tax_line:
+ %if not (t.tax_code_id and t.tax_code_id.notprintable):
+ <tr>
+ <td class="tb_f12" width="39%">${ t.name }</td>
+ <td class="tb_f12" width="13%">${ formatLang(t.base, dp='Account', currency_obj=o.currency_id) }</td>
+ <td class="tb_f12" width="13%">${ formatLang(t.amount, digits=get_digits(dp='Account'), currency_obj=o.currency_id) }</td>
+ <td class="tb_f12" width="35%">${_('')}</td>
+ </tr><tr><td colspan="3"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %endif
+ %endfor
+ </table>
+ %endif
+ <p class="tb_f10">
+ %if o.comment:
+ ${ format(o.comment) }
+ %endif
+ </p>
+ </br>
+ <p class="tb_f10">
+ %if o.payment_term and o.payment_term.note:
+ ${ format(o.payment_term and o.payment_term.note) }
+ %endif
+ </p>
+ <p style="page-break-after:always;"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_print_invoice.py'
--- account_webkit/report/account_print_invoice.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_print_invoice.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+class account_invoice(report_sxw.rml_parse, common_report_header):
+ def __init__(self, cr, uid, name, context):
+ super(account_invoice, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ })
+report_sxw.report_sxw(
+ 'report.account.invoice.webkit',
+ 'account.invoice',
+ 'addons/account_webkit/report/account_print_invoice.mako',
+ parser=account_invoice
+)
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/report/account_print_overdue.mako'
--- account_webkit/report/account_print_overdue.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_print_overdue.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,126 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body direction: rtl; onload="subst()">
+ %for o in objects:
+ </br></br></br>
+ <table cellspacing="0" width="100%">
+ <tr>
+ <td width="80%" >
+ <table class="td_f12 tr_bottom_line_dark" width="40%" >
+ <tr>
+ <td width="25%">Phone</td>
+ <td>: ${ company.phone or ''}</td>
+ </tr>
+ <tr><u>
+ <td>Mail</td>
+ <td>: ${ company.email or '' }</td></u>
+ </tr>
+ </table>
+ </td>
+ <td width="20%" class="td_f12">
+ ${ o.title.name or '' } ${ o.name }</br>
+ ${ o.street or '' }</br>
+ ${ o.city or '' } ${ o.zip or '' }</br>
+ ${ o.country_id.name or '' }</br>
+ </br>
+ %if o.vat:
+ ${ o.vat or '' }
+ %endif
+ </td>
+ </tr>
+ </table>
+ </br>
+ <p>Document: Customer account statement</p>
+ <p>Date: ${ formatLang(time.strftime('%Y-%m-%d'),date=True) }</p>
+ <p>Customer Ref: ${ o.ref or ' '}</p>
+ <br/>
+ %if getLines(o):
+ %for message_line in message(o, company):
+ <p class="td_f12">${ message_line }</p>
+ %endfor
+
+ <table class="tbl_header">
+ <tr>
+ <td width="11%" class="td_f12"><b>${ _('Date') }</b></td>
+ <td width="27%" class="td_f12"><b>${ _('Description') }</b></td>
+ <td width="10%" class="td_f12"><b>${ _('Ref') }</b></td>
+ <td width="14%" class="td_f12"><b>${ _('Maturity date') }</b></td>
+ <td width="11%" class="td_f12_right"><b>${ _('Due') }</b></td>
+ <td width="11%" class="td_f12_right"><b>${ _('Paid') }</b></td>
+ <td width="13%" class="td_f12_right"><b>${ _('Maturity') }</b></td>
+ <td width="3%" class="td_f12"><b>${ _('Li.') }</b></td>
+ </tr><tr><td colspan="8"><table class="tr_bottom_line"></table></td></tr>
+ <% rec = len(getLines(o)) %>
+ <% i = 1 %>
+ %for line in getLines(o):
+ <tr>
+ <td class="td_f10">${ formatLang(line['date'],date=True) }</td>
+ <td class="td_f10">${ line['name'] }</td>
+ <td class="td_f10">${ line['ref'] }</td>
+ <td class="td_f10">
+ %if line['date_maturity']:
+ ${ formatLang(line['date_maturity'],date=True) or '' }
+ %endif
+ </td>
+ <td class="td_f10_right">
+ %if line['account_id']['type'] == 'receivable':
+ ${ formatLang(line['debit']) or 0 }
+ %elif line['account_id']['type'] == 'payable':
+ ${ formatLang(line['credit'] * -1) or 0 }
+ %endif
+ </td>
+ <td class="td_f10_right">
+ %if line['account_id']['type'] == 'receivable':
+ ${ formatLang(line['credit']) or 0 }
+ %elif line['account_id']['type'] == 'payable':
+ ${ formatLang(line['debit'] * -1) or 0 }
+ %endif
+ </td>
+ <td class="td_f10_right">
+ %if (time.strftime('%Y-%m-%d') > line['date_maturity']):
+ ${ formatLang(line['debit'] - line['credit'], currency_obj = company.currency_id) }
+ %endif
+ </td>
+ <td class="td_f10">
+ %if line['blocked']:
+ ${_('X')}
+ %else:
+ ${_('')}
+ %endif
+ </td>
+ </tr>
+ %if i != rec:
+ <tr><td colspan="8"><table class="tr_bottom_line_light_grey"></table></td></tr>
+ %else:
+ <tr><td colspan="3"><table class="tr_bottom_line_light_grey"></table></td><td colspan="5"><table class="tr_bottom_line"></table></td></tr>
+ %endif
+ <% i=i+1 %>
+ %endfor
+ <tr>
+ <td colspan="3"> </td>
+ <td class="td_f12"><b>${ _('Sub Total :') }</b></td>
+ <td class="td_f10_right">${ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) }</td>
+ <td class="td_f10_right">${ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) }</td>
+ <td class="td_f10_right">${ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)), currency_obj=company.currency_id) }</td>
+ <td></td>
+ </tr><tr><td colspan="3"></td><td colspan="5"><table class="tr_bottom_line"></table></td></tr>
+ <tr>
+ <td colspan="3"> </td>
+ <td class="td_f12"><b>${ _('Balance :') }</b></td>
+ <td class="td_f12_right"><b>${ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0)), currency_obj = company.currency_id) }</b></td>
+ <td colspan="3"> </td>
+ </tr>
+ </table>
+ <p class="td_f12">Total amount due: ${ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0)), currency_obj=company.currency_id) }</p>
+ %endif
+ %if not getLines(o):
+ ${ _('There is nothing due with this customer.') }
+ %endif
+ <p style="page-break-after:always;"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_print_overdue.py'
--- account_webkit/report/account_print_overdue.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_print_overdue.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from openerp import pooler
+from account.report.common_report_header import common_report_header
+
+
+class Overdue(report_sxw.rml_parse, common_report_header):
+ def __init__(self, cr, uid, name, context):
+ super(Overdue, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'time': time,
+ 'getLines': self._lines_get,
+ 'tel_get': self._tel_get,
+ 'message': self._message,
+ })
+ self.context = context
+
+ def _tel_get(self,partner):
+ if not partner:
+ return False
+ res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
+ addresses = res_partner.address_get(self.cr, self.uid, [partner.id], ['invoice'])
+ adr_id = addresses and addresses['invoice'] or False
+ if adr_id:
+ adr=res_partner_address.read(self.cr, self.uid, [adr_id])[0]
+ return adr['phone']
+ else:
+ return partner.phone or False
+ return False
+
+ def _lines_get(self, partner):
+ moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ movelines = moveline_obj.search(self.cr, self.uid,
+ [('partner_id', '=', partner.id),
+ ('account_id.type', 'in', ['receivable', 'payable']),
+ ('state', '<>', 'draft'), ('reconcile_id', '=', False)])
+ movelines = moveline_obj.browse(self.cr, self.uid, movelines)
+ return movelines
+
+ def _message(self, obj, company):
+ company_pool = pooler.get_pool(self.cr.dbname).get('res.company')
+ message = company_pool.browse(self.cr, self.uid, company.id, {'lang':obj.lang}).overdue_msg
+ return message.split('\n')
+
+report_sxw.report_sxw('report.account.overdue.webkit', 'res.partner',
+ 'addons/account_webkit/report/account_print_overdue.mako', parser=Overdue)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'account_webkit/report/account_tax_report.mako'
--- account_webkit/report/account_tax_report.mako 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_tax_report.mako 2013-10-10 09:47:29 +0000
@@ -0,0 +1,111 @@
+<html>
+ <head>
+ <style>
+ ${css}
+ </style>
+ </head>
+
+ <body >
+
+ <table width="100%">
+ <tr class ="report_header">
+ <td align="center">
+ Tax Statement
+ </td>
+ </tr>
+ </table>
+ <p>
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr class="table_header">
+ <td width="20%" align="center" class="top left">
+ <small><b>Chart of Tax</b></small>
+ </td>
+ <td width="20%" align="center" class="left top">
+ <small><b> Fiscal Year</small>
+ </td>
+ <td width="40%" align="center" class="left top">
+ <small><b> Periods</small>
+ </td>
+ <td width="20%" align="center" class="left top right">
+ <small><b>Based On</b></small>
+ </td>
+ </tr>
+
+ <tr class="table_child_data">
+ <td width="20%" align="center" class="left top bottom">
+ <small> ${ get_account(data) or removeParentNode('para') }</small>
+ </td>
+ <td width="20%" align="center" class="left top bottom">
+ <small> ${ get_fiscalyear(data) or '' }</small>
+ </td>
+ <td width="40%" align="center" class="left top bottom">
+ <table width="100%" >
+ <tr class="table_parent_data">
+ <td width="50%" align="center" class="right">
+ <small><b> Start Period</small>
+ </td>
+ <td width="50%" align="center" >
+ <small><b> End Period Period</small>
+ </td>
+ </tr>
+ <tr class="table_child_data">
+ <td width="50%" align="center" class="right">
+ <small> ${get_start_period(data) or ''}</small>
+ </td>
+ <td width="50%" align="center">
+ <small> ${get_end_period(data) or ''}</small>
+ </td>
+ </tr>
+ </table>
+
+ </td >
+ <td width="20%" align="center" class="left top right bottom">
+ <small>${get_basedon(data) or ''}</small>
+ </td>
+ </tr>
+
+ </table>
+ <p>
+ <p>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr class ="table_header">
+ <td width="40%" align="left" class="head_bottom_border">
+ <small><b>Tax Name</b></small>
+ </td>
+ <td width="20%" align="right" class="head_bottom_border">
+ <small><b> Debit</small>
+ </td>
+ <td width="20%" align="right" class="head_bottom_border">
+ <small><b> Credit</small>
+ </td>
+ <td width="20%" align="right" class="head_bottom_border">
+ <small><b>Tax Amount</b></small>
+ </td>
+ </tr>
+ </table>
+
+ <p>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ %for line in get_lines(data['form']['based_on'], data['form']['company_id']):
+
+ %if len(line['level']) <=4:
+ <tr class="table_parent_data">
+ <td width="40%" class="bottom" > <font color="white">${ line['level'] } </font> ${line['code'] or ''} ${ line['name'] or ''} </td>
+ <td width="20%" class="bottom" align="right"> ${ formatLang(line['debit']) } </td>
+ <td width="20%" class="bottom" align="right"> ${ formatLang(line['credit']) } </td>
+ <td width="20%" class="bottom" align="right"> ${ formatLang(line['tax_amount'], currency_obj=company.currency_id) } </td>
+ </tr>
+ %endif
+ %if len(line['level']) > 4:
+ <tr class="table_child_data">
+ <td width="40%" class="bottom"> <font color="white">${ line['level'] } </font> ${line['code'] or ''} ${ line['name'] or ''} </td>
+ <td width="20%" class="bottom" align="right"> ${ formatLang(line['debit']) } </td>
+ <td width="20%" class="bottom" align="right"> ${ formatLang(line['credit']) } </td>
+ <td width="20%" class="bottom" align="right"> ${ formatLang(line['tax_amount'], currency_obj=company.currency_id) } </td>
+ </tr>
+ %endif
+ %endfor
+ </table>
+
+ </body>
+</html>
\ No newline at end of file
=== added file 'account_webkit/report/account_tax_report.py'
--- account_webkit/report/account_tax_report.py 1970-01-01 00:00:00 +0000
+++ account_webkit/report/account_tax_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,240 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from openerp.report import report_sxw
+from openerp.osv import osv
+from account.report.common_report_header import common_report_header
+
+
+class tax_report(report_sxw.rml_parse, common_report_header):
+ _name = 'report.account.vat.declaration'
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ res = {}
+ self.period_ids = []
+ period_obj = self.pool.get('account.period')
+ self.display_detail = data['form']['display_detail']
+ res['periods'] = ''
+ res['fiscalyear'] = data['form'].get('fiscalyear_id', False)
+
+ if data['form'].get('period_from', False) and data['form'].get('period_to', False):
+ self.period_ids = period_obj.build_ctx_periods(self.cr, self.uid, data['form']['period_from'], data['form']['period_to'])
+ periods_l = period_obj.read(self.cr, self.uid, self.period_ids, ['name'])
+ for period in periods_l:
+ if res['periods'] == '':
+ res['periods'] = period['name']
+ else:
+ res['periods'] += ", "+ period['name']
+ return super(tax_report, self).set_context(objects, data, new_ids, report_type=report_type)
+
+ def __init__(self, cr, uid, name, context=None):
+ super(tax_report, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_codes': self._get_codes,
+ 'get_general': self._get_general,
+ 'get_currency': self._get_currency,
+ 'get_lines': self._get_lines,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_basedon': self._get_basedon,
+ })
+
+ def _get_basedon(self, form):
+ return form['form']['based_on']
+
+ def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None):
+ period_list = self.period_ids
+ res = self._get_codes(based_on, company_id, parent, level, period_list, context=context)
+ if period_list:
+ res = self._add_codes(based_on, res, period_list, context=context)
+ else:
+ self.cr.execute ("select id from account_fiscalyear")
+ fy = self.cr.fetchall()
+ self.cr.execute ("select id from account_period where fiscalyear_id = %s",(fy[0][0],))
+ periods = self.cr.fetchall()
+ for p in periods:
+ period_list.append(p[0])
+ res = self._add_codes(based_on, res, period_list, context=context)
+
+ i = 0
+ top_result = []
+ while i < len(res):
+
+ res_dict = { 'code': res[i][1].code,
+ 'name': res[i][1].name,
+ 'debit': 0,
+ 'credit': 0,
+ 'tax_amount': res[i][1].sum_period,
+ 'type': 1,
+ 'level': res[i][0],
+ 'pos': 0
+ }
+
+ top_result.append(res_dict)
+ res_general = self._get_general(res[i][1].id, period_list, company_id, based_on, context=context)
+ ind_general = 0
+ while ind_general < len(res_general):
+ res_general[ind_general]['type'] = 2
+ res_general[ind_general]['pos'] = 0
+ res_general[ind_general]['level'] = res_dict['level']
+ top_result.append(res_general[ind_general])
+ ind_general+=1
+ i+=1
+ return top_result
+
+ def _get_general(self, tax_code_id, period_list, company_id, based_on, context=None):
+ if not self.display_detail:
+ return []
+ res = []
+ obj_account = self.pool.get('account.account')
+ periods_ids = tuple(period_list)
+ if based_on == 'payments':
+ self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
+ SUM(line.debit) AS debit, \
+ SUM(line.credit) AS credit, \
+ COUNT(*) AS count, \
+ account.id AS account_id, \
+ account.name AS name, \
+ account.code AS code \
+ FROM account_move_line AS line, \
+ account_account AS account, \
+ account_move AS move \
+ LEFT JOIN account_invoice invoice ON \
+ (invoice.move_id = move.id) \
+ WHERE line.state<>%s \
+ AND line.tax_code_id = %s \
+ AND line.account_id = account.id \
+ AND account.company_id = %s \
+ AND move.id = line.move_id \
+ AND line.period_id IN %s \
+ AND ((invoice.state = %s) \
+ OR (invoice.id IS NULL)) \
+ GROUP BY account.id,account.name,account.code', ('draft', tax_code_id,
+ company_id, periods_ids, 'paid',))
+
+ else:
+ self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
+ SUM(line.debit) AS debit, \
+ SUM(line.credit) AS credit, \
+ COUNT(*) AS count, \
+ account.id AS account_id, \
+ account.name AS name, \
+ account.code AS code \
+ FROM account_move_line AS line, \
+ account_account AS account \
+ WHERE line.state <> %s \
+ AND line.tax_code_id = %s \
+ AND line.account_id = account.id \
+ AND account.company_id = %s \
+ AND line.period_id IN %s\
+ AND account.active \
+ GROUP BY account.id,account.name,account.code', ('draft', tax_code_id,
+ company_id, periods_ids,))
+ res = self.cr.dictfetchall()
+
+ i = 0
+ while i<len(res):
+ res[i]['account'] = obj_account.browse(self.cr, self.uid, res[i]['account_id'], context=context)
+ i+=1
+ return res
+
+ def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=None, context=None):
+ obj_tc = self.pool.get('account.tax.code')
+ ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context)
+
+ res = []
+ for code in obj_tc.browse(self.cr, self.uid, ids, {'based_on': based_on}):
+ res.append(('.'*2*level, code))
+
+ res += self._get_codes(based_on, company_id, code.id, level+1, context=context)
+ return res
+
+ def _add_codes(self, based_on, account_list=None, period_list=None, context=None):
+ if account_list is None:
+ account_list = []
+ if period_list is None:
+ period_list = []
+ res = []
+ obj_tc = self.pool.get('account.tax.code')
+ for account in account_list:
+ ids = obj_tc.search(self.cr, self.uid, [('id','=', account[1].id)], context=context)
+ sum_tax_add = 0
+ for period_ind in period_list:
+ for code in obj_tc.browse(self.cr, self.uid, ids, {'period_id':period_ind,'based_on': based_on}):
+ sum_tax_add = sum_tax_add + code.sum_period
+
+ code.sum_period = sum_tax_add
+
+ res.append((account[0], code))
+ return res
+
+ def _get_currency(self, form, context=None):
+ return self.pool.get('res.company').browse(self.cr, self.uid, form['company_id'], context=context).currency_id.name
+
+ def sort_result(self, accounts, context=None):
+ # On boucle sur notre rapport
+ result_accounts = []
+ ind=0
+ old_level=0
+ while ind<len(accounts):
+ #
+ account_elem = accounts[ind]
+ #
+
+ #
+ # we will now check if the level is lower than the previous level, in this case we will make a subtotal
+ if (account_elem['level'] < old_level):
+ bcl_current_level = old_level
+ bcl_rup_ind = ind - 1
+
+ while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ):
+ res_tot = { 'code': accounts[bcl_rup_ind]['code'],
+ 'name': '',
+ 'debit': 0,
+ 'credit': 0,
+ 'tax_amount': accounts[bcl_rup_ind]['tax_amount'],
+ 'type': accounts[bcl_rup_ind]['type'],
+ 'level': 0,
+ 'pos': 0
+ }
+
+ if res_tot['type'] == 1:
+ # on change le type pour afficher le total
+ res_tot['type'] = 2
+ result_accounts.append(res_tot)
+ bcl_current_level = accounts[bcl_rup_ind]['level']
+ bcl_rup_ind -= 1
+
+ old_level = account_elem['level']
+ result_accounts.append(account_elem)
+ ind+=1
+
+ return result_accounts
+
+report_sxw.report_sxw('report.account.vat.declaration.webkit', 'account.tax.code',
+ 'addons/account_webkit/report/account_tax_report.mako', parser=tax_report, header="internal")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'account_webkit/wizard'
=== added file 'account_webkit/wizard/__init__.py'
--- account_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/__init__.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+
+import account_report_aged_partner_balance
+import account_report_partner_ledger
+import account_report_partner_balance
+import account_vat
+import account_financial_report
+import account_report_print_journal
+import account_report_central_journal
+import account_report_general_journal
+import account_report_general_ledger
+import account_report_account_balance
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'account_webkit/wizard/account_financial_report.py'
--- account_webkit/wizard/account_financial_report.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_financial_report.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+from openerp.osv import fields, osv
+
+class accounting_report(osv.osv_memory):
+ _inherit = "accounting.report"
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ res = super(accounting_report, self)._print_report(cr, uid, ids, data, context=context)
+ res['report_name'] = 'account.financial.report.webkit'
+ return res
+
+accounting_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_account_balance.py'
--- account_webkit/wizard/account_report_account_balance.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_account_balance.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+from openerp.osv import fields, osv
+
+class account_balance_report(osv.osv_memory):
+ _inherit = "account.balance.report"
+
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
+ return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.webkit', 'datas': data}
+
+account_balance_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_aged_partner_balance.py'
--- account_webkit/wizard/account_report_aged_partner_balance.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_aged_partner_balance.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+import time
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+class account_aged_trial_balance(osv.osv_memory):
+ _inherit = 'account.aged.trial.balance'
+
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ res = super(account_aged_trial_balance, self)._print_report(cr, uid, ids, data, context=context)
+ res['report_name'] = 'account.aged_trial_balance.webkit'
+ return res
+
+account_aged_trial_balance()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_central_journal.py'
--- account_webkit/wizard/account_report_central_journal.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_central_journal.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+from openerp.osv import fields, osv
+
+class account_central_journal(osv.osv_memory):
+
+ _inherit = "account.central.journal"
+
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.central.journal.webkit',
+ 'datas': data,
+ }
+
+account_central_journal()
+
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_general_journal.py'
--- account_webkit/wizard/account_report_general_journal.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_general_journal.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+from openerp.osv import fields, osv
+
+class account_general_journal(osv.osv_memory):
+ _inherit = "account.general.journal"
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
+ return {'type': 'ir.actions.report.xml', 'report_name': 'account.general.journal.webkit', 'datas': data}
+
+account_general_journal()
+
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_general_ledger.py'
--- account_webkit/wizard/account_report_general_ledger.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_general_ledger.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+from openerp.osv import fields, osv
+
+class account_report_general_ledger(osv.osv_memory):
+ _inherit = "account.report.general.ledger"
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ res = super(account_report_general_ledger, self)._print_report(cr, uid, ids, data, context=context)
+ res['report_name'] = 'account.general.ledger.webkit'
+ return res
+
+
+account_report_general_ledger()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_partner_balance.py'
--- account_webkit/wizard/account_report_partner_balance.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_partner_balance.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+from openerp.osv import fields, osv
+
+class account_partner_balance(osv.osv_memory):
+ """
+ This wizard will provide the partner balance report by periods, between any two dates.
+ """
+ _inherit = 'account.partner.balance'
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+
+ res = super(account_partner_balance, self)._print_report(cr, uid, ids, data, context=context)
+ res['report_name'] = 'account.partner.balance.webkit'
+ return res
+
+account_partner_balance()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_partner_ledger.py'
--- account_webkit/wizard/account_report_partner_ledger.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_partner_ledger.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+from openerp.osv import fields, osv
+
+class account_partner_ledger(osv.osv_memory):
+ """
+ This wizard will provide the partner Ledger report by periods, between any two dates.
+ """
+ _inherit = 'account.partner.ledger'
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+
+
+
+ if context is None:
+ context = {}
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
+ data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'filter', 'page_split', 'amount_currency'])[0])
+ if data['form']['page_split']:
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.third_party_ledger.webkit',
+ 'datas': data,
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.third_party_ledger_other.webkit',
+ 'datas': data,
+ }
+
+account_partner_ledger()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_report_print_journal.py'
--- account_webkit/wizard/account_report_print_journal.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_report_print_journal.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+from openerp.osv import fields, osv
+from lxml import etree
+
+class account_print_journal(osv.osv_memory):
+ _inherit = "account.print.journal"
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+
+ if context is None:
+ context = {}
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
+ data['form'].update(self.read(cr, uid, ids, ['sort_selection'], context=context)[0])
+ if context.get('sale_purchase_only'):
+ report_name = 'account.journal.period.print.sale.purchase.webkit'
+ else:
+ report_name = 'account.journal.period.print.webkit'
+ return {'type': 'ir.actions.report.xml', 'report_name': report_name, 'datas': data}
+
+account_print_journal()
+
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_webkit/wizard/account_vat.py'
--- account_webkit/wizard/account_vat.py 1970-01-01 00:00:00 +0000
+++ account_webkit/wizard/account_vat.py 2013-10-10 09:47:29 +0000
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import fields, osv
+
+class account_vat_declaration(osv.osv_memory):
+ _inherit = "account.vat.declaration"
+
+
+ def create_vat(self, cr, uid, ids, context=None):
+
+ res = super(account_vat_declaration, self).create_vat(cr, uid, ids, context=context)
+ res['report_name'] = 'account.vat.declaration'
+ return res
+
+
+account_vat_declaration()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Follow ups