mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Migrate account_move_locking to 10.0
This commit is contained in:
@@ -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 <vincen.renaville@camptocamp.com>
|
||||
* Vincent Renaville <vincent.renaville@camptocamp.com>
|
||||
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import account
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
##############################################################################
|
||||
{
|
||||
"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:
|
||||
|
||||
@@ -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 <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.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()
|
||||
2
account_move_locking/models/__init__.py
Normal file
2
account_move_locking/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import account
|
||||
32
account_move_locking/models/account.py
Normal file
32
account_move_locking/models/account.py
Normal file
@@ -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()
|
||||
@@ -1,4 +1,4 @@
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_move_form_locked" model="ir.ui.view">
|
||||
@@ -13,4 +13,4 @@
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
##############################################################################
|
||||
|
||||
from . import account_lock_account_move
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
##############################################################################
|
||||
|
||||
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"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!--Account Moves-->
|
||||
@@ -15,7 +15,6 @@
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Approve" name="lock_move" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
@@ -39,4 +38,4 @@
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user