Migrate account_move_locking to 10.0

This commit is contained in:
Akim Juillerat
2017-04-13 11:28:59 +02:00
parent 5bfbd48e61
commit 4c3489ad68
10 changed files with 47 additions and 137 deletions

View File

@@ -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
----------

View File

@@ -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

View File

@@ -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:

View File

@@ -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()

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import account

View 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()

View File

@@ -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>

View File

@@ -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

View File

@@ -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"

View File

@@ -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>