Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] account_asset_low_value #1926

Open
wants to merge 11 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions account_asset_low_value/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
===================================
Assets Management - Low Value Asset
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f481517e095ca880752359f7bc01b1ecb04c854f4384b3b6bd8e3c0fc278530e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/16.0/account_asset_low_value
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_asset_low_value
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Low-Value Asset (LVA) are typically asset with low values and was booked as expense on vendor bill.
In essence, the low value asset is not really and asset but an expense need to tracke as asset.
As such, it has no residual value, run no depreciation. And when removed, only status is changed (no accounting entry).

To create low value asset, use the Asset Profile with following setting,

1. Asset Account = Expense (low value asset)
2. Number of Years = 0

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_asset_low_value%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Ecosoft

Contributors
~~~~~~~~~~~~

* `Ecosoft <http://ecosoft.co.th>`__:

* Kitti U. <[email protected]>
* Pimolnat Suntian <[email protected]>
* Saran Lim. <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-kittiu| image:: https://github.com/kittiu.png?size=40px
:target: https://github.com/kittiu
:alt: kittiu

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-kittiu|

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/16.0/account_asset_low_value>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions account_asset_low_value/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import wizard
19 changes: 19 additions & 0 deletions account_asset_low_value/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Assets Management - Low Value Asset",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"category": "Accounting & Finance",
"depends": ["account_asset_management"],
"data": [
"wizard/account_asset_remove.xml",
"views/account_asset_views.xml",
],
"installable": True,
"maintainers": ["kittiu"],
"development_status": "Alpha",
}
56 changes: 56 additions & 0 deletions account_asset_low_value/i18n/account_asset_low_value.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_asset_low_value
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_asset_low_value
#: model:ir.model,name:account_asset_low_value.model_account_asset
msgid "Asset"
msgstr ""

#. module: account_asset_low_value
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.asset_low_value_remove_form
msgid "Cancel"
msgstr ""

#. module: account_asset_low_value
#: model:ir.model.fields,field_description:account_asset_low_value.field_account_asset__low_value
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.account_asset_view_search
msgid "Low Value Asset"
msgstr ""

#. module: account_asset_low_value
#: model:ir.model.fields,help:account_asset_low_value.field_account_asset__low_value
msgid ""
"Low-Value Asset (LVA) is true when the asset profile set\n"
"1. Asset Account = Expense (low value asset)\n"
"2. Number of Years = 0 years\n"
"In essense, the low value asset is not really and asset but an expense tracked as asset, as such, it has no residual value. And when removed, only status is changed (no accounting entry)."
msgstr ""

#. module: account_asset_low_value
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.account_asset_view_search
msgid "Normal Asset"
msgstr ""

#. module: account_asset_low_value
#: model:ir.model,name:account_asset_low_value.model_account_asset_remove
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.asset_low_value_remove_form
msgid "Remove Asset"
msgstr ""

#. module: account_asset_low_value
#: code:addons/account_asset_low_value/models/account_asset.py:0
#, python-format
msgid "Remove Low Value Asset"
msgstr ""
66 changes: 66 additions & 0 deletions account_asset_low_value/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_asset_low_value
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-10 19:36+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: account_asset_low_value
#: model:ir.model,name:account_asset_low_value.model_account_asset
msgid "Asset"
msgstr "Activo"

#. module: account_asset_low_value
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.asset_low_value_remove_form
msgid "Cancel"
msgstr "Cancelar"

#. module: account_asset_low_value
#: model:ir.model.fields,field_description:account_asset_low_value.field_account_asset__low_value
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.account_asset_view_search
msgid "Low Value Asset"
msgstr "Activo de bajo valor"

#. module: account_asset_low_value
#: model:ir.model.fields,help:account_asset_low_value.field_account_asset__low_value
msgid ""
"Low-Value Asset (LVA) is true when the asset profile set\n"
"1. Asset Account = Expense (low value asset)\n"
"2. Number of Years = 0 years\n"
"In essense, the low value asset is not really and asset but an expense tracked as asset, as such, it has no residual value. And when removed, only status is changed (no accounting entry)."
msgstr ""
"Activo de escaso valor (LVA) es verdadero cuando el perfil del activo "
"establece\n"
"1. Cuenta de activo = Gasto (activo de bajo valor)\n"
"2. Número de años = 0 años\n"
"En esencia, el activo de bajo valor no es realmente un activo sino un gasto "
"contabilizado como activo, como tal, no tiene valor residual. Y cuando se "
"elimina, sólo se cambia el estado (no hay asiento contable)."

#. module: account_asset_low_value
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.account_asset_view_search
msgid "Normal Asset"
msgstr "Activo normal"

#. module: account_asset_low_value
#: model:ir.model,name:account_asset_low_value.model_account_asset_remove
#: model_terms:ir.ui.view,arch_db:account_asset_low_value.asset_low_value_remove_form
msgid "Remove Asset"
msgstr "Eliminar activo"

#. module: account_asset_low_value
#: code:addons/account_asset_low_value/models/account_asset.py:0
#, python-format
msgid "Remove Low Value Asset"
msgstr "Eliminar activos de poco valor"
3 changes: 3 additions & 0 deletions account_asset_low_value/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_asset
75 changes: 75 additions & 0 deletions account_asset_low_value/models/account_asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models


class AccountAsset(models.Model):
_inherit = "account.asset"

low_value = fields.Boolean(
string="Low Value Asset",
compute="_compute_low_value",
search="_search_low_value",
help="Low-Value Asset (LVA) is true when the asset profile set\n"
"1. Asset Account = Expense (low value asset)\n"
"2. Number of Years = 0 years\n"
"In essense, the low value asset is not really and asset but an expense "
"tracked as asset, as such, it has no residual value. And when removed, "
"only status is changed (no accounting entry).",
)

@api.depends("profile_id", "method_number")
def _compute_low_value(self):
for asset in self:
asset.low_value = (
asset.profile_id.account_asset_id.account_type == "expense"
and asset.method_number == 0
)

@api.model
def _search_low_value(self, operator, value):
if operator == "=":
return [
("profile_id.account_asset_id.account_type", "=", "expense"),
("method_number", "=", 0),
]
if operator == "!=":
return [
"|",
("profile_id.account_asset_id.account_type", "!=", "expense"),
("method_number", "!=", 0),
]

def _compute_depreciation(self):
res = super()._compute_depreciation()
# For low value asset, there is no depreciation
for asset in self:
if asset.low_value:
asset.value_residual = 0
return res

def validate(self):
res = super().validate()
# For low value asset, state = "open" even value_residual = 0
for asset in self:
if asset.low_value:
asset.state = "open"
return res

def remove(self):
self.ensure_one()
ctx = dict(self.env.context, active_ids=self.ids, active_id=self.id)
# Removing low value asset, use different wizard
if self.low_value:
view = self.env.ref("account_asset_low_value.asset_low_value_remove_form")
return {
"name": _("Remove Low Value Asset"),
"view_mode": "form",
"res_model": "account.asset.remove",
"view_id": view.id,
"target": "new",
"type": "ir.actions.act_window",
"context": ctx,
}
return super().remove()

Check warning on line 75 in account_asset_low_value/models/account_asset.py

View check run for this annotation

Codecov / codecov/patch

account_asset_low_value/models/account_asset.py#L75

Added line #L75 was not covered by tests
5 changes: 5 additions & 0 deletions account_asset_low_value/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Ecosoft <http://ecosoft.co.th>`__:

* Kitti U. <[email protected]>
* Pimolnat Suntian <[email protected]>
* Saran Lim. <[email protected]>
8 changes: 8 additions & 0 deletions account_asset_low_value/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Low-Value Asset (LVA) are typically asset with low values and was booked as expense on vendor bill.
In essence, the low value asset is not really and asset but an expense need to tracke as asset.
As such, it has no residual value, run no depreciation. And when removed, only status is changed (no accounting entry).

To create low value asset, use the Asset Profile with following setting,

1. Asset Account = Expense (low value asset)
2. Number of Years = 0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading