diff --git a/account_move_locking/README.rst b/account_move_locking/README.rst index 4d977f21d..467cfae3c 100644 --- a/account_move_locking/README.rst +++ b/account_move_locking/README.rst @@ -19,7 +19,7 @@ In order to lock the journal entry, you need to follow this process: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/92/9.0 + :target: https://runbot.odoo-community.org/runbot/92/10.0 Bug Tracker =========== @@ -35,7 +35,8 @@ Credits Contributors ------------ -* Vincent Renaville +* Vincent Renaville +* Akim Juillerat Maintainer ---------- diff --git a/account_move_locking/__init__.py b/account_move_locking/__init__.py index e0df21635..408a6001b 100644 --- a/account_move_locking/__init__.py +++ b/account_move_locking/__init__.py @@ -1,21 +1,3 @@ # -*- 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 . -# -############################################################################## -from . import account +from . import models from . import wizard diff --git a/account_move_locking/__manifest__.py b/account_move_locking/__manifest__.py index b4d9341db..3038a9a14 100644 --- a/account_move_locking/__manifest__.py +++ b/account_move_locking/__manifest__.py @@ -1,31 +1,12 @@ # -*- 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 . -############################################################################## { "name": "Move locked to prevent modification", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "depends": ["base", "account"], "author": "Camptocamp,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'http://www.camptocamp.com', - 'data': ['account_view.xml', + 'data': ['views/account_view.xml', 'wizard/account_lock_move_view.xml'], - 'installable': False, + 'installable': True, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_move_locking/account.py b/account_move_locking/account.py deleted file mode 100644 index 006b0191d..000000000 --- a/account_move_locking/account.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- 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 . -############################################################################## - -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.UserError(_('Move Locked! %s') % (move.name)) - return super(AccountMove, self).write(vals) - - @api.multi - def unlink(self): - for move in self: - if move.locked: - raise exceptions.UserError(_('Move Locked! %s') % (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.UserError(_('Move Locked! %s') % (move.name)) - return super(AccountMove, self).button_cancel() diff --git a/account_move_locking/models/__init__.py b/account_move_locking/models/__init__.py new file mode 100644 index 000000000..d90384dfb --- /dev/null +++ b/account_move_locking/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import account diff --git a/account_move_locking/models/account.py b/account_move_locking/models/account.py new file mode 100644 index 000000000..c9b8e0110 --- /dev/null +++ b/account_move_locking/models/account.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +from odoo 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.UserError(_('Move Locked! %s') % (move.name)) + return super(AccountMove, self).write(vals) + + @api.multi + def unlink(self): + for move in self: + if move.locked: + raise exceptions.UserError(_('Move Locked! %s') % (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.UserError(_('Move Locked! %s') % (move.name)) + return super(AccountMove, self).button_cancel() diff --git a/account_move_locking/account_view.xml b/account_move_locking/views/account_view.xml similarity index 95% rename from account_move_locking/account_view.xml rename to account_move_locking/views/account_view.xml index 4d4828c21..7f88b6436 100644 --- a/account_move_locking/account_view.xml +++ b/account_move_locking/views/account_view.xml @@ -1,4 +1,4 @@ - + @@ -13,4 +13,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/account_move_locking/wizard/__init__.py b/account_move_locking/wizard/__init__.py index 648d27324..c68ab1cc0 100644 --- a/account_move_locking/wizard/__init__.py +++ b/account_move_locking/wizard/__init__.py @@ -1,21 +1,2 @@ # -*- 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 . -############################################################################## - from . import account_lock_account_move diff --git a/account_move_locking/wizard/account_lock_account_move.py b/account_move_locking/wizard/account_lock_account_move.py index ee18afee6..1f71e2c29 100644 --- a/account_move_locking/wizard/account_lock_account_move.py +++ b/account_move_locking/wizard/account_lock_account_move.py @@ -1,27 +1,9 @@ # -*- 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 . -############################################################################## -from openerp import fields, models, api, _, exceptions +from odoo import fields, models, api, _, exceptions -class lock_account_move(models.TransientModel): +class LockAccountMove(models.TransientModel): _name = "lock.account.move" _description = "Lock Account Move" diff --git a/account_move_locking/wizard/account_lock_move_view.xml b/account_move_locking/wizard/account_lock_move_view.xml index ebcf94a82..1fb2b3e5e 100644 --- a/account_move_locking/wizard/account_lock_move_view.xml +++ b/account_move_locking/wizard/account_lock_move_view.xml @@ -1,5 +1,5 @@ - + @@ -15,7 +15,6 @@ @@ -39,4 +38,4 @@ /> - +