mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[ADD] locking move module
This commit is contained in:
52
account_move_locking/README.rst
Normal file
52
account_move_locking/README.rst
Normal file
@@ -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
account_move_locking/__init__.py
Normal file
21
account_move_locking/__init__.py
Normal file
@@ -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
account_move_locking/__openerp__.py
Normal file
31
account_move_locking/__openerp__.py
Normal file
@@ -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
account_move_locking/account.py
Normal file
53
account_move_locking/account.py
Normal file
@@ -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
account_move_locking/account_view.xml
Normal file
16
account_move_locking/account_view.xml
Normal file
@@ -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
account_move_locking/i18n/account_move_locking.pot
Normal file
116
account_move_locking/i18n/account_move_locking.pot
Normal file
@@ -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 ""
|
||||
|
||||
116
account_move_locking/i18n/fr.po
Normal file
116
account_move_locking/i18n/fr.po
Normal file
@@ -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 "Entrée comptable"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: view:lock.account.move:account_move_locking.lock_account_move_view
|
||||
msgid "Approve"
|
||||
msgstr "Valider"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: view:lock.account.move:account_move_locking.lock_account_move_view
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,create_uid:0
|
||||
msgid "Created by"
|
||||
msgstr "Créé par"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,create_date:0
|
||||
msgid "Created on"
|
||||
msgstr "Créé le"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,id:0
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,journal_ids:0
|
||||
msgid "Journal"
|
||||
msgstr "Journal"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,write_uid:0
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière modification par"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,write_date:0
|
||||
msgid "Last Updated on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: model:ir.model,name:account_move_locking.model_lock_account_move
|
||||
msgid "Lock Account Move"
|
||||
msgstr "Verrouiller mouvement comptable"
|
||||
|
||||
#. 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 "Verrouiler les écritues comptables"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:account.move,locked:0
|
||||
msgid "Locked"
|
||||
msgstr "Verouillé"
|
||||
|
||||
#. 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 "Ecriture verrouillée"
|
||||
|
||||
#. 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 "Pas d'écriture à verrouiller"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: field:lock.account.move,period_ids:0
|
||||
msgid "Period"
|
||||
msgstr "Période"
|
||||
|
||||
#. 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 "Ecritures non postées dans la sélection journal/période, Il faut poster les écritures avant de les verrouiller"
|
||||
|
||||
#. 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 "Attention!"
|
||||
|
||||
#. module: account_move_locking
|
||||
#: view:lock.account.move:account_move_locking.lock_account_move_view
|
||||
msgid "or"
|
||||
msgstr "ou"
|
||||
|
||||
21
account_move_locking/wizard/__init__.py
Normal file
21
account_move_locking/wizard/__init__.py
Normal file
@@ -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_lock_account_move
|
||||
62
account_move_locking/wizard/account_lock_account_move.py
Normal file
62
account_move_locking/wizard/account_lock_account_move.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# -*- 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 fields, models, api, _, exceptions
|
||||
|
||||
|
||||
class lock_account_move(models.TransientModel):
|
||||
_name = "lock.account.move"
|
||||
_description = "Lock Account Move"
|
||||
|
||||
journal_ids = fields.Many2many('account.journal',
|
||||
rel='wizard_lock_account_move_journal',
|
||||
string='Journal',
|
||||
required=True)
|
||||
period_ids = fields.Many2many('account.period',
|
||||
rel='wizard_lock_account_move_period',
|
||||
string='Period',
|
||||
required=True,
|
||||
domain=[('state', '<>', 'done')])
|
||||
|
||||
@api.multi
|
||||
def lock_move(self, data):
|
||||
obj_move = self.env['account.move']
|
||||
draft_move = obj_move.search([('state', '=', 'draft'),
|
||||
('journal_id',
|
||||
'in',
|
||||
self.journal_ids.ids),
|
||||
('period_id', 'in',
|
||||
self.period_ids.ids)],
|
||||
order='date')
|
||||
if draft_move:
|
||||
raise exceptions.Warning(_('Warning!'),
|
||||
_('Unposted move in period/jounal \
|
||||
selected, please post it before \
|
||||
locking them'))
|
||||
move = obj_move.search([('state', '=', 'posted'),
|
||||
('locked', '=', False),
|
||||
('journal_id', 'in', self.journal_ids.ids),
|
||||
('period_id', 'in', self.period_ids.ids)],
|
||||
order='date')
|
||||
if not move:
|
||||
raise exceptions.Warning(_('Warning!'),
|
||||
_('No move to locked found'))
|
||||
move.write({'locked': True})
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
41
account_move_locking/wizard/account_lock_move_view.xml
Normal file
41
account_move_locking/wizard/account_lock_move_view.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--Account Moves-->
|
||||
<record id="lock_account_move_view" model="ir.ui.view">
|
||||
<field name="name">lock Journal Entries</field>
|
||||
<field name="model">lock.account.move</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Lock Journal Entries">
|
||||
<group>
|
||||
<field name="journal_ids"/>
|
||||
<field name="period_ids"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Approve" name="lock_move" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_lock_account_move" model="ir.actions.act_window">
|
||||
<field name="name">Lock Journal Entries</field>
|
||||
<field name="res_model">lock.account.move</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="lock_account_move_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Lock Journal Entries"
|
||||
parent="account.periodical_processing_journal_entries_validation"
|
||||
action="action_lock_account_move"
|
||||
id="menu_lock_account_moves"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user