[IMP] Tax chart by wizard: * the menuitem Accounting \ Chart \ Chart of taxes, have to ask for a period, by default filled with the current period. Then opening the chart of tax using that period in context to have the sum period and sum years completed. It should also ask if we want to include the draft account moves or not

* the company_id field should be hidden in that chart, if the user doesn't have the useabilty / multi company group

    * the chart should display the period sum before the year sum

bzr revid: mra@mra-laptop-20100827103013-ppj8y6loadpw8oz4
This commit is contained in:
Mustufa Rangwala 2010-08-27 16:00:13 +05:30
parent 2831ed76a4
commit 19380a87a0
6 changed files with 131 additions and 4 deletions

View File

@ -60,6 +60,7 @@ module named account_voucher.
'wizard/account_period_close_view.xml',
'wizard/account_fiscalyear_close_state.xml',
'wizard/account_chart_view.xml',
'wizard/account_tax_chart_view.xml',
'wizard/account_move_journal_view.xml',
'wizard/account_move_line_reconcile_select_view.xml',
'wizard/account_open_closed_fiscalyear_view.xml',

View File

@ -835,7 +835,7 @@ class account_period(osv.osv):
'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
}
_defaults = {
'state': lambda *a: 'draft',
'state': 'draft',
}
_order = "date_start"

View File

@ -710,9 +710,9 @@
<tree string="Account Tax Code" toolbar="1">
<field name="name"/>
<field name="code"/>
<field name="sum"/>
<field name="sum_period"/>
<field name="company_id"/>
<field name="sum"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
@ -857,11 +857,13 @@
<field name="view_id" ref="view_tax_code_tree"/>
<field name="help">Chart of Taxes is a tree view reflecting the structure of the Tax Cases (or tax codes) and shows the current tax situation. The tax chart represents the amount of each area of the tax declaration for your country. Its presented in a hierarchical structure, which can be modified to fit your needs.</field>
</record>
<!--
<menuitem
action="action_tax_code_tree"
id="menu_action_tax_code_tree"
parent="menu_finance_charts"
sequence="12"/>
sequence="12"/> --> <!-- move to wizard -->
<!--
Entries lines

View File

@ -48,6 +48,7 @@ import account_open_closed_fiscalyear
import account_compare_account_balance_report
import account_invoice_state
import account_chart
import account_tax_chart
#TODO: remove this file no moe used
# also remove related view fiel

View File

@ -0,0 +1,78 @@
# -*- 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 fields, osv
class account_tax_chart(osv.osv_memory):
"""
For Chart of taxes
"""
_name = "account.tax.chart"
_description = "Account tax chart"
_columns = {
'period_id': fields.many2one('account.period', \
'Period', \
),
'target_move': fields.selection([('all', 'All Entries'),
('posted', 'All Posted Entries')], 'Target Moves', required=True),
}
def _get_period(self, cr, uid, context=None):
"""Return default period value"""
return self.pool.get('account.period').find(cr, uid)
def account_tax_chart_open_window(self, cr, uid, ids, context=None):
"""
Opens chart of Accounts
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of account charts IDs
@return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries
"""
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
period_obj = self.pool.get('account.period')
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
result = mod_obj._get_id(cr, uid, 'account', 'action_tax_code_tree')
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
result = act_obj.read(cr, uid, [id], context=context)[0]
if data['period_id']:
fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0]
result['context'] = str({'period_id': data['period_id'], \
'fiscalyear_id': fiscalyear_id, \
'state': data['target_move']})
else:
result['context'] = str({'state': data['target_move']})
if data['period_id']:
result['name'] += ':' + self.pool.get('account.period').read(cr, uid, [data['period_id']], context=context)[0]['code']
return result
_defaults = {
'period_id': _get_period,
'target_move': 'all'
}
account_tax_chart()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_tax_chart" model="ir.ui.view">
<field name="name">account.tax.chart.form</field>
<field name="model">account.tax.chart</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account tax charts">
<group colspan="4" >
<field name="period_id"/>
<label align="0.7" colspan="6" string="(If you do not select period it will take all open periods)"/>
<field name="target_move"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel" />
<button icon="terp-gtk-go-back-rtl" string="Open Charts" name="account_tax_chart_open_window" type="object" />
</group>
</form>
</field>
</record>
<record id="action_account_tax_chart" model="ir.actions.act_window">
<field name="name">Chart of Taxes</field>
<field name="res_model">account.tax.chart</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('parent_id','=',False)]</field>
<field name="view_id" ref="view_account_tax_chart"/>
<field name="help">Chart of Taxes is a tree view reflecting the structure of the Tax Cases (or tax codes) and shows the current tax situation. The tax chart represents the amount of each area of the tax declaration for your country. Its presented in a hierarchical structure, which can be modified to fit your needs.</field>
<field name="target">new</field>
</record>
<menuitem
icon="STOCK_INDENT"
action="action_account_tax_chart"
id="menu_action_tax_code_tree"
parent="menu_finance_charts"
sequence="12"/>
</data>
</openerp>