diff --git a/account_asset_number/README.rst b/account_asset_number/README.rst new file mode 100644 index 00000000000..bf0bd6c9bb2 --- /dev/null +++ b/account_asset_number/README.rst @@ -0,0 +1,90 @@ +============= +Assets Number +============= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:60647111a7d6cee9fb79991a4bf6ca0f1949628d1cc44c7735df9ac246278bec + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/17.0/account_asset_number + :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-17-0/account-financial-tools-17-0-account_asset_number + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a asset number for the asset's reference. + +**Notes:** + +If you check "Auto Asset Number by Sequence", you will not be able to +edit the asset number using that asset profile. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +You can set the default asset number by going to *Invoicing > +Configuration > Asset Profile*, and check *Auto Asset Number by +Sequence* then select *Asset Number Sequence*. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Ecosoft + +Contributors +------------ + +- `Ecosoft `__: + + - Pimolnat Suntian + +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. + +This module is part of the `OCA/account-financial-tools `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_asset_number/__init__.py b/account_asset_number/__init__.py new file mode 100644 index 00000000000..37e105d036d --- /dev/null +++ b/account_asset_number/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import report diff --git a/account_asset_number/__manifest__.py b/account_asset_number/__manifest__.py new file mode 100644 index 00000000000..7700d130256 --- /dev/null +++ b/account_asset_number/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Assets Number", + "version": "17.0.1.1.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": [ + "views/account_asset_profile_views.xml", + "views/account_asset_views.xml", + "report/account_asset_number_report.xml", + ], +} diff --git a/account_asset_number/i18n/account_asset_number.pot b/account_asset_number/i18n/account_asset_number.pot new file mode 100644 index 00000000000..5d97d5ce3ff --- /dev/null +++ b/account_asset_number/i18n/account_asset_number.pot @@ -0,0 +1,119 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_asset_number +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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_number +#: model:ir.actions.report,print_report_name:account_asset_number.report_account_asset_number +msgid "'Asset Number - %s' % (object.name)" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "No number available" +msgstr "" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset +msgid "Asset" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__number +msgid "Asset Number" +msgstr "" + +#. module: account_asset_number +#: model:ir.actions.report,name:account_asset_number.report_account_asset_number +msgid "Asset Number (PDF)" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__sequence_id +msgid "Asset Number Sequence" +msgstr "" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset_profile +msgid "Asset profile" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__use_sequence +msgid "Auto Asset Number by Sequence" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__barcode +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "Barcode" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_height +msgid "Barcode Height" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_type +msgid "Barcode Type" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_width +msgid "Barcode Width" +msgstr "" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_report_account_asset_management_asset_report_xls +msgid "Dynamic XLS asset report generator" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_height +msgid "Height (in px) of the barcode or the QR code" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__use_sequence +msgid "If check, asset number auto run by sequence." +msgstr "" + +#. module: account_asset_number +#. odoo-python +#: code:addons/account_asset_number/report/account_asset_report_xls.py:0 +#, python-format +msgid "Number" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__qr +msgid "QR" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.account_asset_profile_view_form +msgid "QR/Barcode Configuration" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "QRcode" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_width +msgid "Width (in px) of the barcode or the QR code" +msgstr "" diff --git a/account_asset_number/i18n/es.po b/account_asset_number/i18n/es.po new file mode 100644 index 00000000000..75acb9e5f4b --- /dev/null +++ b/account_asset_number/i18n/es.po @@ -0,0 +1,124 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_asset_number +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-08-07 12:10+0000\n" +"Last-Translator: Ivorra78 \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_number +#: model:ir.actions.report,print_report_name:account_asset_number.report_account_asset_number +msgid "'Asset Number - %s' % (object.name)" +msgstr "'Número de activo - %s' % (object.name)" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "No number available" +msgstr "Ningún número disponible" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset +msgid "Asset" +msgstr "Activo" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__number +msgid "Asset Number" +msgstr "Número de activo" + +#. module: account_asset_number +#: model:ir.actions.report,name:account_asset_number.report_account_asset_number +msgid "Asset Number (PDF)" +msgstr "Número de activo (PDF)" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__sequence_id +msgid "Asset Number Sequence" +msgstr "Secuencia del número de activo" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset_profile +msgid "Asset profile" +msgstr "Perfil del activo" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__use_sequence +msgid "Auto Asset Number by Sequence" +msgstr "Número de activo automático por secuencia" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__barcode +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "Barcode" +msgstr "Código de Barras" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_height +msgid "Barcode Height" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_type +msgid "Barcode Type" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_width +msgid "Barcode Width" +msgstr "" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_report_account_asset_management_asset_report_xls +msgid "Dynamic XLS asset report generator" +msgstr "Generador dinámico de informes de activos en XLS" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_height +msgid "Height (in px) of the barcode or the QR code" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__use_sequence +msgid "If check, asset number auto run by sequence." +msgstr "" +"Si está marcada, el número de activo se ejecuta automáticamente por " +"secuencia." + +#. module: account_asset_number +#. odoo-python +#: code:addons/account_asset_number/report/account_asset_report_xls.py:0 +#, python-format +msgid "Number" +msgstr "Número" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__qr +msgid "QR" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.account_asset_profile_view_form +msgid "QR/Barcode Configuration" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "QRcode" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_width +msgid "Width (in px) of the barcode or the QR code" +msgstr "" diff --git a/account_asset_number/i18n/hr.po b/account_asset_number/i18n/hr.po new file mode 100644 index 00000000000..1a7a71a0abb --- /dev/null +++ b/account_asset_number/i18n/hr.po @@ -0,0 +1,129 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_asset_number +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-08-22 21:07+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_asset_number +#: model:ir.actions.report,print_report_name:account_asset_number.report_account_asset_number +msgid "'Asset Number - %s' % (object.name)" +msgstr "'Broj sredstva - %s' % (object.name)" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "No number available" +msgstr "Nema raspoloživih brojeva" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset +msgid "Asset" +msgstr "Sredstvo" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__number +msgid "Asset Number" +msgstr "Broj sredstva" + +#. module: account_asset_number +#: model:ir.actions.report,name:account_asset_number.report_account_asset_number +msgid "Asset Number (PDF)" +msgstr "Broj sredstva (PDF)" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__sequence_id +msgid "Asset Number Sequence" +msgstr "Brojevni krug sredstava" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset_profile +msgid "Asset profile" +msgstr "Profil sredstva" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__use_sequence +msgid "Auto Asset Number by Sequence" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__barcode +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "Barcode" +msgstr "Barkod" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_height +msgid "Barcode Height" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_type +msgid "Barcode Type" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_width +msgid "Barcode Width" +msgstr "" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_report_account_asset_management_asset_report_xls +msgid "Dynamic XLS asset report generator" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_height +msgid "Height (in px) of the barcode or the QR code" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__use_sequence +msgid "If check, asset number auto run by sequence." +msgstr "" + +#. module: account_asset_number +#. odoo-python +#: code:addons/account_asset_number/report/account_asset_report_xls.py:0 +#, python-format +msgid "Number" +msgstr "Broj" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__qr +msgid "QR" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.account_asset_profile_view_form +msgid "QR/Barcode Configuration" +msgstr "" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "QRcode" +msgstr "" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_width +msgid "Width (in px) of the barcode or the QR code" +msgstr "" + +#~ msgid "Display Name" +#~ msgstr "Prikazani naziv" + +#~ msgid "ID" +#~ msgstr "ID" diff --git a/account_asset_number/i18n/it.po b/account_asset_number/i18n/it.po new file mode 100644 index 00000000000..2ac486ee85c --- /dev/null +++ b/account_asset_number/i18n/it.po @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_asset_number +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-26 09:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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 5.6.2\n" + +#. module: account_asset_number +#: model:ir.actions.report,print_report_name:account_asset_number.report_account_asset_number +msgid "'Asset Number - %s' % (object.name)" +msgstr "'Numero cespite - %s' % (object.name)" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "No number available" +msgstr "Nessun numero disponibile" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset +msgid "Asset" +msgstr "Cespite" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__number +msgid "Asset Number" +msgstr "Numero cespite" + +#. module: account_asset_number +#: model:ir.actions.report,name:account_asset_number.report_account_asset_number +msgid "Asset Number (PDF)" +msgstr "Numero cespite (PDF)" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__sequence_id +msgid "Asset Number Sequence" +msgstr "Sequenza numero cespite" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_account_asset_profile +msgid "Asset profile" +msgstr "Profilo cespite" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__use_sequence +msgid "Auto Asset Number by Sequence" +msgstr "Numero cespite automatico per sequenza" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__barcode +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "Barcode" +msgstr "Codice a barre" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_height +msgid "Barcode Height" +msgstr "Altezza codice a barre" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_type +msgid "Barcode Type" +msgstr "Tipo codice a barre" + +#. module: account_asset_number +#: model:ir.model.fields,field_description:account_asset_number.field_account_asset_profile__barcode_width +msgid "Barcode Width" +msgstr "Larghezza codice a barre" + +#. module: account_asset_number +#: model:ir.model,name:account_asset_number.model_report_account_asset_management_asset_report_xls +msgid "Dynamic XLS asset report generator" +msgstr "Generatore resoconto XLS cespite dinamico" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_height +msgid "Height (in px) of the barcode or the QR code" +msgstr "Altezza (in px) del codice a barre o del codice QR" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset__use_sequence +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__use_sequence +msgid "If check, asset number auto run by sequence." +msgstr "Se selezionata, il numero automatico del cespite va per sequenza." + +#. module: account_asset_number +#. odoo-python +#: code:addons/account_asset_number/report/account_asset_report_xls.py:0 +#, python-format +msgid "Number" +msgstr "Numero" + +#. module: account_asset_number +#: model:ir.model.fields.selection,name:account_asset_number.selection__account_asset_profile__barcode_type__qr +msgid "QR" +msgstr "QR" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.account_asset_profile_view_form +msgid "QR/Barcode Configuration" +msgstr "Configurazione QR/codice a barre" + +#. module: account_asset_number +#: model_terms:ir.ui.view,arch_db:account_asset_number.report_simple_asset_number +msgid "QRcode" +msgstr "Codice QR" + +#. module: account_asset_number +#: model:ir.model.fields,help:account_asset_number.field_account_asset_profile__barcode_width +msgid "Width (in px) of the barcode or the QR code" +msgstr "Larghezza (in px) del codice a barre o del codice QR" diff --git a/account_asset_number/models/__init__.py b/account_asset_number/models/__init__.py new file mode 100644 index 00000000000..b2b73f37fb7 --- /dev/null +++ b/account_asset_number/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_asset_profile +from . import account_asset diff --git a/account_asset_number/models/account_asset.py b/account_asset_number/models/account_asset.py new file mode 100644 index 00000000000..e80cfacdf36 --- /dev/null +++ b/account_asset_number/models/account_asset.py @@ -0,0 +1,47 @@ +# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountAsset(models.Model): + _inherit = "account.asset" + _rec_name = "number" + + number = fields.Char( + string="Asset Number", + default="", + index=True, + copy=False, + ) + use_sequence = fields.Boolean(related="profile_id.use_sequence") + + def validate(self): + res = super().validate() + for asset in self: + asset_profile = asset.profile_id + if ( + asset.number in [False, ""] + and asset_profile.use_sequence + and asset_profile.sequence_id + ): + asset.number = asset_profile.sequence_id.next_by_id() + return res + + @api.model + def _xls_acquisition_fields(self): + acquisition_fields = super()._xls_acquisition_fields() + acquisition_fields.insert(acquisition_fields.index("name"), "number") + return acquisition_fields + + @api.model + def _xls_active_fields(self): + active_fields = super()._xls_active_fields() + active_fields.insert(active_fields.index("name"), "number") + return active_fields + + @api.model + def _xls_removal_fields(self): + removal_fields = super()._xls_removal_fields() + removal_fields.insert(removal_fields.index("name"), "number") + return removal_fields diff --git a/account_asset_number/models/account_asset_profile.py b/account_asset_number/models/account_asset_profile.py new file mode 100644 index 00000000000..8a7630666d1 --- /dev/null +++ b/account_asset_number/models/account_asset_profile.py @@ -0,0 +1,43 @@ +# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class AccountAssetProfile(models.Model): + _inherit = "account.asset.profile" + + use_sequence = fields.Boolean( + string="Auto Asset Number by Sequence", + help="If check, asset number auto run by sequence.", + ) + sequence_id = fields.Many2one( + comodel_name="ir.sequence", + string="Asset Number Sequence", + domain=lambda self: self._get_domain_sequence_id(), + ) + barcode_type = fields.Selection( + selection=[("barcode", "Barcode"), ("qr", "QR")], + default="barcode", + ) + barcode_width = fields.Integer( + default=350, + help="Width (in px) of the barcode or the QR code", + ) + barcode_height = fields.Integer( + default=75, + help="Height (in px) of the barcode or the QR code", + ) + + @api.model + def _get_domain_sequence_id(self): + return [("company_id", "in", [False, self.env.company.id])] + + @api.onchange("barcode_type") + def _onchange_barcode_type(self): + # Set default values when type is changed + if self.barcode_type == "barcode": + self.barcode_width = 300 + self.barcode_height = 75 + elif self.barcode_type == "qr": + self.barcode_width = 150 diff --git a/account_asset_number/pyproject.toml b/account_asset_number/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/account_asset_number/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_asset_number/readme/CONFIGURE.md b/account_asset_number/readme/CONFIGURE.md new file mode 100644 index 00000000000..4d2979b0566 --- /dev/null +++ b/account_asset_number/readme/CONFIGURE.md @@ -0,0 +1,3 @@ +You can set the default asset number by going to *Invoicing \> +Configuration \> Asset Profile*, and check *Auto Asset Number by +Sequence* then select *Asset Number Sequence*. diff --git a/account_asset_number/readme/CONTRIBUTORS.md b/account_asset_number/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..5d2a6d08549 --- /dev/null +++ b/account_asset_number/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Ecosoft](http://ecosoft.co.th): + - Pimolnat Suntian \<\> diff --git a/account_asset_number/readme/DESCRIPTION.md b/account_asset_number/readme/DESCRIPTION.md new file mode 100644 index 00000000000..62e876200d4 --- /dev/null +++ b/account_asset_number/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module adds a asset number for the asset's reference. + +**Notes:** + +If you check "Auto Asset Number by Sequence", you will not be able to +edit the asset number using that asset profile. diff --git a/account_asset_number/report/__init__.py b/account_asset_number/report/__init__.py new file mode 100644 index 00000000000..6203df4f136 --- /dev/null +++ b/account_asset_number/report/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_asset_report_xls diff --git a/account_asset_number/report/account_asset_number_report.xml b/account_asset_number/report/account_asset_number_report.xml new file mode 100644 index 00000000000..8d177e8f9ec --- /dev/null +++ b/account_asset_number/report/account_asset_number_report.xml @@ -0,0 +1,75 @@ + + + + + + + Asset Number (PDF) + account.asset + qweb-pdf + account_asset_number.report_asset_number + account_asset_number.report_asset_number + 'Asset Number - %s' % (object.name) + + report + + diff --git a/account_asset_number/report/account_asset_report_xls.py b/account_asset_number/report/account_asset_report_xls.py new file mode 100644 index 00000000000..98a0584c580 --- /dev/null +++ b/account_asset_number/report/account_asset_report_xls.py @@ -0,0 +1,24 @@ +# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, models + + +class AssetReportXlsx(models.AbstractModel): + _inherit = "report.account_asset_management.asset_report_xls" + + def _get_asset_template(self): + res = super()._get_asset_template() + res.update( + { + "number": { + "header": {"type": "string", "value": _("Number")}, + "asset": { + "type": "string", + "value": self._render("asset.number or ''"), + }, + "width": 20, + } + } + ) + return res diff --git a/account_asset_number/static/description/icon.png b/account_asset_number/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/account_asset_number/static/description/icon.png differ diff --git a/account_asset_number/static/description/index.html b/account_asset_number/static/description/index.html new file mode 100644 index 00000000000..862b659ff8d --- /dev/null +++ b/account_asset_number/static/description/index.html @@ -0,0 +1,436 @@ + + + + + +Assets Number + + + +
+

Assets Number

+ + +

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runboat

+

This module adds a asset number for the asset’s reference.

+

Notes:

+

If you check “Auto Asset Number by Sequence”, you will not be able to +edit the asset number using that asset profile.

+

Table of contents

+ +
+

Configuration

+

You can set the default asset number by going to Invoicing > +Configuration > Asset Profile, and check Auto Asset Number by +Sequence then select Asset Number Sequence.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Ecosoft
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

This module is part of the OCA/account-financial-tools project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_asset_number/tests/__init__.py b/account_asset_number/tests/__init__.py new file mode 100644 index 00000000000..4dc6323568d --- /dev/null +++ b/account_asset_number/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_asset_number diff --git a/account_asset_number/tests/test_account_asset_number.py b/account_asset_number/tests/test_account_asset_number.py new file mode 100644 index 00000000000..34fa3cc77e8 --- /dev/null +++ b/account_asset_number/tests/test_account_asset_number.py @@ -0,0 +1,141 @@ +# Copyright 2022 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import time + +from odoo.tests import tagged + +from odoo.addons.account_asset_management.tests.test_account_asset_management import ( + TestAssetManagement, +) + + +@tagged("post_install", "-at_install") +class TestAssetNumber(TestAssetManagement): + @classmethod + def setUpClass(cls): + """Setup.""" + super().setUpClass() + cls.sequence_asset = cls.env["ir.sequence"].create( + { + "name": "Asset Number Test", + "code": "account.asset.sequence", + "implementation": "standard", + "prefix": "AC", + "padding": 5, + } + ) + + def test_01_asset_number(self): + """Test asset creation with a sequence.""" + + self.car5y.write( + { + "use_sequence": True, + "sequence_id": self.sequence_asset.id, + } + ) + asset = self.asset_model.create( + { + "name": "test asset", + "profile_id": self.car5y.id, + "purchase_value": 1000, + "salvage_value": 0, + "date_start": time.strftime("%Y-07-07"), + "method_time": "year", + "method": "degr-linear", + "method_progress_factor": 0.40, + "method_number": 5, + "method_period": "year", + "prorata": False, + } + ) + asset.compute_depreciation_board() + asset.invalidate_recordset() + # check number in the asset + self.assertFalse(asset.number) + asset.validate() + self.assertTrue(asset.number) + self.assertEqual(asset.number[:2], "AC") + + def test_02_asset_number_without_sequence(self): + """Test asset creation without a sequence.""" + self.car5y.write( + { + "use_sequence": False, + "sequence_id": self.sequence_asset.id, + } + ) + + asset = self.asset_model.create( + { + "name": "test asset without sequence", + "profile_id": self.car5y.id, + "purchase_value": 1500, + "salvage_value": 100, + "date_start": time.strftime("%Y-08-01"), + "method_time": "year", + "method": "degr-linear", + "method_number": 5, + "method_period": "year", + "prorata": False, + } + ) + + asset.validate() + + self.assertFalse( + asset.number, + "The asset number should not be generated when sequence is disabled.", + ) + + def test_03_xls_fields(self): + """Test XLS fields include the number field.""" + acquisition_fields = self.env["account.asset"]._xls_acquisition_fields() + active_fields = self.env["account.asset"]._xls_active_fields() + removal_fields = self.env["account.asset"]._xls_removal_fields() + + self.assertIn( + "number", + acquisition_fields, + "The number field should be included in acquisition fields.", + ) + self.assertIn( + "number", + active_fields, + "The number field should be included in active fields.", + ) + self.assertIn( + "number", + removal_fields, + "The number field should be included in removal fields.", + ) + + def test_04_profile_barcode_type_onchange(self): + """Test the onchange logic for barcode_type.""" + self.ict3Y.write( + { + "barcode_width": 350, + "barcode_height": 75, + } + ) + + self.ict3Y.barcode_type = "qr" + self.ict3Y._onchange_barcode_type() + self.assertEqual( + self.ict3Y.barcode_width, 150, "QR barcode width should default to 150." + ) + self.assertEqual( + self.ict3Y.barcode_height, + 75, + "Barcode height should remain unchanged for QR.", + ) + + self.ict3Y.barcode_type = "barcode" + self.ict3Y._onchange_barcode_type() + self.assertEqual( + self.ict3Y.barcode_width, 300, "Barcode width should default to 300." + ) + self.assertEqual( + self.ict3Y.barcode_height, 75, "Barcode height should default to 75." + ) diff --git a/account_asset_number/views/account_asset_profile_views.xml b/account_asset_number/views/account_asset_profile_views.xml new file mode 100644 index 00000000000..99055d02bda --- /dev/null +++ b/account_asset_number/views/account_asset_profile_views.xml @@ -0,0 +1,30 @@ + + + + account.asset.profile.form + account.asset.profile + + + + + + + + + + + + + + diff --git a/account_asset_number/views/account_asset_views.xml b/account_asset_number/views/account_asset_views.xml new file mode 100644 index 00000000000..a057d881709 --- /dev/null +++ b/account_asset_number/views/account_asset_views.xml @@ -0,0 +1,48 @@ + + + + account.asset.form + account.asset + + +

+ +

+
+
+ + account.asset.tree + account.asset + + + + + + + + + account.asset.search + account.asset + + + + + ['|', ('name', 'ilike', self), ('number', 'ilike', self)] + + + + +