[ADD] account_journal_always_check_date: activates the 'Check Date' option on all existing account journals, enable the 'Check Date' option on new account journals and prevent users from deactivating the 'Check Date' option (via a constraint)

This commit is contained in:
Alexis de Lattre
2013-12-13 02:43:08 +01:00
committed by Omar (Pexego)
7 changed files with 207 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Journal Always Check Date module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.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 Affero 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/>.
#
##############################################################################
from . import account_journal

View File

@@ -0,0 +1,53 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Journal Always Check Date module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.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 Affero 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': 'Account Journal Always Check Date',
'version': '0.1',
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Option Check Date in Period always active on journals',
'description': """
Check Date in Period always active on Account Journals
======================================================
This module:
* activates the 'Check Date in Period' option on all existing account journals,
* enable the 'Check Date in Period' option on new account journals,
* prevent users from deactivating the 'Check Date in Period' option.
So this module is an additionnal security for countries where, on an account move, the date must be inside the period.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['account'],
'data': [],
'images': ['images/always_check_date_constraint.jpg'],
'installable': True,
'active': False,
}

View File

@@ -0,0 +1,53 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Journal Always Check Date module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.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 Affero 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/>.
#
##############################################################################
from openerp.osv import orm
from openerp.tools.translate import _
class account_journal(orm.Model):
_inherit = 'account.journal'
def init(self, cr):
'''Activate 'Check Date in Period' on all existing journals'''
cr.execute(
"UPDATE account_journal SET allow_date=true "
"WHERE allow_date <> true")
return True
_defaults = {
'allow_date': True,
}
def _allow_date_always_active(self, cr, uid, ids):
for journal in self.browse(cr, uid, ids):
if not journal.allow_date:
raise orm.except_orm(
_('Error:'),
_("The option 'Check Date in Period' must be active "
"on journal '%s'.")
% journal.name)
return True
_constraints = [
(_allow_date_always_active, "Error msg in raise", ['allow_date']),
]

View File

@@ -0,0 +1,39 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_journal_always_check_date
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-22 19:50+0000\n"
"PO-Revision-Date: 2013-11-22 19:50+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_journal_always_check_date
#: constraint:account.journal:0
msgid "Error msg in raise"
msgstr ""
#. module: account_journal_always_check_date
#: code:addons/account_journal_always_check_date/account_check_date.py:44
#, python-format
msgid "Error:"
msgstr ""
#. module: account_journal_always_check_date
#: code:addons/account_journal_always_check_date/account_check_date.py:45
#, python-format
msgid "The option 'Check Date in Period' must be active on journal '%s'."
msgstr ""
#. module: account_journal_always_check_date
#: model:ir.model,name:account_journal_always_check_date.model_account_journal
msgid "Journal"
msgstr ""

View File

@@ -0,0 +1,39 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * account_journal_always_check_date
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: Alexis de Lattre <alexis.delattre@akretion.com>\n"
"POT-Creation-Date: 2013-11-22 19:53+0000\n"
"PO-Revision-Date: 2013-11-22 19:53+0000\n"
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\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_journal_always_check_date
#: constraint:account.journal:0
msgid "Error msg in raise"
msgstr "Error msg in raise"
#. module: account_journal_always_check_date
#: code:addons/account_journal_always_check_date/account_check_date.py:44
#, python-format
msgid "Error:"
msgstr "Erreur :"
#. module: account_journal_always_check_date
#: code:addons/account_journal_always_check_date/account_check_date.py:45
#, python-format
msgid "The option 'Check Date in Period' must be active on journal '%s'."
msgstr "L'option 'Vérifier la date dans la période' doit être activée sur le journal '%s'."
#. module: account_journal_always_check_date
#: model:ir.model,name:account_journal_always_check_date.model_account_journal
msgid "Journal"
msgstr "Journal"

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB