2
0

[IMP][account_asset_management] Define a list of move's fields that can't be modified if a move is linked with a depriciation line

[IMP][account_asset_management] Define FIELDS_AFFETCS_ASSET_MOVE as a set directly
This commit is contained in:
Adrien Peiffer (ACSONE) 2015-05-29 08:02:10 +02:00 committed by Rodrigo
parent e9bbf96a9a
commit b963cc17ee
3 changed files with 69 additions and 31 deletions

View File

@ -0,0 +1,64 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Financial asset management.
===========================
This Module manages the assets owned by a company. It will keep
track of depreciation's occurred on those assets. And it allows to create
accounting entries from the depreciation lines.
The full asset life-cycle is managed (from asset creation to asset removal).
Assets can be created manually as well as automatically
(via the creation of an accounting entry on the asset account).
Excel based reporting is available via the 'account_asset_management_xls' module.
The module contains a large number of functional enhancements compared to
the standard account_asset module from Odoo.
Configuration
=============
It is recommended to configure your Purchase Journal with "Group Invoice Lines" to avoid the
creation of separate assets per Supplier Invoice Line.
Known issues
============
The module in NOT compatible with the standard account_asset module.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/{project_repo}/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/{project_repo}/issues/new?body=module:%20{module_name}%0Aversion:%20{version}%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
- OpenERP SA
- Luc De Meyer (Noviat)
- Frédéric Clementi (camptocamp)
- Florian Dacosta (Akretion)
- Stéphane Bidoul (Acsone)
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.

View File

@ -26,35 +26,6 @@
'depends': ['account'],
'conflicts': ['account_asset'],
'author': "OpenERP & Noviat,Odoo Community Association (OCA)",
'description': """
Financial asset management.
===========================
This Module manages the assets owned by a company. It will keep
track of depreciation's occurred on those assets. And it allows to create
accounting entries from the depreciation lines.
The full asset life-cycle is managed (from asset creation to asset removal).
Assets can be created manually as well as automatically
(via the creation of an accounting entry on the asset account).
Excel based reporting is available via the 'account_asset_management_xls'
module (cf. http://odoo.apps.com).
The module contains a large number of functional enhancements compared to
the standard account_asset module from OpenERP/Odoo.
The module in NOT compatible with the standard account_asset module.
Contributors
------------
- OpenERP SA
- Luc De Meyer (Noviat)
- Frédéric Clementi (camptocamp)
- Florian Dacosta (Akretion)
- Stéphane Bidoul (Acsone)
""",
'website': 'http://www.noviat.com',
'category': 'Accounting & Finance',
'sequence': 32,
@ -79,4 +50,3 @@ Contributors
'installable': True,
'application': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -26,6 +26,10 @@ from openerp.tools.translate import _
import logging
_logger = logging.getLogger(__name__)
# List of move's fields that can't be modified if move is linked
# with a depreciation line
FIELDS_AFFECTS_ASSET_MOVE = set(['period_id', 'journal_id', 'date'])
class account_move(orm.Model):
_inherit = 'account.move'
@ -51,7 +55,7 @@ class account_move(orm.Model):
cr, uid, ids, context=context, check=check)
def write(self, cr, uid, ids, vals, context=None):
if vals:
if set(vals).intersection(FIELDS_AFFECTS_ASSET_MOVE):
if isinstance(ids, (int, long)):
ids = [ids]
depr_obj = self.pool.get('account.asset.depreciation.line')