2
0

[FIX*IMP] account_fiscal_year

* Add contributors to README
* try to find a FY start date according to the start date from choosen period
* Unable to unlink a date_range with type fiscal_year
* `fiscal_year` flag readonly
* add menu to date_range under accounting section
* remove method on  object because it's the same as in  file
* unable to delete  with flag 'fiscal_year' but can delete
* clean __openerp__.py
* account_fiscal_year version number
This commit is contained in:
Damien Crier 2016-04-28 22:59:54 +02:00 committed by Benoit Aimont
parent 17230a8c5f
commit 6bdd7dbfd9
6 changed files with 29 additions and 47 deletions

View File

@ -6,9 +6,9 @@
Account Fiscal Year
===================
This module extends date.range.type to add fiscal_year flag.
This module extends `date.range.type` to add `fiscal_year` flag.
Override official res_company.compute_fiscal_year_dates to get the
Override official `res_company.compute_fiscal_year_dates` to get the
fiscal year date start / date end for any given date.
That methods first looks for a date range of type fiscal year that
encloses the give date.
@ -30,15 +30,8 @@ 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/{repo_id}/{branch}
:target: https://runbot.odoo-community.org/runbot/92/9.0
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
Known issues / Roadmap
======================
* ...
Bug Tracker
===========
@ -60,7 +53,8 @@ Contributors
------------
* Damien Crier <damien.crier@camptocamp.com>
* ...
* Laurent Mignon <laurent.mignon@acsone.eu>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
Maintainer
----------

View File

@ -4,7 +4,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Account Fiscal Year',
'version': '9.0.0.1.0',
'version': '9.0.1.0.0',
'category': 'Accounting',
'author': 'Camptocamp SA,'
'Odoo Community Association (OCA)',
@ -17,12 +17,6 @@
'data/date_range_type.xml',
'views/date_range_type.xml',
],
'test': [
],
'demo': [
],
'qweb': [
],
'installable': True,
'application': True,
'auto_install': False,

View File

@ -3,6 +3,5 @@
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import date_range
from . import date_range_type
from . import res_company

View File

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
# Author: Damien Crier
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models
from openerp.tools import (DEFAULT_SERVER_DATETIME_FORMAT)
class DateRange(models.Model):
_inherit = 'date.range'
def find_daterange_fy_start(self, date):
"""
try to find a date range with type 'fiscalyear'
with @param:date <= date_start
"""
fy_id = self.env.ref('account_fiscal_year.fiscalyear')
date_str = date.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
s_args = [
('type_id', '=', fy_id.id),
('date_start', '<=', date_str),
('company_id', '=', self.company_id.id),
]
date_range = self.env['date.range'].search(s_args)
return date_range.date_start

View File

@ -3,10 +3,24 @@
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
from openerp import models, fields, api, _, exceptions
class DateRangeType(models.Model):
_inherit = "date.range.type"
fiscal_year = fields.Boolean(string='Is fiscal year ?', default=False)
@api.multi
def unlink(self):
"""
Cannot delete a date_range_type with 'fiscal_year' flag = True
"""
for rec in self:
if rec.fiscal_year:
raise exceptions.ValidationError(
_('You cannot delete a date range type with '
'flag "fiscal_year"')
)
else:
super(DateRangeType, rec).unlink()

View File

@ -8,7 +8,7 @@
<field name="inherit_id" ref="date_range.view_date_range_type_tree"/>
<field name="arch" type="xml">
<field name="allow_overlap" position="after">
<field name="fiscal_year"/>
<field name="fiscal_year" readonly="1"/>
</field>
</field>
</record>
@ -18,10 +18,16 @@
<field name="inherit_id" ref="date_range.view_date_range_type_form_view"/>
<field name="arch" type="xml">
<field name="allow_overlap" position="after">
<field name="fiscal_year"/>
<field name="fiscal_year" readonly="1"/>
</field>
</field>
</record>
<menuitem id="menu_date_range_accounting" name="Date ranges"
parent="account.account_account_menu" sequence="50"/>
<menuitem action="date_range.date_range_action" id="menu_date_range_action_accounting" parent="menu_date_range_accounting"/>
<menuitem action="date_range.date_range_type_action"
id="menu_date_range_type_action_accounting" parent="menu_date_range_accounting"/>
</data>
</openerp>