← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~akretion-team/account-financial-tools/70-always-check-date into lp:account-financial-tools

 

Alexis de Lattre has proposed merging lp:~akretion-team/account-financial-tools/70-always-check-date into lp:account-financial-tools.

Requested reviews:
  Account Core Editors (account-core-editors)

For more details, see:
https://code.launchpad.net/~akretion-team/account-financial-tools/70-always-check-date/+merge/196398

I propose to add this very small module "account_journal_always_check_date", that I find very usefull. Extract from the module description :
- activates the 'Check Date' option on all existing account journals,
- enable the 'Check Date' option on new account journals,
- prevent users from deactivating the 'Check Date' option (via a constraint)

In a lot of countries (France and many others), on an account move, the date must be inside the period. With this module installed, you are sure that it is always the case.
-- 
https://code.launchpad.net/~akretion-team/account-financial-tools/70-always-check-date/+merge/196398
Your team Account Core Editors is requested to review the proposed merge of lp:~akretion-team/account-financial-tools/70-always-check-date into lp:account-financial-tools.
=== added directory 'account_journal_always_check_date'
=== added file 'account_journal_always_check_date/__init__.py'
--- account_journal_always_check_date/__init__.py	1970-01-01 00:00:00 +0000
+++ account_journal_always_check_date/__init__.py	2013-11-22 22:05:58 +0000
@@ -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@xxxxxxxxxxxx>
+#
+#    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

=== added file 'account_journal_always_check_date/__openerp__.py'
--- account_journal_always_check_date/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_journal_always_check_date/__openerp__.py	2013-11-22 22:05:58 +0000
@@ -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@xxxxxxxxxxxx>
+#
+#    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 always active on journals',
+    'description': """
+Check Date Always active on Account Journals
+============================================
+
+This module:
+
+* activates the 'Check Date' option on all existing account journals,
+
+* enable the 'Check Date' option on new account journals,
+
+* prevent users from deactivating the 'Check Date' 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@xxxxxxxxxxxx> 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,
+}

=== added file 'account_journal_always_check_date/account_journal.py'
--- account_journal_always_check_date/account_journal.py	1970-01-01 00:00:00 +0000
+++ account_journal_always_check_date/account_journal.py	2013-11-22 22:05:58 +0000
@@ -0,0 +1,52 @@
+# -*- 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@xxxxxxxxxxxx>
+#
+#    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, pool, cr):
+        '''Activate 'Check Date in Period' on all existing journals'''
+        init_res = super(account_journal, self).__init__(pool, cr)
+        cr.execute("UPDATE account_journal SET allow_date=True")
+        return init_res
+
+    _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']),
+    ]

=== added directory 'account_journal_always_check_date/i18n'
=== added file 'account_journal_always_check_date/i18n/account_journal_always_check_date.pot'
--- account_journal_always_check_date/i18n/account_journal_always_check_date.pot	1970-01-01 00:00:00 +0000
+++ account_journal_always_check_date/i18n/account_journal_always_check_date.pot	2013-11-22 22:05:58 +0000
@@ -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 ""
+

=== added file 'account_journal_always_check_date/i18n/fr.po'
--- account_journal_always_check_date/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ account_journal_always_check_date/i18n/fr.po	2013-11-22 22:05:58 +0000
@@ -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@xxxxxxxxxxxx>\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@xxxxxxxxxxxx>\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"
+

=== added directory 'account_journal_always_check_date/images'
=== added file 'account_journal_always_check_date/images/always_check_date_constraint.jpg'
Binary files account_journal_always_check_date/images/always_check_date_constraint.jpg	1970-01-01 00:00:00 +0000 and account_journal_always_check_date/images/always_check_date_constraint.jpg	2013-11-22 22:05:58 +0000 differ
=== added directory 'account_journal_always_check_date/static'
=== added directory 'account_journal_always_check_date/static/src'
=== added directory 'account_journal_always_check_date/static/src/img'
=== added file 'account_journal_always_check_date/static/src/img/icon.png'
Binary files account_journal_always_check_date/static/src/img/icon.png	1970-01-01 00:00:00 +0000 and account_journal_always_check_date/static/src/img/icon.png	2013-11-22 22:05:58 +0000 differ

Follow ups