diff --git a/account_asset_depr_line_cancel/README.rst b/account_asset_depr_line_cancel/README.rst new file mode 100644 index 000000000..08330d3ef --- /dev/null +++ b/account_asset_depr_line_cancel/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +================================================ +Cancel button on account asset depreciation line +================================================ + +This module adds a button to allow to remove the depreciation journal entry +created by each asset depreciation line. + +Usage +===== + +On each depreciation line that has created a journal entry, you have a new +button with a white cross in a red circle that allows to remove that entry. + +.. 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/10.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + + +Credits +======= + +Contributors +------------ + +* Pedro M. Baeza +* David Vidal + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://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. diff --git a/account_asset_depr_line_cancel/__init__.py b/account_asset_depr_line_cancel/__init__.py new file mode 100644 index 000000000..2d03b3582 --- /dev/null +++ b/account_asset_depr_line_cancel/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import models diff --git a/account_asset_depr_line_cancel/__manifest__.py b/account_asset_depr_line_cancel/__manifest__.py new file mode 100644 index 000000000..227cea5fd --- /dev/null +++ b/account_asset_depr_line_cancel/__manifest__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Pedro M. Baeza +# Copyright 2017 David Vidal +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + 'name': 'Assets Management - Cancel button', + 'version': '10.0.1.0.0', + 'author': "Tecnativa, " + "Odoo Community Association (OCA)", + 'website': 'http://www.serviciosbaeza.com', + 'category': 'Accounting & Finance', + 'test': [ + ], + 'data': [ + 'views/account_asset_asset_view.xml', + ], + 'depends': [ + 'account_asset', + ], + 'installable': True, + 'license': 'AGPL-3', +} diff --git a/account_asset_depr_line_cancel/models/__init__.py b/account_asset_depr_line_cancel/models/__init__.py new file mode 100644 index 000000000..6c40007c9 --- /dev/null +++ b/account_asset_depr_line_cancel/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import account_asset_asset diff --git a/account_asset_depr_line_cancel/models/account_asset_asset.py b/account_asset_depr_line_cancel/models/account_asset_asset.py new file mode 100644 index 000000000..5868113da --- /dev/null +++ b/account_asset_depr_line_cancel/models/account_asset_asset.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Pedro M. Baeza +# Copyright 2017 David Vidal +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import models, api + + +class AccountAssetDepreciationLine(models.Model): + _inherit = 'account.asset.depreciation.line' + + @api.multi + def unlink_move(self): + moves = self.mapped('move_id') + moves.filtered(lambda x: x.state == 'posted').button_cancel() + moves.unlink() + self.write({'move_check': False}) + self.mapped('asset_id').filtered(lambda x: x.state == 'close').write({ + 'state': 'open', + }) + return True diff --git a/account_asset_depr_line_cancel/static/description/icon.png b/account_asset_depr_line_cancel/static/description/icon.png new file mode 100644 index 000000000..198c5ee08 Binary files /dev/null and b/account_asset_depr_line_cancel/static/description/icon.png differ diff --git a/account_asset_depr_line_cancel/static/description/icon.svg b/account_asset_depr_line_cancel/static/description/icon.svg new file mode 100644 index 000000000..f06336a8d --- /dev/null +++ b/account_asset_depr_line_cancel/static/description/icon.svg @@ -0,0 +1,391 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/account_asset_depr_line_cancel/views/account_asset_asset_view.xml b/account_asset_depr_line_cancel/views/account_asset_asset_view.xml new file mode 100644 index 000000000..7d4f36be9 --- /dev/null +++ b/account_asset_depr_line_cancel/views/account_asset_asset_view.xml @@ -0,0 +1,26 @@ + + + + Account Asset Form (cancel button) + account.asset.asset + + + + {'reload_on_button': true} + + + + + +