[IMP] Account: Partner balance: improve with new class added common partner report

bzr revid: mra@mra-laptop-20100713094157-f1s520efs0hirmf1
This commit is contained in:
Mustufa Rangwala
2010-07-13 15:11:57 +05:30
parent 7753fe17f2
commit a39f8a5736
4 changed files with 54 additions and 12 deletions
+1
View File
@@ -20,6 +20,7 @@
##############################################################################
import account_common_report
import account_common_partner_report
import account_automatic_reconcile
import account_move_line_reconcile_select
@@ -23,7 +23,7 @@ from tools.translate import _
class account_common_journal_report(osv.osv_memory):
_name = 'account.common.journal.report'
_description = 'Account Commont Journal Report'
_description = 'Account Common Journal Report'
_inherit = "account.common.report"
def _build_context(self, cr, uid, ids, data, context=None):
@@ -0,0 +1,47 @@
# -*- 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 osv import osv, fields
from tools.translate import _
class account_common_partner_report(osv.osv_memory):
_name = 'account.common.partner.report'
_description = 'Account Common Partner Report'
_inherit = "account.common.report"
_columns = {
'result_selection': fields.selection([('customer','Receivable Accounts'),
('supplier','Payable Accounts'),
('Suppliers and Customers' ,'Receivable and Payable Accounts')],
'Partner', required=True),
}
_defaults = {
'result_selection' : 'Suppliers and Customers',
}
def pre_print_report(self, cr, uid, ids, data, query_line, context=None):
data['form'].update(self.read(cr, uid, ids, ['result_selection'])[0])
data['form']['active_ids'] = data['form']['chart_account_id'] # Check me
data['form']['query_line'] = query_line
return data
account_common_partner_report()
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -27,22 +27,16 @@ class account_partner_balance(osv.osv_memory):
"""
This wizard will provide the partner balance report by periods, between any two dates.
"""
_inherit = 'account.common.report'
_inherit = 'account.common.partner.report'
_name = 'account.partner.balance'
_description = 'Print Account Partner Balance'
_columns = {
'result_selection': fields.selection([('customer','Receivable Accounts'),
('supplier','Payable Accounts'),
('Suppliers and Customers' ,'Receivable and Payable Accounts')],
'Partner', required=True),
'soldeinit': fields.boolean('Include initial balances'),
}
}
_defaults={
'result_selection' : 'Suppliers and Customers',
'soldeinit' : True,
}
}
def _check_date(self, cr, uid, data, context=None):
sql = """
@@ -57,11 +51,11 @@ class account_partner_balance(osv.osv_memory):
else:
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
def _print_report(self, cr, uid, ids, data, query_line, context=None):
if context is None:
context = {}
data['form'].update(self.read(cr, uid, ids, ['company_id', 'result_selection', 'soldeinit'])[0])
data = self.pre_print_report(cr, uid, ids, data, query_line, context=context)
data['form'].update(self.read(cr, uid, ids, ['soldeinit'])[0])
if data['form']['filter'] == 'filter_date':
self._check_date(cr, uid, data, context)
data['form']['query_line'] = query_line