diff --git a/account_financial_report_date_range/README.rst b/account_financial_report_date_range/README.rst new file mode 100644 index 00000000..66f86133 --- /dev/null +++ b/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 CE 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 +`_. 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 + +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. diff --git a/account_financial_report_date_range/__init__.py b/account_financial_report_date_range/__init__.py new file mode 100644 index 00000000..943cefd9 --- /dev/null +++ b/account_financial_report_date_range/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import wizards diff --git a/account_financial_report_date_range/__manifest__.py b/account_financial_report_date_range/__manifest__.py new file mode 100644 index 00000000..9a1ec6d5 --- /dev/null +++ b/account_financial_report_date_range/__manifest__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Copyright 2009-2018 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-reporting', + 'author': 'Noviat,' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': True, + 'depends': [ + 'account', + 'date_range', + ], + 'data': [ + 'wizards/accounting_report.xml', + ], +} diff --git a/account_financial_report_date_range/static/description/icon.png b/account_financial_report_date_range/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_financial_report_date_range/static/description/icon.png differ diff --git a/account_financial_report_date_range/tests/__init__.py b/account_financial_report_date_range/tests/__init__.py new file mode 100644 index 00000000..2614549a --- /dev/null +++ b/account_financial_report_date_range/tests/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import test_accounting_report diff --git a/account_financial_report_date_range/tests/test_accounting_report.py b/account_financial_report_date_range/tests/test_accounting_report.py new file mode 100644 index 00000000..775f1e7c --- /dev/null +++ b/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')) diff --git a/account_financial_report_date_range/wizards/__init__.py b/account_financial_report_date_range/wizards/__init__.py new file mode 100644 index 00000000..c3dbe6ba --- /dev/null +++ b/account_financial_report_date_range/wizards/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import account_common_report diff --git a/account_financial_report_date_range/wizards/account_common_report.py b/account_financial_report_date_range/wizards/account_common_report.py new file mode 100644 index 00000000..a5cc6d9c --- /dev/null +++ b/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 diff --git a/account_financial_report_date_range/wizards/accounting_report.xml b/account_financial_report_date_range/wizards/accounting_report.xml new file mode 100644 index 00000000..f41eb6b5 --- /dev/null +++ b/account_financial_report_date_range/wizards/accounting_report.xml @@ -0,0 +1,16 @@ + + + + + accounting.report.form.date_range + accounting.report + + + + + + + + + +