Skip to content

Commit

Permalink
Merge pull request #244 from vrenaville/add_locking_module
Browse files Browse the repository at this point in the history
[ADD] locking move module
  • Loading branch information
nbessi committed Jul 1, 2015
2 parents 0b51096 + 3916c59 commit 3d48da8
Show file tree
Hide file tree
Showing 10 changed files with 529 additions and 0 deletions.
52 changes: 52 additions & 0 deletions account_move_locking/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3

Module name
===========

This module add the ability to lock move for modification

Configuration
=============



Usage
=====
In order the locked the move you need to follow this process
* You need to post your move, with the standard wizard Post Journal Entries
(Invoicing -> Periodic Processing -> Draft Entries -> Post Journal Entries)
* After the you can use the wizard Lock Journal Entries
(Invoicing -> Periodic Processing -> Draft Entries -> Lock Journal Entries)

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/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
`here <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_locking%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Contributors
------------

* Vincent renaville <vincen.renaville@camptocamp.com>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://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 http://odoo-community.org.
21 changes: 21 additions & 0 deletions account_move_locking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville. Copyright 2015 Camptocamp SA
#
# 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
from . import wizard
31 changes: 31 additions & 0 deletions account_move_locking/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville.
# Copyright 2015 Camptocamp SA
#
# 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": "Move locked to prevent modification",
"version": "1.0",
"depends": ["base", "account"],
"author": "Camptocamp,Odoo Community Association (OCA)",
'license': 'AGPL-3',
'website': 'http://www.camptocamp.com',
'data': ['account_view.xml',
'wizard/account_lock_move_view.xml'],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
53 changes: 53 additions & 0 deletions account_move_locking/account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville.
# Copyright 2015 Camptocamp SA
#
# 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 import models, fields, api, exceptions, _


class AccountMove(models.Model):
_inherit = 'account.move'

locked = fields.Boolean('Locked', readonly=True)

@api.multi
def write(self, vals):
for move in self:
if move.locked:
raise exceptions.Warning(_('Move Locked!'),
move.name)
return super(AccountMove, self).write(vals)

@api.multi
def unlink(self):
for move in self:
if move.locked:
raise exceptions.Warning(_('Move Locked!'),
move.name)
return super(AccountMove, self).unlink()

@api.multi
def button_cancel(self):
# Cancel a move was done directly in SQL
# so we need to test manualy if the move is locked
for move in self:
if move.locked:
raise exceptions.Warning(_('Move Locked!'),
move.name)
return super(AccountMove, self).button_cancel()
16 changes: 16 additions & 0 deletions account_move_locking/account_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<openerp>
<data>

<record id="view_move_form_locked" model="ir.ui.view">
<field name="name">account.move.form.locked</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<field name="to_check" position="after">
<field name="locked" />
</field>
</field>
</record>

</data>
</openerp>
116 changes: 116 additions & 0 deletions account_move_locking/i18n/account_move_locking.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_locking
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-25 06:47+0000\n"
"PO-Revision-Date: 2015-06-25 06:47+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_move_locking
#: model:ir.model,name:account_move_locking.model_account_move
msgid "Account Entry"
msgstr ""

#. module: account_move_locking
#: view:lock.account.move:account_move_locking.lock_account_move_view
msgid "Approve"
msgstr ""

#. module: account_move_locking
#: view:lock.account.move:account_move_locking.lock_account_move_view
msgid "Cancel"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,create_uid:0
msgid "Created by"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,create_date:0
msgid "Created on"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,id:0
msgid "ID"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,journal_ids:0
msgid "Journal"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,write_uid:0
msgid "Last Updated by"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,write_date:0
msgid "Last Updated on"
msgstr ""

#. module: account_move_locking
#: model:ir.model,name:account_move_locking.model_lock_account_move
msgid "Lock Account Move"
msgstr ""

#. module: account_move_locking
#: model:ir.actions.act_window,name:account_move_locking.action_lock_account_move
#: model:ir.ui.menu,name:account_move_locking.menu_lock_account_moves
#: view:lock.account.move:account_move_locking.lock_account_move_view
msgid "Lock Journal Entries"
msgstr ""

#. module: account_move_locking
#: field:account.move,locked:0
msgid "Locked"
msgstr ""

#. module: account_move_locking
#: code:addons/account_move_locking/account.py:33
#: code:addons/account_move_locking/account.py:41
#: code:addons/account_move_locking/account.py:51
#, python-format
msgid "Move Locked!"
msgstr ""

#. module: account_move_locking
#: code:addons/account_move_locking/wizard/account_lock_account_move.py:49
#, python-format
msgid "No move to locked found"
msgstr ""

#. module: account_move_locking
#: field:lock.account.move,period_ids:0
msgid "Period"
msgstr ""

#. module: account_move_locking
#: code:addons/account_move_locking/wizard/account_lock_account_move.py:46
#, python-format
msgid "Unposted move in period/jounal selected, please post it before locking them"
msgstr ""

#. module: account_move_locking
#: code:addons/account_move_locking/wizard/account_lock_account_move.py:46
#: code:addons/account_move_locking/wizard/account_lock_account_move.py:49
#, python-format
msgid "Warning!"
msgstr ""

#. module: account_move_locking
#: view:lock.account.move:account_move_locking.lock_account_move_view
msgid "or"
msgstr ""

Loading

0 comments on commit 3d48da8

Please sign in to comment.