mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[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:
23
account_journal_always_check_date/__init__.py
Normal file
23
account_journal_always_check_date/__init__.py
Normal 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
|
||||
53
account_journal_always_check_date/__openerp__.py
Normal file
53
account_journal_always_check_date/__openerp__.py
Normal 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,
|
||||
}
|
||||
53
account_journal_always_check_date/account_journal.py
Normal file
53
account_journal_always_check_date/account_journal.py
Normal 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']),
|
||||
]
|
||||
@@ -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 ""
|
||||
|
||||
39
account_journal_always_check_date/i18n/fr.po
Normal file
39
account_journal_always_check_date/i18n/fr.po
Normal 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 |
BIN
account_journal_always_check_date/static/src/img/icon.png
Normal file
BIN
account_journal_always_check_date/static/src/img/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Reference in New Issue
Block a user