mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[ADD] account_tax_chart_interval: Tax chart for a period interval
Tax chart for a period interval =============================== Regular tax chart wizard lets you select only one period. With this module, you can select an initial and ending period, and you will get taxes data for that interval.
This commit is contained in:
40
account_tax_chart_interval/README.rst
Normal file
40
account_tax_chart_interval/README.rst
Normal file
@@ -0,0 +1,40 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:alt: License: AGPL-3
|
||||
|
||||
Tax chart for a period interval
|
||||
===============================
|
||||
|
||||
Regular tax chart wizard lets you select only one period. With this module,
|
||||
you can select an initial and ending period, and you will get taxes data
|
||||
for that interval.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* sum_period compute logic has been completely overwritten when coming from
|
||||
tax chart wizard because there is no provided hook or facility, so changes
|
||||
in the computation upstream (unlikely, but possible) will not be reflected
|
||||
with this module.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
7
account_tax_chart_interval/__init__.py
Normal file
7
account_tax_chart_interval/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
40
account_tax_chart_interval/__openerp__.py
Normal file
40
account_tax_chart_interval/__openerp__.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# (c) 2015 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
|
||||
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.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 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": "Tax chart for a period interval",
|
||||
"version": "1.0",
|
||||
"depends": [
|
||||
"account",
|
||||
],
|
||||
"author": "Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
'Antiun Ingeniería S.L., '
|
||||
'Odoo Community Association (OCA)',
|
||||
"website": "http://www.antiun.com",
|
||||
"contributors": [
|
||||
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
|
||||
],
|
||||
"category": "Accounting & Finance",
|
||||
"data": [
|
||||
'wizard/account_tax_chart_view.xml',
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_tax_chart_interval
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-05-22 10:52+0000\n"
|
||||
"PO-Revision-Date: 2015-05-22 10:52+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_tax_chart_interval
|
||||
#: field:account.tax.chart,period_to:0
|
||||
msgid "End period"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_tax_chart_interval
|
||||
#: field:account.tax.chart,fiscalyear_id:0
|
||||
msgid "Fiscal year"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_tax_chart_interval
|
||||
#: field:account.tax.chart,period_from:0
|
||||
msgid "Start period"
|
||||
msgstr ""
|
||||
|
||||
32
account_tax_chart_interval/i18n/es.po
Normal file
32
account_tax_chart_interval/i18n/es.po
Normal file
@@ -0,0 +1,32 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_tax_chart_interval
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-05-22 10:52+0000\n"
|
||||
"PO-Revision-Date: 2015-05-22 10:52+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_tax_chart_interval
|
||||
#: field:account.tax.chart,period_to:0
|
||||
msgid "End period"
|
||||
msgstr "Periodo final"
|
||||
|
||||
#. module: account_tax_chart_interval
|
||||
#: field:account.tax.chart,fiscalyear_id:0
|
||||
msgid "Fiscal year"
|
||||
msgstr "Ejercicio fiscal"
|
||||
|
||||
#. module: account_tax_chart_interval
|
||||
#: field:account.tax.chart,period_from:0
|
||||
msgid "Start period"
|
||||
msgstr "Periodo inicial"
|
||||
|
||||
6
account_tax_chart_interval/models/__init__.py
Normal file
6
account_tax_chart_interval/models/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from . import account_tax_code
|
||||
28
account_tax_chart_interval/models/account_tax_code.py
Normal file
28
account_tax_chart_interval/models/account_tax_code.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class AccountTaxCode(models.Model):
|
||||
_inherit = 'account.tax.code'
|
||||
|
||||
sum_period = fields.Float(compute="_sum_period")
|
||||
|
||||
@api.one
|
||||
def _sum_period(self):
|
||||
context = self.env.context
|
||||
if context.get('period_ids'):
|
||||
move_state = ('posted', )
|
||||
if context.get('state', False) == 'all':
|
||||
move_state = ('draft', 'posted', )
|
||||
self.sum_period = self._sum(
|
||||
'sum_period', [],
|
||||
where=' AND line.period_id IN %s AND move.state IN %s',
|
||||
where_params=(tuple(context['period_ids']),
|
||||
move_state))[self.id]
|
||||
else:
|
||||
self.sum_period = super(AccountTaxCode,
|
||||
self)._sum_period('sum_period', [])[self.id]
|
||||
BIN
account_tax_chart_interval/static/description/icon.png
Normal file
BIN
account_tax_chart_interval/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
6
account_tax_chart_interval/wizard/__init__.py
Normal file
6
account_tax_chart_interval/wizard/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from . import account_tax_chart
|
||||
48
account_tax_chart_interval/wizard/account_tax_chart.py
Normal file
48
account_tax_chart_interval/wizard/account_tax_chart.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class AccountTaxChart(models.TransientModel):
|
||||
_inherit = 'account.tax.chart'
|
||||
|
||||
def default_fiscalyear(self):
|
||||
return self.env['account.fiscalyear'].find()
|
||||
|
||||
fiscalyear_id = fields.Many2one(
|
||||
comodel_name='account.fiscalyear', string='Fiscal year',
|
||||
default=default_fiscalyear)
|
||||
period_from = fields.Many2one(
|
||||
comodel_name='account.period', string='Start period',
|
||||
domain="[('fiscalyear_id', '=', fiscalyear_id)]")
|
||||
period_to = fields.Many2one(
|
||||
comodel_name='account.period', string='End period',
|
||||
domain="[('fiscalyear_id', '=', fiscalyear_id)]")
|
||||
|
||||
@api.one
|
||||
@api.onchange('fiscalyear_id')
|
||||
def onchange_fiscalyear(self):
|
||||
self.period_from = (self.fiscalyear_id.period_ids and
|
||||
self.fiscalyear_id.period_ids[0] or False)
|
||||
self.period_to = (self.fiscalyear_id.period_ids and
|
||||
self.fiscalyear_id.period_ids[-1] or False)
|
||||
|
||||
@api.multi
|
||||
def account_tax_chart_open_window(self):
|
||||
res = super(AccountTaxChart, self).account_tax_chart_open_window()
|
||||
res['context'] = eval(res['context'])
|
||||
if self.fiscalyear_id:
|
||||
res['context']['fiscalyear_id'] = self.fiscalyear_id.id
|
||||
if self.period_from and self.period_to:
|
||||
res['context']['period_ids'] = (
|
||||
self.env['account.period'].build_ctx_periods(
|
||||
self.period_from.id, self.period_to.id))
|
||||
name = res['name']
|
||||
if name.find(':'):
|
||||
name = name[:name.find(':')]
|
||||
name += ":%s-%s" %(self.period_from.code, self.period_to.code)
|
||||
res['name'] = name
|
||||
return res
|
||||
26
account_tax_chart_interval/wizard/account_tax_chart_view.xml
Normal file
26
account_tax_chart_interval/wizard/account_tax_chart_view.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_tax_chart_interval" model="ir.ui.view">
|
||||
<field name="name">account.tax.chart.form.interval</field>
|
||||
<field name="model">account.tax.chart</field>
|
||||
<field name="inherit_id" ref="account.view_account_tax_chart"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='period_id']/../.." position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='period_id']/../.." position="after">
|
||||
<group>
|
||||
<field name="fiscalyear_id"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="period_from"/>
|
||||
<field name="period_to"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user