mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
115
account_asset_transfer/README.rst
Normal file
115
account_asset_transfer/README.rst
Normal file
@@ -0,0 +1,115 @@
|
||||
================================
|
||||
Asset Transfer from AUC to Asset
|
||||
================================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:5fb144c4441c023dcd6f27dcd7be70952e7b51761699c1c4e0a08f50f8bc9c97
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |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_transfer
|
||||
: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_transfer
|
||||
: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|
|
||||
|
||||
This module allow transferring assets under construction (AUC) to normal assets.
|
||||
|
||||
AUC is Asset under construction where some assets are in construction phase and
|
||||
cost needs to be captured for the time being. Once asset is fully completed then
|
||||
cost would be transferred to final asset
|
||||
|
||||
**Note:**
|
||||
|
||||
* If the asset don't have journal entries, asset transfer will use account settings from the asset/asset profile instead.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
On asset profile, user can setup default Transfer Journal, to be used during transfer.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Given asset under construction has been created, i.e., by vendor bill.
|
||||
|
||||
- Go to asset menu
|
||||
- Filter "Transferrable" assets and look for desired assets to transfer
|
||||
- Select assets to transfer, and click action "Transfer Asset"
|
||||
- On asset transfer wizard, on the "To New Asset" tab, choose new profile(s)
|
||||
- Click "Transfer" button
|
||||
- Odoo will create journal entry as well as new asset(s)
|
||||
|
||||
**Note:** You can click "Expand Asset" button for expand asset line that selects the asset profile set to be "Create an asset by product item"
|
||||
|
||||
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_transfer%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. <kittiu@ecosoft.co.th>
|
||||
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
|
||||
* Saran Lim. <saranl@ecosoft.co.th>
|
||||
|
||||
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_transfer>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
4
account_asset_transfer/__init__.py
Normal file
4
account_asset_transfer/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
19
account_asset_transfer/__manifest__.py
Normal file
19
account_asset_transfer/__manifest__.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Asset Transfer from AUC to Asset",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["account_asset_management"],
|
||||
"author": "Ecosoft, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-financial-tools",
|
||||
"category": "Accounting & Finance",
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/account_asset.xml",
|
||||
"views/account_asset_profile.xml",
|
||||
"wizard/account_asset_transfer.xml",
|
||||
],
|
||||
"maintainers": ["kittiu"],
|
||||
}
|
||||
295
account_asset_transfer/i18n/account_asset_transfer.pot
Normal file
295
account_asset_transfer/i18n/account_asset_transfer.pot
Normal file
@@ -0,0 +1,295 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_asset_transfer
|
||||
#
|
||||
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_transfer
|
||||
#: model:ir.model.fields,help:account_asset_transfer.field_account_asset__can_transfer
|
||||
msgid "Allow transfer AUC (running) to Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__analytic_account_id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__analytic_account_id
|
||||
msgid "Analytic account"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__analytic_tag_ids
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__analytic_tag_ids
|
||||
msgid "Analytic tags"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset
|
||||
msgid "Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Asset From"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__asset_name
|
||||
msgid "Asset Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__asset_profile_id
|
||||
msgid "Asset Profile"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Asset To"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/wizard/account_asset_transfer.py:0
|
||||
#, python-format
|
||||
msgid "Asset Transfer Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__asset_value
|
||||
msgid "Asset Value"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset_profile
|
||||
msgid "Asset profile"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/models/account_asset.py:0
|
||||
#, python-format
|
||||
msgid "Assets"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__balance
|
||||
msgid "Balance"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset__can_transfer
|
||||
msgid "Can Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_search
|
||||
msgid "Can be transferred"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__company_id
|
||||
msgid "Company"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__create_uid
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__create_uid
|
||||
msgid "Created by"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__create_date
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__create_date
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__currency_id
|
||||
msgid "Currency"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__display_name
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Expand Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "From"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__from_asset_ids
|
||||
msgid "From Asset(s)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__from_asset_value
|
||||
msgid "From Value"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset__is_transfer
|
||||
msgid "Is Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer____last_update
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__write_uid
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__write_date
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__note
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/models/account_asset.py:0
|
||||
#, python-format
|
||||
msgid "Only running assets without depreciation (AUC) can transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__partner_id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__partner_id
|
||||
msgid "Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__quantity
|
||||
msgid "Quantity"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid ""
|
||||
"There are no journal entries on current asset(s), asset transfer will use "
|
||||
"account settings from the asset/asset profile instead."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__to_asset_ids
|
||||
msgid "To Asset(s)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "To New Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__to_asset_value
|
||||
msgid "To Value"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/wizard/account_asset_transfer.py:0
|
||||
#, python-format
|
||||
msgid "Total values of new assets must equal to source assets"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__transfer_id
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/models/account_asset.py:0
|
||||
#, python-format
|
||||
msgid "Transfer AUC to Asset & Create Transfer Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.actions.act_window,name:account_asset_transfer.action_account_asset_transfer
|
||||
#: model:ir.actions.server,name:account_asset_transfer.action_asset_transfer_from_list
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Transfer Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__date_transfer
|
||||
msgid "Transfer Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_profile__transfer_journal_id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__transfer_journal_id
|
||||
msgid "Transfer Journal"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset_transfer_line
|
||||
msgid "Transfer To Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Transfer asset from AUC to Asset"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,help:account_asset_transfer.field_account_asset_transfer__date_transfer
|
||||
msgid "Transfer date must be after the asset journal entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_search
|
||||
msgid "Transferable"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__price_unit
|
||||
msgid "Unit Price"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/wizard/account_asset_transfer.py:0
|
||||
#, python-format
|
||||
msgid "Value of new asset must greater than 0.0"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,help:account_asset_transfer.field_account_asset__is_transfer
|
||||
msgid ""
|
||||
"flag indicating if the asset has been transferred from/to another asset."
|
||||
msgstr ""
|
||||
302
account_asset_transfer/i18n/es.po
Normal file
302
account_asset_transfer/i18n/es.po
Normal file
@@ -0,0 +1,302 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_asset_transfer
|
||||
#
|
||||
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 <informatica@totmaterial.es>\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_transfer
|
||||
#: model:ir.model.fields,help:account_asset_transfer.field_account_asset__can_transfer
|
||||
msgid "Allow transfer AUC (running) to Asset"
|
||||
msgstr "Permitir transferencia AUC (en curso) a Activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__analytic_account_id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__analytic_account_id
|
||||
msgid "Analytic account"
|
||||
msgstr "Cuenta Analítica"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__analytic_tag_ids
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__analytic_tag_ids
|
||||
msgid "Analytic tags"
|
||||
msgstr "Etiquetas analíticas"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset
|
||||
msgid "Asset"
|
||||
msgstr "Activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Asset From"
|
||||
msgstr "Activo Desde"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__asset_name
|
||||
msgid "Asset Name"
|
||||
msgstr "Nombre del activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__asset_profile_id
|
||||
msgid "Asset Profile"
|
||||
msgstr "Perfil del activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Asset To"
|
||||
msgstr "Activo a"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/wizard/account_asset_transfer.py:0
|
||||
#, python-format
|
||||
msgid "Asset Transfer Journal Entry"
|
||||
msgstr "Entrada en el diario de transferencia de activos"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__asset_value
|
||||
msgid "Asset Value"
|
||||
msgstr "Valor del activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset_profile
|
||||
msgid "Asset profile"
|
||||
msgstr "Perfil del activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/models/account_asset.py:0
|
||||
#, python-format
|
||||
msgid "Assets"
|
||||
msgstr "Activos"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__balance
|
||||
msgid "Balance"
|
||||
msgstr "Saldo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset__can_transfer
|
||||
msgid "Can Transfer"
|
||||
msgstr "Puede transferir"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_search
|
||||
msgid "Can be transferred"
|
||||
msgstr "Se puede transferir"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__company_id
|
||||
msgid "Company"
|
||||
msgstr "Compañía"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__create_uid
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Creado por"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__create_date
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__create_date
|
||||
msgid "Created on"
|
||||
msgstr "Creado el"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Divisa"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__display_name
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Mostrar Nombre"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Expand Asset"
|
||||
msgstr "Ampliar activos"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "From"
|
||||
msgstr "Desde"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__from_asset_ids
|
||||
msgid "From Asset(s)"
|
||||
msgstr "Desde Activo(s)"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__from_asset_value
|
||||
msgid "From Value"
|
||||
msgstr "Desde Valor"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__id
|
||||
msgid "ID"
|
||||
msgstr "ID (identificación)"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset__is_transfer
|
||||
msgid "Is Transfer"
|
||||
msgstr "Es Transferencia"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer____last_update
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Última Modifiación en"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__write_uid
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Última actualización por"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__write_date
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Última Actualización el"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__note
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Notes"
|
||||
msgstr "Notas"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/models/account_asset.py:0
|
||||
#, python-format
|
||||
msgid "Only running assets without depreciation (AUC) can transfer"
|
||||
msgstr "Sólo pueden transferirse los activos circulantes sin amortización (AUC)"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__partner_id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__partner_id
|
||||
msgid "Partner"
|
||||
msgstr "Socio"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__quantity
|
||||
msgid "Quantity"
|
||||
msgstr "Cantidad"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid ""
|
||||
"There are no journal entries on current asset(s), asset transfer will use "
|
||||
"account settings from the asset/asset profile instead."
|
||||
msgstr ""
|
||||
"No hay asientos en los activos actuales, la transferencia de activos "
|
||||
"utilizará en su lugar los ajustes de cuenta del perfil de activo/activo."
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__to_asset_ids
|
||||
msgid "To Asset(s)"
|
||||
msgstr "A Activo(s)"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "To New Asset"
|
||||
msgstr "Al nuevo activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__to_asset_value
|
||||
msgid "To Value"
|
||||
msgstr "Para valorar"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/wizard/account_asset_transfer.py:0
|
||||
#, python-format
|
||||
msgid "Total values of new assets must equal to source assets"
|
||||
msgstr ""
|
||||
"El valor total de los activos nuevos debe ser igual al de los activos de "
|
||||
"origen"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__transfer_id
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Transfer"
|
||||
msgstr "Transferencia"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/models/account_asset.py:0
|
||||
#, python-format
|
||||
msgid "Transfer AUC to Asset & Create Transfer Journal Entry"
|
||||
msgstr "Transferir AUC a activo y crear asiento de transferencia"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.actions.act_window,name:account_asset_transfer.action_account_asset_transfer
|
||||
#: model:ir.actions.server,name:account_asset_transfer.action_asset_transfer_from_list
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_transfer_view_form
|
||||
msgid "Transfer Asset"
|
||||
msgstr "Transferencia de activos"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__date_transfer
|
||||
msgid "Transfer Date"
|
||||
msgstr "Fecha de transferencia"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_profile__transfer_journal_id
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer__transfer_journal_id
|
||||
msgid "Transfer Journal"
|
||||
msgstr "Diario de transferencia"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model,name:account_asset_transfer.model_account_asset_transfer_line
|
||||
msgid "Transfer To Asset"
|
||||
msgstr "Transferencia a activos"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_form
|
||||
msgid "Transfer asset from AUC to Asset"
|
||||
msgstr "Transferir activo de AUC a Activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,help:account_asset_transfer.field_account_asset_transfer__date_transfer
|
||||
msgid "Transfer date must be after the asset journal entry"
|
||||
msgstr "La fecha de transferencia debe ser posterior al asiento del activo"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model_terms:ir.ui.view,arch_db:account_asset_transfer.account_asset_view_search
|
||||
msgid "Transferable"
|
||||
msgstr "Transferible"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,field_description:account_asset_transfer.field_account_asset_transfer_line__price_unit
|
||||
msgid "Unit Price"
|
||||
msgstr "Precio Unitario"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: code:addons/account_asset_transfer/wizard/account_asset_transfer.py:0
|
||||
#, python-format
|
||||
msgid "Value of new asset must greater than 0.0"
|
||||
msgstr "El valor del nuevo activo debe ser superior a 0,0"
|
||||
|
||||
#. module: account_asset_transfer
|
||||
#: model:ir.model.fields,help:account_asset_transfer.field_account_asset__is_transfer
|
||||
msgid ""
|
||||
"flag indicating if the asset has been transferred from/to another asset."
|
||||
msgstr "que indica si el activo ha sido transferido de/a otro activo."
|
||||
3
account_asset_transfer/models/__init__.py
Normal file
3
account_asset_transfer/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import account_asset
|
||||
from . import account_asset_profile
|
||||
94
account_asset_transfer/models/account_asset.py
Normal file
94
account_asset_transfer/models/account_asset.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import _, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class AccountAsset(models.Model):
|
||||
_inherit = "account.asset"
|
||||
|
||||
can_transfer = fields.Boolean(
|
||||
compute="_compute_can_transfer",
|
||||
search="_search_can_transfer",
|
||||
help="Allow transfer AUC (running) to Asset",
|
||||
)
|
||||
is_transfer = fields.Boolean(
|
||||
help="flag indicating if the asset has been transferred from/to another asset."
|
||||
)
|
||||
|
||||
def _compute_can_transfer(self):
|
||||
for asset in self:
|
||||
asset.can_transfer = (
|
||||
not asset.method_number
|
||||
and asset.value_residual
|
||||
and asset.state == "open"
|
||||
)
|
||||
|
||||
def _search_can_transfer(self, operator, value):
|
||||
if operator == "=":
|
||||
return [
|
||||
("method_number", "=", 0),
|
||||
("value_residual", ">", 0),
|
||||
("state", "=", "open"),
|
||||
]
|
||||
if operator == "!=":
|
||||
return [
|
||||
"|",
|
||||
"|",
|
||||
"|",
|
||||
("method_number", ">", 0),
|
||||
("value_residual", "=", 0),
|
||||
("state", "!=", "open"),
|
||||
]
|
||||
|
||||
def _check_can_transfer(self):
|
||||
if not all(self.mapped("can_transfer")):
|
||||
raise ValidationError(
|
||||
_("Only running assets without depreciation (AUC) can transfer")
|
||||
)
|
||||
|
||||
def transfer(self):
|
||||
ctx = dict(self.env.context, active_ids=self.ids)
|
||||
self._check_can_transfer()
|
||||
return {
|
||||
"name": _("Transfer AUC to Asset & Create Transfer Journal Entry"),
|
||||
"view_mode": "form",
|
||||
"res_model": "account.asset.transfer",
|
||||
"target": "new",
|
||||
"type": "ir.actions.act_window",
|
||||
"context": ctx,
|
||||
}
|
||||
|
||||
def open_assets(self):
|
||||
self.ensure_one()
|
||||
moves = self.account_move_line_ids.mapped("move_id")
|
||||
assets = self.env["account.asset"]
|
||||
asset_from = self._context.get("asset_from")
|
||||
asset_to = self._context.get("asset_to")
|
||||
for move in moves:
|
||||
# Source Assets, we check from move that create this asset
|
||||
if (
|
||||
asset_from
|
||||
and self.id
|
||||
not in move.line_ids.filtered(lambda l: l.credit).mapped("asset_id").ids
|
||||
):
|
||||
assets = move.line_ids.filtered(lambda l: l.credit).mapped("asset_id")
|
||||
break
|
||||
# Destination Assets, we check from move that create destination asset
|
||||
elif (
|
||||
asset_to
|
||||
and self.id
|
||||
in move.line_ids.filtered(lambda l: l.credit).mapped("asset_id").ids
|
||||
):
|
||||
assets = move.line_ids.filtered(lambda l: l.debit).mapped("asset_id")
|
||||
break
|
||||
return {
|
||||
"name": _("Assets"),
|
||||
"view_mode": "tree,form",
|
||||
"res_model": "account.asset",
|
||||
"view_id": False,
|
||||
"type": "ir.actions.act_window",
|
||||
"context": self._context,
|
||||
"domain": [("id", "in", assets.ids)],
|
||||
}
|
||||
15
account_asset_transfer/models/account_asset_profile.py
Normal file
15
account_asset_transfer/models/account_asset_profile.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountAssetProfile(models.Model):
|
||||
_inherit = "account.asset.profile"
|
||||
|
||||
transfer_journal_id = fields.Many2one(
|
||||
comodel_name="account.journal",
|
||||
domain="[('type', '=', 'general'), ('company_id', '=', company_id)]",
|
||||
string="Transfer Journal",
|
||||
check_company=True,
|
||||
)
|
||||
1
account_asset_transfer/readme/CONFIGURE.rst
Normal file
1
account_asset_transfer/readme/CONFIGURE.rst
Normal file
@@ -0,0 +1 @@
|
||||
On asset profile, user can setup default Transfer Journal, to be used during transfer.
|
||||
5
account_asset_transfer/readme/CONTRIBUTORS.rst
Normal file
5
account_asset_transfer/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
* `Ecosoft <http://ecosoft.co.th>`__:
|
||||
|
||||
* Kitti U. <kittiu@ecosoft.co.th>
|
||||
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
|
||||
* Saran Lim. <saranl@ecosoft.co.th>
|
||||
9
account_asset_transfer/readme/DESCRIPTION.rst
Normal file
9
account_asset_transfer/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,9 @@
|
||||
This module allow transferring assets under construction (AUC) to normal assets.
|
||||
|
||||
AUC is Asset under construction where some assets are in construction phase and
|
||||
cost needs to be captured for the time being. Once asset is fully completed then
|
||||
cost would be transferred to final asset
|
||||
|
||||
**Note:**
|
||||
|
||||
* If the asset don't have journal entries, asset transfer will use account settings from the asset/asset profile instead.
|
||||
10
account_asset_transfer/readme/USAGE.rst
Normal file
10
account_asset_transfer/readme/USAGE.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
Given asset under construction has been created, i.e., by vendor bill.
|
||||
|
||||
- Go to asset menu
|
||||
- Filter "Transferrable" assets and look for desired assets to transfer
|
||||
- Select assets to transfer, and click action "Transfer Asset"
|
||||
- On asset transfer wizard, on the "To New Asset" tab, choose new profile(s)
|
||||
- Click "Transfer" button
|
||||
- Odoo will create journal entry as well as new asset(s)
|
||||
|
||||
**Note:** You can click "Expand Asset" button for expand asset line that selects the asset profile set to be "Create an asset by product item"
|
||||
3
account_asset_transfer/security/ir.model.access.csv
Normal file
3
account_asset_transfer/security/ir.model.access.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_account_asset_transfer_user,account.asset.transfer,model_account_asset_transfer,account.group_account_user,1,1,1,1
|
||||
access_account_asset_transfer_line_user,account.asset.transfer.line,model_account_asset_transfer_line,account.group_account_user,1,1,1,1
|
||||
|
BIN
account_asset_transfer/static/description/icon.png
Normal file
BIN
account_asset_transfer/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
454
account_asset_transfer/static/description/index.html
Normal file
454
account_asset_transfer/static/description/index.html
Normal file
@@ -0,0 +1,454 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
||||
<title>Asset Transfer from AUC to Asset</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="asset-transfer-from-auc-to-asset">
|
||||
<h1 class="title">Asset Transfer from AUC to Asset</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:5fb144c4441c023dcd6f27dcd7be70952e7b51761699c1c4e0a08f50f8bc9c97
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-financial-tools/tree/16.0/account_asset_transfer"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_asset_transfer"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allow transferring assets under construction (AUC) to normal assets.</p>
|
||||
<p>AUC is Asset under construction where some assets are in construction phase and
|
||||
cost needs to be captured for the time being. Once asset is fully completed then
|
||||
cost would be transferred to final asset</p>
|
||||
<p><strong>Note:</strong></p>
|
||||
<ul class="simple">
|
||||
<li>If the asset don’t have journal entries, asset transfer will use account settings from the asset/asset profile instead.</li>
|
||||
</ul>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
||||
<p>On asset profile, user can setup default Transfer Journal, to be used during transfer.</p>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
|
||||
<p>Given asset under construction has been created, i.e., by vendor bill.</p>
|
||||
<ul class="simple">
|
||||
<li>Go to asset menu</li>
|
||||
<li>Filter “Transferrable” assets and look for desired assets to transfer</li>
|
||||
<li>Select assets to transfer, and click action “Transfer Asset”</li>
|
||||
<li>On asset transfer wizard, on the “To New Asset” tab, choose new profile(s)</li>
|
||||
<li>Click “Transfer” button</li>
|
||||
<li>Odoo will create journal entry as well as new asset(s)</li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong> You can click “Expand Asset” button for expand asset line that selects the asset profile set to be “Create an asset by product item”</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_asset_transfer%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Ecosoft</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="http://ecosoft.co.th">Ecosoft</a>:<ul>
|
||||
<li>Kitti U. <<a class="reference external" href="mailto:kittiu@ecosoft.co.th">kittiu@ecosoft.co.th</a>></li>
|
||||
<li>Pimolnat Suntian <<a class="reference external" href="mailto:pimolnats@ecosoft.co.th">pimolnats@ecosoft.co.th</a>></li>
|
||||
<li>Saran Lim. <<a class="reference external" href="mailto:saranl@ecosoft.co.th">saranl@ecosoft.co.th</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>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.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external image-reference" href="https://github.com/kittiu"><img alt="kittiu" src="https://github.com/kittiu.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/16.0/account_asset_transfer">OCA/account-financial-tools</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1
account_asset_transfer/tests/__init__.py
Normal file
1
account_asset_transfer/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_account_asset_transfer
|
||||
142
account_asset_transfer/tests/test_account_asset_transfer.py
Normal file
142
account_asset_transfer/tests/test_account_asset_transfer.py
Normal file
@@ -0,0 +1,142 @@
|
||||
# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
from odoo import fields
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tests import tagged
|
||||
from odoo.tests.common import Form
|
||||
|
||||
from odoo.addons.account_asset_management.tests.test_account_asset_management import (
|
||||
TestAssetManagement,
|
||||
)
|
||||
|
||||
|
||||
@tagged("post_install", "-at_install")
|
||||
class TestAccountAssetTransfer(TestAssetManagement):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
# Profile Under Construction
|
||||
cls.profile_auc = cls.asset_profile_model.create(
|
||||
{
|
||||
"account_expense_depreciation_id": cls.company_data[
|
||||
"default_account_expense"
|
||||
].id,
|
||||
"account_asset_id": cls.company_data["default_account_assets"].id,
|
||||
"account_depreciation_id": cls.company_data[
|
||||
"default_account_assets"
|
||||
].id,
|
||||
"journal_id": cls.company_data["default_journal_purchase"].id,
|
||||
"transfer_journal_id": cls.company_data["default_journal_misc"].id,
|
||||
"asset_product_item": True,
|
||||
"name": "Asset Under Construction",
|
||||
"method_time": "year",
|
||||
"method_number": 0,
|
||||
"method_period": "year",
|
||||
}
|
||||
)
|
||||
|
||||
# Profile normal asset
|
||||
cls.profile_asset = cls.asset_profile_model.create(
|
||||
{
|
||||
"account_expense_depreciation_id": cls.company_data[
|
||||
"default_account_expense"
|
||||
].id,
|
||||
"account_asset_id": cls.company_data["default_account_assets"].id,
|
||||
"account_depreciation_id": cls.company_data[
|
||||
"default_account_assets"
|
||||
].id,
|
||||
"journal_id": cls.company_data["default_journal_purchase"].id,
|
||||
"asset_product_item": True,
|
||||
"name": "Room - 5 Years",
|
||||
"method_time": "year",
|
||||
"method_number": 5,
|
||||
"method_period": "year",
|
||||
}
|
||||
)
|
||||
|
||||
def test_01_asset_transfer_auc_to_asset(self):
|
||||
"""Create AUC and then transfer to normal asset class,
|
||||
I expect a new journal entry will be created"""
|
||||
# Create 3 AUC assets from an invoice
|
||||
move_form = Form(
|
||||
self.env["account.move"].with_context(
|
||||
default_move_type="in_invoice", check_move_validity=False
|
||||
)
|
||||
)
|
||||
move_form.invoice_date = fields.Date.context_today(self.env.user)
|
||||
move_form.partner_id = self.partner
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "Wall"
|
||||
line_form.price_unit = 2000.00
|
||||
line_form.asset_profile_id = self.profile_auc
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "Roof"
|
||||
line_form.price_unit = 10000.00
|
||||
line_form.asset_profile_id = self.profile_auc
|
||||
with move_form.invoice_line_ids.new() as line_form:
|
||||
line_form.name = "Floor"
|
||||
line_form.price_unit = 10000.00
|
||||
line_form.asset_profile_id = self.profile_auc
|
||||
self.invoice_auc = move_form.save()
|
||||
self.invoice_auc.invoice_line_ids.write(
|
||||
{"asset_profile_id": self.profile_auc.id}
|
||||
)
|
||||
self.invoice_auc.action_post()
|
||||
# Create AUC asset without move
|
||||
asset_auc = self.env["account.asset"].create(
|
||||
{
|
||||
"name": "Door",
|
||||
"profile_id": self.profile_auc.id,
|
||||
"purchase_value": 1000,
|
||||
"date_start": fields.Date.context_today(self.env.user),
|
||||
}
|
||||
)
|
||||
# Test can_transfer status
|
||||
assets = self.invoice_auc.invoice_line_ids.mapped("asset_id")
|
||||
assets += asset_auc
|
||||
self.assertFalse(list(set(assets.mapped("can_transfer")))[0])
|
||||
assets.validate()
|
||||
assets.invalidate_model()
|
||||
# can_transfer = True after validate
|
||||
self.assertTrue(list(set(assets.mapped("can_transfer")))[0])
|
||||
self.assertEqual(list(set(assets.mapped("is_transfer"))), [False])
|
||||
# Keep source asset
|
||||
source_assets = assets
|
||||
# Create Asset Transfer
|
||||
transfer_form = Form(
|
||||
self.env["account.asset.transfer"].with_context(active_ids=assets.ids)
|
||||
)
|
||||
transfer_wiz = transfer_form.save()
|
||||
with self.assertRaises(UserError):
|
||||
transfer_wiz.transfer()
|
||||
with transfer_form.to_asset_ids.new() as to_asset:
|
||||
to_asset.asset_name = "Asset 1"
|
||||
to_asset.asset_profile_id = self.profile_asset
|
||||
to_asset.quantity = 6
|
||||
to_asset.price_unit = 500
|
||||
with transfer_form.to_asset_ids.new() as to_asset:
|
||||
to_asset.asset_name = "Asset 2"
|
||||
to_asset.asset_profile_id = self.profile_asset
|
||||
to_asset.quantity = 1
|
||||
to_asset.price_unit = 20000
|
||||
transfer_form.save()
|
||||
# Test expand asset lines from quantity line
|
||||
self.assertEqual(len(transfer_wiz.to_asset_ids), 2)
|
||||
transfer_wiz.expand_to_asset_ids()
|
||||
self.assertEqual(len(transfer_wiz.to_asset_ids), 7)
|
||||
res = transfer_wiz.transfer()
|
||||
transfer_move = self.env["account.move"].browse(res["domain"][0][2])
|
||||
assets = transfer_move.invoice_line_ids.mapped("asset_id")
|
||||
# 2 new assets created, and value equal to original assets
|
||||
new_assets = assets.filtered(lambda l: l.state == "draft")
|
||||
self.assertEqual(sum(new_assets.mapped("purchase_value")), 23000)
|
||||
# All asset transfer will change to is_transfer
|
||||
self.assertEqual(list(set(assets.mapped("is_transfer"))), [True])
|
||||
# Check source asset from new asset
|
||||
result = new_assets[0].with_context(asset_from=1).open_assets()
|
||||
self.assertEqual(sorted(result["domain"][0][2]), source_assets.ids)
|
||||
# Check dest asset from source asset
|
||||
result = source_assets[0].with_context(asset_to=1).open_assets()
|
||||
self.assertEqual(result["domain"][0][2], new_assets.ids)
|
||||
79
account_asset_transfer/views/account_asset.xml
Normal file
79
account_asset_transfer/views/account_asset.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<odoo>
|
||||
|
||||
<record id="account_asset_view_form" model="ir.ui.view">
|
||||
<field name="name">account.asset.form</field>
|
||||
<field name="model">account.asset</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_asset_management.account_asset_view_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="remove" position="after">
|
||||
<field name="can_transfer" invisible="1" />
|
||||
<field name="is_transfer" invisible="1" />
|
||||
<button
|
||||
name="transfer"
|
||||
string="Transfer"
|
||||
type="object"
|
||||
groups="account.group_account_manager"
|
||||
attrs="{'invisible': [('can_transfer', '=', False)]}"
|
||||
help="Transfer asset from AUC to Asset"
|
||||
/>
|
||||
</button>
|
||||
<xpath expr="//header[last()]" position="after">
|
||||
<div
|
||||
class="alert alert-warning"
|
||||
role="alert"
|
||||
style="margin-bottom:0px;"
|
||||
attrs="{'invisible': ['|', ('can_transfer', '=', False), ('account_move_line_ids', '!=', [])]}"
|
||||
>
|
||||
There are no journal entries on current asset(s), asset transfer will use account settings from the asset/asset profile instead.
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//div[@name='button_box']/button[@name='open_entries']"
|
||||
position="before"
|
||||
>
|
||||
<button
|
||||
name="open_assets"
|
||||
string="Asset From"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
context="{'asset_from': 1}"
|
||||
attrs="{'invisible': [('is_transfer', '=', False)]}"
|
||||
icon="fa-bars"
|
||||
/>
|
||||
<button
|
||||
name="open_assets"
|
||||
string="Asset To"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
context="{'asset_to': 1}"
|
||||
attrs="{'invisible': [('is_transfer', '=', False)]}"
|
||||
icon="fa-bars"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_asset_view_search" model="ir.ui.view">
|
||||
<field name="name">account.asset.search</field>
|
||||
<field name="model">account.asset</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_asset_management.account_asset_view_search"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//separator[last()]" position="before">
|
||||
<separator name="transfer" />
|
||||
<filter
|
||||
string="Transferable"
|
||||
name="can_transfer"
|
||||
domain="[('can_transfer', '=', True)]"
|
||||
help="Can be transferred"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
16
account_asset_transfer/views/account_asset_profile.xml
Normal file
16
account_asset_transfer/views/account_asset_profile.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<odoo>
|
||||
<record id="account_asset_profile_view_form" model="ir.ui.view">
|
||||
<field name="name">account.asset.profile.form</field>
|
||||
<field name="model">account.asset.profile</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_asset_management.account_asset_profile_view_form"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="after">
|
||||
<separator />
|
||||
<field name="transfer_journal_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
1
account_asset_transfer/wizard/__init__.py
Normal file
1
account_asset_transfer/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import account_asset_transfer
|
||||
253
account_asset_transfer/wizard/account_asset_transfer.py
Normal file
253
account_asset_transfer/wizard/account_asset_transfer.py
Normal file
@@ -0,0 +1,253 @@
|
||||
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import Command, _, api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_compare
|
||||
|
||||
|
||||
class AccountAssetTransfer(models.TransientModel):
|
||||
_name = "account.asset.transfer"
|
||||
_inherit = "analytic.mixin"
|
||||
_description = "Transfer Asset"
|
||||
_check_company_auto = True
|
||||
|
||||
company_id = fields.Many2one(
|
||||
comodel_name="res.company",
|
||||
string="Company",
|
||||
readonly=True,
|
||||
required=True,
|
||||
)
|
||||
currency_id = fields.Many2one(
|
||||
comodel_name="res.currency",
|
||||
related="company_id.currency_id",
|
||||
)
|
||||
transfer_journal_id = fields.Many2one(
|
||||
comodel_name="account.journal",
|
||||
domain="[('type', '=', 'general'), ('company_id', '=', company_id)]",
|
||||
string="Transfer Journal",
|
||||
required=True,
|
||||
check_company=True,
|
||||
)
|
||||
date_transfer = fields.Date(
|
||||
string="Transfer Date",
|
||||
required=True,
|
||||
default=fields.Date.today,
|
||||
help="Transfer date must be after the asset journal entry",
|
||||
)
|
||||
note = fields.Text("Notes")
|
||||
from_asset_ids = fields.Many2many(
|
||||
comodel_name="account.asset",
|
||||
string="From Asset(s)",
|
||||
readonly=True,
|
||||
)
|
||||
to_asset_ids = fields.One2many(
|
||||
comodel_name="account.asset.transfer.line",
|
||||
inverse_name="transfer_id",
|
||||
string="To Asset(s)",
|
||||
)
|
||||
from_asset_value = fields.Monetary(
|
||||
string="From Value",
|
||||
compute="_compute_asset_value",
|
||||
)
|
||||
to_asset_value = fields.Monetary(
|
||||
string="To Value",
|
||||
compute="_compute_asset_value",
|
||||
)
|
||||
balance = fields.Monetary(
|
||||
compute="_compute_asset_value",
|
||||
)
|
||||
partner_id = fields.Many2one(
|
||||
comodel_name="res.partner",
|
||||
string="Partner",
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, field_list):
|
||||
res = super().default_get(field_list)
|
||||
from_asset_ids = self.env.context.get("active_ids")
|
||||
assets = self.env["account.asset"].browse(from_asset_ids)
|
||||
# Prepare default values
|
||||
company = assets.mapped("company_id")
|
||||
company.ensure_one()
|
||||
journals = assets.mapped("profile_id.transfer_journal_id")
|
||||
partners = assets.mapped("partner_id")
|
||||
analytics = assets.mapped("analytic_distribution")
|
||||
# Combine analytic to dict
|
||||
analytic_dict = {}
|
||||
unique_elements = set()
|
||||
for analytic in analytics:
|
||||
if analytic is not False:
|
||||
for key, value in analytic.items():
|
||||
if key not in analytic_dict and key not in unique_elements:
|
||||
analytic_dict[key] = value
|
||||
unique_elements.add(key)
|
||||
# Assign values
|
||||
res["company_id"] = company.id
|
||||
res["partner_id"] = partners[0].id if len(partners) == 1 else False
|
||||
res["from_asset_ids"] = [(4, asset_id) for asset_id in assets.ids]
|
||||
res["transfer_journal_id"] = journals[:1].id
|
||||
res["analytic_distribution"] = analytic_dict
|
||||
return res
|
||||
|
||||
@api.depends("from_asset_ids", "to_asset_ids")
|
||||
def _compute_asset_value(self):
|
||||
for rec in self:
|
||||
rec.from_asset_value = sum(rec.from_asset_ids.mapped("purchase_value"))
|
||||
rec.to_asset_value = sum(rec.to_asset_ids.mapped("asset_value"))
|
||||
balance = rec.from_asset_value - rec.to_asset_value
|
||||
rec.balance = balance if balance > 0 else 0
|
||||
|
||||
def _check_amount_transfer(self):
|
||||
self.ensure_one()
|
||||
if float_compare(self.from_asset_value, self.to_asset_value, 2) != 0:
|
||||
raise UserError(_("Total values of new assets must equal to source assets"))
|
||||
if self.to_asset_ids.filtered(lambda l: l.asset_value <= 0):
|
||||
raise UserError(_("Value of new asset must greater than 0.0"))
|
||||
|
||||
def _get_new_move_transfer(self):
|
||||
return {
|
||||
"date": self.date_transfer,
|
||||
"journal_id": self.transfer_journal_id.id,
|
||||
"narration": self.note,
|
||||
}
|
||||
|
||||
def transfer(self):
|
||||
self.ensure_one()
|
||||
self.from_asset_ids._check_can_transfer()
|
||||
self._check_amount_transfer()
|
||||
# Create transfer journal entry
|
||||
move_vals = self._get_new_move_transfer()
|
||||
move = self.env["account.move"].create(move_vals)
|
||||
move_lines = self._get_transfer_data()
|
||||
move.with_context(allow_asset=True).write({"line_ids": move_lines})
|
||||
# Post move and create new assets
|
||||
move.action_post()
|
||||
# Set source assets as removed
|
||||
self.from_asset_ids.write(
|
||||
{"state": "removed", "date_remove": self.date_transfer}
|
||||
)
|
||||
# Set all assets is transfer document
|
||||
move.line_ids.mapped("asset_id").write({"is_transfer": True})
|
||||
return {
|
||||
"name": _("Asset Transfer Journal Entry"),
|
||||
"view_mode": "tree,form",
|
||||
"res_model": "account.move",
|
||||
"view_id": False,
|
||||
"type": "ir.actions.act_window",
|
||||
"context": self.env.context,
|
||||
"domain": [("id", "=", move.id)],
|
||||
}
|
||||
|
||||
def _get_move_line_from_asset(self, asset):
|
||||
# Case asset created with account move
|
||||
if asset.account_move_line_ids:
|
||||
asset.account_move_line_ids.ensure_one()
|
||||
move_line = asset.account_move_line_ids[0]
|
||||
return {
|
||||
"name": move_line.name,
|
||||
"account_id": move_line.account_id.id,
|
||||
"analytic_distribution": move_line.analytic_distribution or {},
|
||||
"debit": move_line.credit,
|
||||
"credit": move_line.debit,
|
||||
"partner_id": move_line.partner_id.id,
|
||||
"asset_id": move_line.asset_id.id, # Link to existing asset
|
||||
}
|
||||
# Case asset created without account moves
|
||||
else:
|
||||
return {
|
||||
"name": asset.name,
|
||||
"account_id": asset.profile_id.account_asset_id.id,
|
||||
"analytic_distribution": asset.analytic_distribution or {},
|
||||
"debit": 0.0,
|
||||
"credit": asset.purchase_value or 0.0,
|
||||
"partner_id": asset.partner_id.id,
|
||||
"asset_id": asset.id, # Link to existing asset
|
||||
}
|
||||
|
||||
def _get_move_line_to_asset(self, to_asset):
|
||||
return {
|
||||
"name": to_asset.asset_name,
|
||||
"account_id": to_asset.asset_profile_id.account_asset_id.id,
|
||||
"analytic_distribution": to_asset.analytic_distribution or {},
|
||||
"debit": to_asset.asset_value,
|
||||
"credit": 0.0,
|
||||
"partner_id": to_asset.partner_id.id,
|
||||
"asset_profile_id": to_asset.asset_profile_id.id, # To create new asset
|
||||
"price_subtotal": to_asset.asset_value,
|
||||
}
|
||||
|
||||
def _get_transfer_data(self):
|
||||
# Create lines from assets
|
||||
move_lines = [
|
||||
Command.create(self._get_move_line_from_asset(from_asset))
|
||||
for from_asset in self.from_asset_ids
|
||||
]
|
||||
# Create lines for new assets
|
||||
move_lines += [
|
||||
Command.create(self._get_move_line_to_asset(to_asset))
|
||||
for to_asset in self.to_asset_ids
|
||||
]
|
||||
return move_lines
|
||||
|
||||
def expand_to_asset_ids(self):
|
||||
self.ensure_one()
|
||||
lines = self.to_asset_ids.filtered(lambda l: l.asset_profile_id and l.quantity)
|
||||
for line in lines:
|
||||
line._expand_asset_line()
|
||||
action = self.env.ref("account_asset_transfer.action_account_asset_transfer")
|
||||
result = action.sudo().read()[0]
|
||||
result.update({"res_id": self.id})
|
||||
return result
|
||||
|
||||
|
||||
class AccountAssetTransferLine(models.TransientModel):
|
||||
_name = "account.asset.transfer.line"
|
||||
_inherit = "analytic.mixin"
|
||||
_description = "Transfer To Asset"
|
||||
|
||||
transfer_id = fields.Many2one(
|
||||
comodel_name="account.asset.transfer",
|
||||
index=True,
|
||||
)
|
||||
asset_profile_id = fields.Many2one(
|
||||
comodel_name="account.asset.profile",
|
||||
string="Asset Profile",
|
||||
required=True,
|
||||
)
|
||||
asset_name = fields.Char(required=True)
|
||||
quantity = fields.Float(
|
||||
required=True,
|
||||
default=0.0,
|
||||
)
|
||||
price_unit = fields.Float(
|
||||
string="Unit Price",
|
||||
required=True,
|
||||
default=0.0,
|
||||
)
|
||||
asset_value = fields.Float(
|
||||
compute="_compute_asset_value",
|
||||
default=0.0,
|
||||
store=True,
|
||||
required=True,
|
||||
)
|
||||
partner_id = fields.Many2one(
|
||||
comodel_name="res.partner",
|
||||
string="Partner",
|
||||
)
|
||||
|
||||
@api.depends("quantity", "price_unit")
|
||||
def _compute_asset_value(self):
|
||||
for rec in self:
|
||||
rec.asset_value = rec.quantity * rec.price_unit
|
||||
|
||||
def _expand_asset_line(self):
|
||||
self.ensure_one()
|
||||
profile = self.asset_profile_id
|
||||
if profile and self.quantity > 1.0 and profile.asset_product_item:
|
||||
line = self
|
||||
qty = self.quantity
|
||||
name = self.asset_name
|
||||
self.update({"quantity": 1, "asset_name": "{} {}".format(name, 1)})
|
||||
for i in range(1, int(qty)):
|
||||
line.copy({"asset_name": "{} {}".format(name, i + 1)})
|
||||
99
account_asset_transfer/wizard/account_asset_transfer.xml
Normal file
99
account_asset_transfer/wizard/account_asset_transfer.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<odoo>
|
||||
|
||||
<record id="account_asset_transfer_view_form" model="ir.ui.view">
|
||||
<field name="name">account.asset.transfer.form</field>
|
||||
<field name="model">account.asset.transfer</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Transfer Asset">
|
||||
<group>
|
||||
<group>
|
||||
<field name="date_transfer" />
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
<field name="company_id" invisible="1" />
|
||||
<field name="currency_id" invisible="1" />
|
||||
<field name="from_asset_value" />
|
||||
<field name="to_asset_value" />
|
||||
<field name="balance" invisible="1" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="transfer_journal_id" />
|
||||
<field name="partner_id" invisible="1" />
|
||||
<field name="analytic_distribution" invisible="1" />
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page name="to_asset" string="To New Asset">
|
||||
<div class="oe_right" name="buttons">
|
||||
<button
|
||||
name="expand_to_asset_ids"
|
||||
type="object"
|
||||
string="Expand Asset"
|
||||
icon="fa-bars"
|
||||
/>
|
||||
</div>
|
||||
<field
|
||||
name="to_asset_ids"
|
||||
context="{
|
||||
'default_asset_value': balance,
|
||||
'default_partner_id': partner_id,
|
||||
'default_analytic_distribution': analytic_distribution,
|
||||
}"
|
||||
>
|
||||
<tree editable="bottom">
|
||||
<field name="asset_profile_id" />
|
||||
<field name="asset_name" />
|
||||
<field name="price_unit" />
|
||||
<field name="quantity" />
|
||||
<field name="asset_value" />
|
||||
<field name="partner_id" />
|
||||
<field
|
||||
name="analytic_distribution"
|
||||
groups="analytic.group_analytic_accounting"
|
||||
/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page name="from_asset" string="From">
|
||||
<field name="from_asset_ids" force_save="1" />
|
||||
</page>
|
||||
</notebook>
|
||||
<separator string="Notes" colspan="4" />
|
||||
<field name="note" nolabel="1" colspan="4" />
|
||||
<separator colspan="4" />
|
||||
<footer>
|
||||
<button
|
||||
string="Transfer"
|
||||
name="transfer"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_asset_transfer" model="ir.actions.act_window">
|
||||
<field name="name">Transfer Asset</field>
|
||||
<field name="res_model">account.asset.transfer</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="action_asset_transfer_from_list" model="ir.actions.server">
|
||||
<field name="name">Transfer Asset</field>
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_manager'))]" />
|
||||
<field name="model_id" ref="account_asset_management.model_account_asset" />
|
||||
<field
|
||||
name="binding_model_id"
|
||||
ref="account_asset_management.model_account_asset"
|
||||
/>
|
||||
<field name="binding_view_types">list</field>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
if records:
|
||||
action = records.transfer()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
1
setup/account_asset_transfer/odoo/addons/account_asset_transfer
Symbolic link
1
setup/account_asset_transfer/odoo/addons/account_asset_transfer
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../account_asset_transfer
|
||||
6
setup/account_asset_transfer/setup.py
Normal file
6
setup/account_asset_transfer/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user