[MIG] account_account_tag_code: Migration to 17.0

This commit is contained in:
Antoni Marroig Campomar
2024-05-02 11:16:14 +02:00
parent a63ccdfccc
commit 4d54df3d1a
8 changed files with 210 additions and 18 deletions

View File

@@ -1,10 +1,41 @@
=========================
========================
Account Account Tag Code
=========================
========================
This module adds a field 'code' to model 'account.account.tag'.
This field 'code' is useful to search specific tags without having problems with the translations.
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:50f3061630a4b527055e337add900ffefe18dd2f6d443d28ca5008159a11ff0c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_account_tag_code
: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_account_tag_code
: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 field 'code' to model 'account.account.tag'. This
field 'code' is useful to search specific tags without having problems
with the translations.
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
@@ -12,7 +43,7 @@ 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_account_tag_code%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_account_tag_code%0Aversion:%2017.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.
@@ -20,17 +51,21 @@ Credits
=======
Authors
~~~~~~~
-------
* ForgeFlow
Contributors
~~~~~~~~~~~~
------------
* Marina Alapont <marina.alapont@forgeflow.com>
- ForgeFlow
- Marina Alapont <<marina.alapont@forgeflow.com>>
- `APSL <https://www.apsl.tech>`__:
- Antoni Marroig <<amarroig@apsl.net>>
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@@ -42,6 +77,6 @@ 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 <https://github.com/OCA/account-financial-tools/tree/16.0/account_asset_batch_compute>`_ project on GitHub.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/17.0/account_account_tag_code>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,10 +4,10 @@
{
"name": "Account Account Tag Code",
"summary": "Add a code field to the accounts tags",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"],
"depends": ["account", "account_usability"],
"data": ["views/account_account_tag_views.xml"],
}

View File

@@ -1,4 +1,4 @@
from odoo import fields, models
from odoo import api, fields, models
class AccountAccountTag(models.Model):
@@ -6,10 +6,10 @@ class AccountAccountTag(models.Model):
code = fields.Char()
def name_get(self):
res = super().name_get()
name_mapping = dict(res)
@api.depends("code")
def _compute_display_name(self):
for tag in self:
if tag.code:
name_mapping[tag.id] = "[" + tag.code + "] " + name_mapping[tag.id]
return list(name_mapping.items())
tag.display_name = f"[{tag.code}] {tag.name}"
else:
tag.display_name = tag.name

View File

@@ -0,0 +1,4 @@
- ForgeFlow
- Marina Alapont \<\<<marina.alapont@forgeflow.com>\>\>
- [APSL](<https://www.apsl.tech>):
- Antoni Marroig \<\<<amarroig@apsl.net>\>\>

View File

@@ -0,0 +1,2 @@
This module adds a field 'code' to model 'account.account.tag'.
This field 'code' is useful to search specific tags without having problems with the translations.

View File

@@ -0,0 +1,124 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Module name</h2>
<p>This module was written to extend the functionality of ... to support ... and allow you to ...</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Installation</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To install this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Configuration</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To configure this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Usage</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">To use this module, you need to:
<ul>
<li>...</li>
</ul>
</p>
<p class="oe_mt32">For further information, please visit:
<ul>
<li><a href="https://www.odoo.com/forum/help-1">https://www.odoo.com/forum/help-1</a></li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Known issues / Roadmap</h2>
</div>
<div class="oe_span6">
<p class="oe_mt32">
<ul>
<li>...</li>
</ul>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm">
<img src="crm_sc_01.png">
</a>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row">
<div class="oe_span12">
<h2 class="oe_slogan">Credits</h2>
</div>
<div class="oe_span12">
<h3>Contributors</h3>
<ul>
<li>ForgeFlow &lt;<a href="mailto:email.address@example.com">email.address@example.com</a>&gt;</li>
</ul>
</div>
<div class="oe_span12">
<h3>Maintainer</h3>
<p>
This module is maintained by the OCA.<br/>
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.<br/>
To contribute to this module, please visit <a href="http://odoo-community.org">http://odoo-community.org</a>.<br/>
<a href="http://odoo-community.org"><img class="oe_picture oe_centered" src="http://odoo-community.org/logo.png"></a>
</p>
</div>
</div>
</section>

View File

@@ -0,0 +1 @@
from . import test_account_tag_display_name

View File

@@ -0,0 +1,26 @@
# Copyright 2014-2022 Acsone (http://acsone.eu)
# Copyright 2016-2022 Akretion (http://www.akretion.com/)
# @author Stéphane Bidoul <stephane.bidoul@acsone.eu>
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
class TestAccountTag(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.tag = cls.env["account.account.tag"].create(
{
"name": "Test Tag Name",
}
)
def test_display_name_without_code(self):
self.assertEqual(self.tag.display_name, self.tag.name)
def test_display_name_with_code(self):
self.tag.code = "Test"
self.assertEqual(self.tag.display_name, f"[{self.tag.code}] {self.tag.name}")