Merge pull request #471 from acsone/10.0-account_journal_lock_date-sbi

[10.0] account_journal_lock_date
This commit is contained in:
Pedro M. Baeza
2017-05-29 14:32:47 +02:00
committed by GitHub
33 changed files with 320 additions and 1321 deletions

View File

@@ -0,0 +1,75 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=========================
Account Journal Lock Date
=========================
Lock each accounting journal independently.
In addition to the lock dates provided by standard Odoo and
account_permanent_lock_move, provide a per journal lock date.
Note: this module depends on account_permanent_lock_move because it
implements stricter checks than standard Odoo, such as verifying that
one cannot create draft moves before the lock date.
Note: the journal lock date is ignored for users that are part of
the Adviser group. This rule can be adapted by overriding method
`_can_bypass_journal_lock_date` of `account.journal`.
Usage
=====
To use this module, you need to set
.. 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}
.. 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
======================
* a wizard to set the lock date on several journals could be nice to have
* the module does not check that all moves prior the lock date are posted, this could be
made as part of the wizard
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Account Journal Lock Date',
'summary': """
Lock each journal independently""",
'version': '10.0.1.0.0',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV,Odoo Community Association (OCA)',
'website': 'https://acsone.eu/',
'depends': [
'account_permanent_lock_move',
],
'data': [
'views/account_journal.xml',
],
'demo': [
],
}

View File

@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.exceptions import UserError
class JournalLockDateError(UserError):
pass

View File

@@ -0,0 +1,2 @@
from . import account_journal
from . import account_move

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountJournal(models.Model):
_inherit = 'account.journal'
journal_lock_date = fields.Date(
string="Lock date",
help="Moves cannot be entered nor modified in this "
"journal prior to the lock date, unless the user "
"has the Adviser role."
)
@api.model
def _can_bypass_journal_lock_date(self):
""" This method is meant to be overridden to provide
finer control on who can bypass the lock date """
return self.env.user.has_group('account.group_account_manager')

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models, _
from ..exceptions import JournalLockDateError
class AccountMove(models.Model):
_inherit = 'account.move'
@api.multi
def _check_lock_date(self):
res = super(AccountMove, self)._check_lock_date()
if self.env['account.journal']._can_bypass_journal_lock_date():
return res
for move in self:
lock_date = move.journal_id.journal_lock_date
if lock_date and move.date <= lock_date:
raise JournalLockDateError(
_("You cannot add/modify entries prior to and "
"inclusive of the journal lock date %s") %
(lock_date, ))
return res

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1 @@
from . import test_journal_lock_date

View File

@@ -0,0 +1,120 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import date, timedelta
from odoo import fields, tools
from odoo.modules import get_module_resource
from odoo.tests import common
from ..exceptions import JournalLockDateError
class TestJournalLockDate(common.TransactionCase):
def setUp(self):
super(TestJournalLockDate, self).setUp()
tools.convert_file(self.cr, 'account',
get_module_resource('account', 'test',
'account_minimal_test.xml'),
{}, 'init', False, 'test')
self.account_move_obj = self.env["account.move"]
self.account_move_line_obj = \
self.env["account.move.line"]
self.company_id = self.ref('base.main_company')
self.partner = self.browse_ref("base.res_partner_12")
self.account = self.browse_ref("account.a_recv")
self.account2 = self.browse_ref("account.a_expense")
self.journal = self.browse_ref("account.bank_journal")
def test_journal_lock_date(self):
self.env.user.write({
'groups_id': [(3, self.ref('account.group_account_manager'))],
})
self.assertFalse(self.env.user.has_group(
'account.group_account_manager'))
# create a move and post it
move = self.account_move_obj.create({
'date': fields.Date.today(),
'journal_id': self.journal.id,
'line_ids': [(0, 0, {
'account_id': self.account.id,
'credit': 1000.0,
'name': 'Credit line',
}), (0, 0, {
'account_id': self.account2.id,
'debit': 1000.0,
'name': 'Debit line',
})]
})
move.post()
# lock journal
self.journal.journal_lock_date = fields.Date.today()
# Test that the move cannot be created, written, or cancelled
with self.assertRaises(JournalLockDateError):
self.account_move_obj.create({
'date': fields.Date.today(),
'journal_id': self.journal.id,
'line_ids': [(0, 0, {
'account_id': self.account.id,
'credit': 1000.0,
'name': 'Credit line',
}), (0, 0, {
'account_id': self.account2.id,
'debit': 1000.0,
'name': 'Debit line',
})]
})
with self.assertRaises(JournalLockDateError):
move.write({'name': 'TEST'})
with self.assertRaises(JournalLockDateError):
move.button_cancel()
# create a move after ther lock date and post it
tomorrow = date.today() + timedelta(days=1)
move3 = self.account_move_obj.create({
'date': tomorrow,
'journal_id': self.journal.id,
'line_ids': [(0, 0, {
'account_id': self.account.id,
'credit': 1000.0,
'name': 'Credit line',
}), (0, 0, {
'account_id': self.account2.id,
'debit': 1000.0,
'name': 'Debit line',
})]
})
move3.post()
def test_journal_lock_date_adviser(self):
""" The journal lock date is ignored for Advisers """
self.env.user.write({
'groups_id': [(4, self.ref('account.group_account_manager'))],
})
self.assertTrue(self.env.user.has_group(
'account.group_account_manager'))
# lock journal
self.journal.journal_lock_date = fields.Date.today()
# advisers can create moves before or on the lock date
self.account_move_obj.create({
'date': fields.Date.today(),
'journal_id': self.journal.id,
'line_ids': [(0, 0, {
'account_id': self.account.id,
'credit': 1000.0,
'name': 'Credit line',
}), (0, 0, {
'account_id': self.account2.id,
'debit': 1000.0,
'name': 'Debit line',
})]
})

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<record model="ir.ui.view" id="account_journal_form_view">
<field name="name">account.journal.form (in account_journal_lock_date)</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="type" position="after">
<field name="journal_lock_date"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_journal_tree_view">
<field name="name">account.journal.tree (in account_journal_lock_date)</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_tree"/>
<field name="arch" type="xml">
<field name="type" position="after">
<field name="journal_lock_date"/>
</field>
</field>
</record>
</data>
</odoo>

View File

@@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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 model
from . import tests

View File

@@ -1,63 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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 Period Close",
"version": "8.0.1.0.0",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"maintainer": "ACSONE SA/NV",
"website": "http://www.acsone.eu",
"license": "AGPL-3",
"images": [],
"category": "Accounting",
"depends": [
"account"],
"description": """
Close period per journal
========================
This module allows fine grained control of period closing.
Each journal can be closed independently for any period
(using buttons on the fiscal period view).
A common use case is letting accountants close the sale
and purchase journals when the VAT declaration is done for
a given period, while leaving the miscellaneous journal open.
From a technical standpoint, the module leverages the
account.journal.period model that is present in Odoo core.
""",
"data": ['view/account_period_view.xml'],
"demo": [],
"test": [],
"licence": "AGPL-3",
'installable': False,
"auto_install": False,
"application": True,
}

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Bulgarian (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Журнали"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Catalan (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Diaris"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Catalan (Spain) (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/ca_ES/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca_ES\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Diaris"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Journale"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Diarios"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (Spain) (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/es_ES/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_ES\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Diarios"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,78 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
# Stéphane Bidoul <sbi@skynet.be>, 2015
# Yael Terrettaz <yael.terrettaz@live.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-09-10 18:21+0000\n"
"Last-Translator: Yael Terrettaz <yael.terrettaz@live.com>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr "Ajouter tous les journaux"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr "Fermer le journal pour cette période"
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr "Pour pouvoir fermer un jounal, vous devez d'abord poster toutes les pièces dans la période concernée."
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr "Action incorrecte!"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr "Période du journal"
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr "Type de journal"
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr "Etats des journaux"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Journaux"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr "Réouvrir le journal pour cette période"
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr "Vous ne pouvez pas ajouter deux fois le même journal dans une période."

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Galician (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/gl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: gl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Xornais"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,76 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-03 15:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: Portuguese (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/pt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr ""
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr ""
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr ""
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr ""
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr ""
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Diários"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr ""
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr ""

View File

@@ -1,77 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_journal_period_close
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
msgid ""
msgstr ""
"Project-Id-Version: account-financial-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
"PO-Revision-Date: 2015-06-13 05:32+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_period
msgid "Account period"
msgstr "Knjigovodsko obdobje"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Add all journals"
msgstr "Dodaj vse dnevnike"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Close journal for this period"
msgstr "Zaključi dnevnik za to obdobje"
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:66
#, python-format
msgid ""
"In order to close a journal, you must first post related journal entries."
msgstr "Da bi lahko zaključili dnevnik, morate najprej razknjižiti povezane dnevniške vnose."
#. module: account_journal_period_close
#: code:addons/account_journal_period_close/model/account_journal_period.py:65
#, python-format
msgid "Invalid Action!"
msgstr "Neveljavno dejanje!"
#. module: account_journal_period_close
#: model:ir.model,name:account_journal_period_close.model_account_journal_period
msgid "Journal Period"
msgstr "Dnevniško obdobje"
#. module: account_journal_period_close
#: field:account.journal.period,type:0
msgid "Journal Type"
msgstr "Tip dnevnika"
#. module: account_journal_period_close
#: field:account.period,journal_period_ids:0
msgid "Journal states"
msgstr "Stanja dnevnika"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Journals"
msgstr "Dnevniki"
#. module: account_journal_period_close
#: view:account.period:account_journal_period_close.view_account_period_form
msgid "Reopen journal for this period"
msgstr "Ponovno odpri dnevnik za to obdobje"
#. module: account_journal_period_close
#: sql_constraint:account.journal.period:0
msgid "You can not add same journal in the same period twice."
msgstr "Ne morete dvakrat dodati istega dnevnika za isto obdobje."

View File

@@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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_period
from . import account_period

View File

@@ -1,83 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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, fields
from openerp.tools.translate import _
class AccountJournalPeriod(orm.Model):
_inherit = 'account.journal.period'
_order = "type,name"
_columns = {
'type': fields.related('journal_id', 'type', type='char',
relation='account.journal',
string='Journal Type',
store=True, readonly=True)
}
_sql_constraints = [
('journal_period_uniq', 'unique(period_id, journal_id)',
'You can not add same journal in the same period twice.'),
]
def _check(self, cr, uid, ids, context=None):
return True
def action_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'})
def action_done(self, cr, uid, ids, context=None):
for journal_period in self.browse(cr, uid, ids, context=context):
draft_move_ids = self.pool.get('account.move')\
.search(cr, uid, [('period_id', '=',
journal_period.period_id.id),
('state', '=', "draft"),
('journal_id', '=',
journal_period.journal_id.id)],
context=context)
if draft_move_ids:
raise orm.except_orm(_('Invalid Action!'),
_('In order to close a journal,'
' you must first post related'
' journal entries.'))
return self.write(cr, uid, ids, {'state': 'done'})
def create(self, cr, uid, values, context=None):
if 'name' not in values:
if values.get('period_id') and values.get('journal_id'):
journal = self.pool.get('account.journal')\
.browse(cr, uid, values['journal_id'], context=context)
period = self.pool.get('account.period')\
.browse(cr, uid, values['period_id'], context=context)
values.update({'name': (journal.code or journal.name)+':' +
(period.name or '')})
return super(AccountJournalPeriod, self).create(cr,
uid,
values,
context=context)

View File

@@ -1,58 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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, fields
class AccountPeriod(orm.Model):
_inherit = 'account.period'
_columns = {
'journal_period_ids': fields.one2many('account.journal.period',
'period_id', 'Journal states'),
}
def add_all_journals(self, cr, uid, ids, context=None):
this = self.browse(cr, uid, ids, context=context)[0]
journal_period_obj = self.pool.get('account.journal.period')
journal_period_ids = journal_period_obj\
.search(cr, uid, [('period_id', '=', this.id)], context=context)
journal_list = []
for journal_period in journal_period_obj.browse(cr,
uid,
journal_period_ids,
context=context):
journal_list.append(journal_period.journal_id.id)
journal_ids = self.pool.get('account.journal')\
.search(cr, uid, [('id', 'not in', journal_list)], context=context)
for journal_id in journal_ids:
journal_period_obj.create(cr,
uid,
{'period_id': this.id,
'journal_id': journal_id,
'state': this.state})

View File

@@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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 test_account_journal_period_close
checks = [
test_account_journal_period_close,
]

View File

@@ -1,224 +0,0 @@
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# 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/>.
#
#
import openerp.tests.common as common
from openerp.exceptions import except_orm
from datetime import datetime
from psycopg2 import IntegrityError
def get_simple_account_move_values(self, period_id, journal_id):
sale_product_account_id = self.ref('account.a_sale')
cash_account_id = self.ref('account.cash')
partner_id = self.ref('base.res_partner_2')
year = datetime.now().strftime('%Y')
return {'partner_id': partner_id,
'period_id': period_id,
'date': year + '-01-01',
'journal_id': journal_id,
'line_id': [(0, 0, {'name': 'test',
'account_id': cash_account_id,
'debit': 50.0,
}),
(0, 0, {'name': 'test_conterpart',
'account_id': sale_product_account_id,
'credit': 50.0,
})
]
}
def close_period(self, period_id, context=None):
close_period_wizard_id =\
self.registry('account.period.close').create(self.cr,
self.uid,
{'sure': True
},
context=context)
context.update({'active_ids': [period_id]})
self.registry('account.period.close')\
.data_save(self.cr,
self.uid,
[close_period_wizard_id],
context=context)
def create_journal_period(self, period_id, journal_id, context):
jour_per_obj = self.registry('account.journal.period')
journal_period_id = jour_per_obj.create(self.cr,
self.uid,
{'period_id': period_id,
'journal_id': journal_id,
},
context=context)
return journal_period_id
def journal_period_done(self, journal_period_id, context):
jour_per_obj = self.registry('account.journal.period')
jour_per_obj.action_done(self.cr,
self.uid,
[journal_period_id],
context=context)
def journal_period_draft(self, journal_period_id, context):
jour_per_obj = self.registry('account.journal.period')
jour_per_obj.action_draft(self.cr,
self.uid,
[journal_period_id],
context=context)
def get_journal_copy_id(self, journal_id, context=None):
return self.registry('account.journal').copy(self.cr, self.uid,
journal_id, {}, context)
def create_fiscalyear(self, year, company_id):
fiscalyear_obj = self.registry('account.fiscalyear')
fiscalyear_id = fiscalyear_obj.create(self.cr, self.uid, {
'name': year,
'code': year,
'date_start': year + '-01-01',
'date_stop': year + '-12-31',
'company_id': company_id
})
fiscalyear_obj.create_period(self.cr, self.uid, [fiscalyear_id])
return fiscalyear_id
class TestAccountJournalPeriodClose(common.TransactionCase):
def setUp(self):
super(TestAccountJournalPeriodClose, self).setUp()
company_id = self.ref('base.main_company')
fiscalyear_id = create_fiscalyear(self, '2013', company_id)
journal_id = self.ref('account.sales_journal')
self.period_id = self.registry('account.period')\
.search(self.cr, self.uid, [('fiscalyear_id', '=', fiscalyear_id)],
limit=1)[0]
self.journal_id = get_journal_copy_id(self, journal_id)
def test_close_period_open_journal(self):
context = {}
close_period(self, self.period_id, context)
journal_period_id = create_journal_period(self,
self.period_id,
self.journal_id,
context)
journal_period_draft(self, journal_period_id, context)
self.registry('account.move')\
.create(self.cr,
self.uid,
get_simple_account_move_values(self,
self.period_id,
self.journal_id),
context=context)
# Here, no exception should be raised because the journal's state is
# draft although the period is closed
def test_open_period_close_journal(self):
context = {}
journal_period_id = create_journal_period(self,
self.period_id,
self.journal_id,
context)
journal_period_done(self, journal_period_id, context)
move_values = get_simple_account_move_values(self,
self.period_id,
self.journal_id)
# I check if the exception is correctly raised at create of an account
# move which is linked with a closed journal
self.assertRaises(except_orm,
self.registry('account.move').create,
self.cr, self.uid, move_values, context=context)
def test_change_journal_on_move(self):
context = {}
journal_cash_id = self.ref('account.cash_journal')
journal_period_id = create_journal_period(self,
self.period_id,
self.journal_id,
context)
journal_period_done(self, journal_period_id, context)
move_values = get_simple_account_move_values(self,
self.period_id,
journal_cash_id)
self.registry('account.move').create(self.cr,
self.uid,
move_values,
context=context)
# Standard of Odoo doesn't check account_journal_period at write on
# account_move
# issue on Odoo github : #1633
# I check if the exception is correctly raised
# self.assertRaises(except_orm,
# self.registry('account.move').write,
# self.cr, self.uid, [move_id],
# {'journal_id': journal_id}, context=context)
def test_draft_move_close_journal(self):
context = {}
jour_per_obj = self.registry('account.journal.period')
move_values = get_simple_account_move_values(self,
self.period_id,
self.journal_id)
self.registry('account.move').create(self.cr,
self.uid,
move_values,
context=context)
journal_period_ids =\
jour_per_obj.search(self.cr,
self.uid,
[('period_id', '=', self.period_id),
('journal_id', '=', self.journal_id),
],
context=context)
# I check if the exception is correctly raised at closing journal that
# contains some draft account move
self.assertRaises(except_orm,
jour_per_obj.action_done,
self.cr, self.uid, journal_period_ids,
context=context)
def test_duplicate_journal_period(self):
context = {}
create_journal_period(self, self.period_id, self.journal_id, context)
# I check if the exception is correctly raised at adding both same
# journal on a period
self.cr._default_log_exceptions = False
try:
self.assertRaises(IntegrityError,
create_journal_period,
self, self.period_id, self.journal_id, context)
finally:
self.cr._default_log_exceptions = True

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_period_form" model="ir.ui.view">
<field name="name">account.period.form
(account_journal_period_close)</field>
<field name="model">account.period</field>
<field name="inherit_id" ref="account.view_account_period_form" />
<field name="arch" type="xml">
<xpath expr="//sheet/group" position="after">
<notebook>
<page string="Journals" attrs="{'invisible': [('state', '=', 'done')]}">
<button name="add_all_journals" string="Add all journals" type="object" states="draft"/>
<field name="journal_period_ids">
<tree editable="bottom">
<field name="journal_id" attrs="{'readonly': [('type', '!=', False)]}"/>
<field name="type"/>
<field name="state" readonly="0"
invisible="1" />
<button name="action_done"
type="object" icon="gtk-cancel"
states="draft,printed" help="Close journal for this period"/>
<button name="action_draft"
type="object" icon="gtk-redo"
states="done" help="Reopen journal for this period"/>
</tree>
</field>
</page>
</notebook>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@@ -0,0 +1 @@
../../../../account_journal_lock_date

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)