diff --git a/account_journal_always_check_date/__init__.py b/account_journal_always_check_date/__init__.py new file mode 100644 index 000000000..841a1a350 --- /dev/null +++ b/account_journal_always_check_date/__init__.py @@ -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 +# +# 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 . +# +############################################################################## + +from . import account_journal diff --git a/account_journal_always_check_date/__openerp__.py b/account_journal_always_check_date/__openerp__.py new file mode 100644 index 000000000..d5adba1e1 --- /dev/null +++ b/account_journal_always_check_date/__openerp__.py @@ -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 +# +# 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 . +# +############################################################################## + + +{ + '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 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, +} diff --git a/account_journal_always_check_date/account_journal.py b/account_journal_always_check_date/account_journal.py new file mode 100644 index 000000000..df1ce2216 --- /dev/null +++ b/account_journal_always_check_date/account_journal.py @@ -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 +# +# 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 . +# +############################################################################## + +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']), + ] diff --git a/account_journal_always_check_date/i18n/account_journal_always_check_date.pot b/account_journal_always_check_date/i18n/account_journal_always_check_date.pot new file mode 100644 index 000000000..62f5a990a --- /dev/null +++ b/account_journal_always_check_date/i18n/account_journal_always_check_date.pot @@ -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 "" + diff --git a/account_journal_always_check_date/i18n/fr.po b/account_journal_always_check_date/i18n/fr.po new file mode 100644 index 000000000..97406f45d --- /dev/null +++ b/account_journal_always_check_date/i18n/fr.po @@ -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 \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 \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" + diff --git a/account_journal_always_check_date/images/always_check_date_constraint.jpg b/account_journal_always_check_date/images/always_check_date_constraint.jpg new file mode 100644 index 000000000..08c814bc5 Binary files /dev/null and b/account_journal_always_check_date/images/always_check_date_constraint.jpg differ diff --git a/account_journal_always_check_date/static/src/img/icon.png b/account_journal_always_check_date/static/src/img/icon.png new file mode 100644 index 000000000..1d40eb452 Binary files /dev/null and b/account_journal_always_check_date/static/src/img/icon.png differ