mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
Merge pull request #490 from Tecnativa/9.0-mig-account_asset_depr_line_cancel
[MIG] account_asset_depr_line_cancel: Migration to 9.0
This commit is contained in:
59
account_asset_depr_line_cancel/README.rst
Normal file
59
account_asset_depr_line_cancel/README.rst
Normal file
@@ -0,0 +1,59 @@
|
||||
.. 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/9.0
|
||||
|
||||
Known Issues
|
||||
============
|
||||
|
||||
- It can cause a sequence gap if the entries are posted (with a sequence number)
|
||||
|
||||
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>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||
* David Vidal <david.vidal@tecnativa.com>
|
||||
|
||||
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.
|
||||
5
account_asset_depr_line_cancel/__init__.py
Normal file
5
account_asset_depr_line_cancel/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
from . import models
|
||||
23
account_asset_depr_line_cancel/__openerp__.py
Normal file
23
account_asset_depr_line_cancel/__openerp__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
{
|
||||
'name': 'Assets Management - Cancel button',
|
||||
'version': '9.0.1.0.0',
|
||||
'depends': [
|
||||
'account_asset',
|
||||
],
|
||||
'author': "Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
'website': 'http://www.serviciosbaeza.com',
|
||||
'category': 'Accounting & Finance',
|
||||
'test': [
|
||||
],
|
||||
'data': [
|
||||
'views/account_asset_asset_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'license': 'AGPL-3',
|
||||
}
|
||||
4
account_asset_depr_line_cancel/models/__init__.py
Normal file
4
account_asset_depr_line_cancel/models/__init__.py
Normal file
@@ -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
|
||||
20
account_asset_depr_line_cancel/models/account_asset_asset.py
Normal file
20
account_asset_depr_line_cancel/models/account_asset_asset.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
from openerp 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
|
||||
BIN
account_asset_depr_line_cancel/static/description/icon.png
Normal file
BIN
account_asset_depr_line_cancel/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
@@ -0,0 +1,26 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_account_asset_asset_form">
|
||||
<field name="name">Account Asset Form (cancel button)</field>
|
||||
<field name="model">account.asset.asset</field>
|
||||
<field name="inherit_id" ref="account_asset.view_account_asset_asset_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="depreciation_line_ids" position="attributes">
|
||||
<attribute name="options">{'reload_on_button': true}</attribute>
|
||||
</field>
|
||||
<button name="create_move" position="after">
|
||||
<field name="move_id" invisible="1"/>
|
||||
<button name="unlink_move"
|
||||
icon="fa-times-circle text-danger"
|
||||
class="text-danger"
|
||||
string="Delete Move"
|
||||
type="object"
|
||||
confirm="Are you sure?"
|
||||
groups="account.group_account_manager"
|
||||
attrs="{'invisible': [('move_check', '=', False)]}"
|
||||
/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user