[IMP] add contributors to README

[IMP] unable to unlink a date_range with type fiscal_year
[IMP] `fiscal_year` flag readonly
[IMP] add menu to date_range under accounting section
This commit is contained in:
Damien Crier
2016-05-09 09:58:32 +02:00
parent 1f2f293004
commit 35961f50d7
3 changed files with 27 additions and 14 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

@@ -2,7 +2,7 @@
# 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 import models, api, _, exceptions
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
@@ -23,3 +23,16 @@ class DateRange(models.Model):
]
date_range = self.env['date.range'].search(s_args)
return date_range.date_start
@api.multi
def unlink(self):
"""
Cannot delete a date_range of type 'fiscal_year'
"""
for rec in self:
if rec.type_id.fiscal_year:
raise exceptions.ValidationError(
_('You cannot delete a date range of type "fiscal_year"')
)
else:
super(DateRange, 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>