Browse Source

[10.0] add new module account_financial_report_date_range

pull/371/head
Luc De Meyer 7 years ago
parent
commit
a2cfdf6aa0
  1. 55
      account_financial_report_date_range/README.rst
  2. 2
      account_financial_report_date_range/__init__.py
  3. 26
      account_financial_report_date_range/__manifest__.py
  4. BIN
      account_financial_report_date_range/static/description/icon.png
  5. 2
      account_financial_report_date_range/tests/__init__.py
  6. 32
      account_financial_report_date_range/tests/test_accounting_report.py
  7. 2
      account_financial_report_date_range/wizards/__init__.py
  8. 19
      account_financial_report_date_range/wizards/account_common_report.py
  9. 16
      account_financial_report_date_range/wizards/accounting_report.xml

55
account_financial_report_date_range/README.rst

@ -0,0 +1,55 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
====================================
Date Range Year on Financial Reports
====================================
This module adds the 'Date Range' field to the Odoo OE standard addons
financial reports wizard.
Installation
============
There is no specific installation procedure for this module.
Configuration and Usage
=======================
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/91/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/account-financial-reporting/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Luc De Meyer <luc.demeyer@noviat.com>
Do not contact contributors directly about support or help with technical issues.
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.

2
account_financial_report_date_range/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import wizards

26
account_financial_report_date_range/__manifest__.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2009-2017 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Date Range Year on Financial Reports',
'summary': """
Add Date Range field to the Odoo OE standard addons
financial reports wizard.
""",
'version': '10.0.1.0.0',
'category': 'Accounting & Finance',
'website': 'https://github.com/OCA/account-financial-tools',
'author': 'Noviat,'
'Odoo Community Association (OCA)',
'license': 'AGPL-3',
'installable': True,
'auto_install': True,
'depends': [
'account',
'date_range',
],
'data': [
'wizards/accounting_report.xml',
],
}

BIN
account_financial_report_date_range/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

2
account_financial_report_date_range/tests/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import test_accounting_report

32
account_financial_report_date_range/tests/test_accounting_report.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright 2009-2017 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import time
from odoo.tests.common import TransactionCase
class TestAccountingReport(TransactionCase):
def setUp(self):
super(TestAccountingReport, self).setUp()
p_type = self.env['date.range.type'].create({
'name': 'Fiscal Period',
'allow_overlap': False})
self.p1 = self.env['date.range'].create({
'name': 'P01',
'type_id': p_type.id,
'date_start': time.strftime('%Y-01-01'),
'date_end': time.strftime('%Y-01-31')})
def test_accounting_report(self):
bs = self.env.ref(
'account.account_financial_report_balancesheet0')
wiz = self.env['accounting.report'].create({
'account_report_id': bs.id})
# Check date_range onchange
wiz.date_range_id = self.p1
wiz._onchange_date_range_id()
self.assertEquals(wiz.date_from, time.strftime('%Y-01-01'))

2
account_financial_report_date_range/wizards/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import account_common_report

19
account_financial_report_date_range/wizards/account_common_report.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2009-2017 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountCommonReport(models.TransientModel):
_inherit = 'account.common.report'
date_range_id = fields.Many2one(
comodel_name='date.range',
string='Date range',
)
@api.onchange('date_range_id')
def _onchange_date_range_id(self):
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end

16
account_financial_report_date_range/wizards/accounting_report.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="accounting_report_view" model="ir.ui.view">
<field name="name">accounting.report.form.date_range</field>
<field name="model">accounting.report</field>
<field name="inherit_id" ref="account.accounting_report_view"/>
<field name="arch" type="xml">
<field name="date_from" position="before">
<field name="date_range_id" options="{'no_create_edit': True}"/>
<newline/>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save