2
0

[ADD] account_account_tag_code

This commit is contained in:
Marina Alapont 2023-10-24 16:35:25 +02:00
parent cda322ce6f
commit aa79b8001a
8 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,47 @@
=========================
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.
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**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* ForgeFlow
Contributors
~~~~~~~~~~~~
* Marina Alapont <marina.alapont@forgeflow.com>
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 <https://github.com/OCA/account-financial-tools/tree/16.0/account_asset_batch_compute>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

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

View File

@ -0,0 +1,13 @@
# Copyright 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Account Tag Code",
"summary": "Add a code field to the accounts tags",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"],
"data": ["views/account_account_tag_views.xml"],
}

View File

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

View File

@ -0,0 +1,15 @@
from odoo import fields, models
class AccountAccountTag(models.Model):
_inherit = "account.account.tag"
code = fields.Char()
def name_get(self):
res = super().name_get()
name_mapping = dict(res)
for tag in self:
if tag.code:
name_mapping[tag.id] = "[" + tag.code + "] " + name_mapping[tag.id]
return list(name_mapping.items())

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="account_tag_view_form_code" model="ir.ui.view">
<field name="name">account.tag.view.form.code</field>
<field name="model">account.account.tag</field>
<field name="inherit_id" ref="account.account_tag_view_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="code" />
</field>
</field>
</record>
<record id="account_tag_view_tree_code" model="ir.ui.view">
<field name="name">account.tag.view.tree.code</field>
<field name="model">account.account.tag</field>
<field name="inherit_id" ref="account.account_tag_view_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="code" />
</field>
</field>
</record>
</odoo>

View File

@ -0,0 +1 @@
../../../../account_account_tag_code

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)