diff --git a/hr_department_code/README.rst b/hr_department_code/README.rst new file mode 100644 index 00000000000..3ef3ae0d738 --- /dev/null +++ b/hr_department_code/README.rst @@ -0,0 +1,77 @@ +================== +HR department code +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9044d1af5e575e1166011b22adffac4535e37b943d3805914673427a2594d18a + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fhr-lightgray.png?logo=github + :target: https://github.com/OCA/hr/tree/18.0/hr_department_code + :alt: OCA/hr +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/hr-18-0/hr-18-0-hr_department_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/hr&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module add code in department. + +**Table of contents** + +.. contents:: + :local: + +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 +------------ + +- Saran Lim. +- ``Heliconia Solutions Pvt. Ltd. ``\ \_ + +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/hr `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/hr_department_code/__init__.py b/hr_department_code/__init__.py new file mode 100644 index 00000000000..69f7babdfb1 --- /dev/null +++ b/hr_department_code/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/hr_department_code/__manifest__.py b/hr_department_code/__manifest__.py new file mode 100644 index 00000000000..b257832f064 --- /dev/null +++ b/hr_department_code/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "HR department code", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "category": "Human Resources", + "author": "Ecosoft, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/hr", + "depends": ["hr"], + "data": ["views/hr_department_views.xml"], + "installable": True, + "maintainer": ["Saran440"], +} diff --git a/hr_department_code/i18n/de.po b/hr_department_code/i18n/de.po new file mode 100644 index 00000000000..29835227f77 --- /dev/null +++ b/hr_department_code/i18n/de.po @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_department_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-05-11 13:05+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: none\n" +"Language: de\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.3.2\n" + +#. module: hr_department_code +#: model:ir.model.fields,field_description:hr_department_code.field_hr_department__code +msgid "Code" +msgstr "Code" + +#. module: hr_department_code +#: model:ir.model,name:hr_department_code.model_hr_department +msgid "Department" +msgstr "Abteilung" + +#~ msgid "Display Name" +#~ msgstr "Anzeigename" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Zuletzt geändert am" diff --git a/hr_department_code/i18n/hr.po b/hr_department_code/i18n/hr.po new file mode 100644 index 00000000000..33374bae764 --- /dev/null +++ b/hr_department_code/i18n/hr.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_department_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-08-22 12: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: hr_department_code +#: model:ir.model.fields,field_description:hr_department_code.field_hr_department__code +msgid "Code" +msgstr "Šifra" + +#. module: hr_department_code +#: model:ir.model,name:hr_department_code.model_hr_department +msgid "Department" +msgstr "Odjel" + +#~ msgid "Display Name" +#~ msgstr "Naziv" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Zadnje modificirano" diff --git a/hr_department_code/i18n/hr_department_code.pot b/hr_department_code/i18n/hr_department_code.pot new file mode 100644 index 00000000000..8235744c130 --- /dev/null +++ b/hr_department_code/i18n/hr_department_code.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_department_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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: hr_department_code +#: model:ir.model.fields,field_description:hr_department_code.field_hr_department__code +msgid "Code" +msgstr "" + +#. module: hr_department_code +#: model:ir.model,name:hr_department_code.model_hr_department +msgid "Department" +msgstr "" diff --git a/hr_department_code/i18n/it.po b/hr_department_code/i18n/it.po new file mode 100644 index 00000000000..989483ca95b --- /dev/null +++ b/hr_department_code/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * hr_department_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-05-30 09:11+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 4.17\n" + +#. module: hr_department_code +#: model:ir.model.fields,field_description:hr_department_code.field_hr_department__code +msgid "Code" +msgstr "Codice" + +#. module: hr_department_code +#: model:ir.model,name:hr_department_code.model_hr_department +msgid "Department" +msgstr "Reparto" diff --git a/hr_department_code/models/__init__.py b/hr_department_code/models/__init__.py new file mode 100644 index 00000000000..97964eba402 --- /dev/null +++ b/hr_department_code/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import hr_department diff --git a/hr_department_code/models/hr_department.py b/hr_department_code/models/hr_department.py new file mode 100644 index 00000000000..5e4a6a44b81 --- /dev/null +++ b/hr_department_code/models/hr_department.py @@ -0,0 +1,20 @@ +# 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 Department(models.Model): + _inherit = "hr.department" + _order = "code, name" + + code = fields.Char() + + @api.depends_context("hierarchical_naming") + @api.depends("code", "name") + def _compute_display_name(self): + res = super()._compute_display_name() + for record in self: + if record.code: + record.display_name = f"[{record.code}] {record.display_name}" + return res diff --git a/hr_department_code/pyproject.toml b/hr_department_code/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/hr_department_code/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/hr_department_code/readme/CONTRIBUTORS.md b/hr_department_code/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..9d1b954c860 --- /dev/null +++ b/hr_department_code/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Saran Lim. \<\> +- `Heliconia Solutions Pvt. Ltd. `_ diff --git a/hr_department_code/readme/DESCRIPTION.md b/hr_department_code/readme/DESCRIPTION.md new file mode 100644 index 00000000000..b1fee45fa77 --- /dev/null +++ b/hr_department_code/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module add code in department. diff --git a/hr_department_code/static/description/icon.png b/hr_department_code/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/hr_department_code/static/description/icon.png differ diff --git a/hr_department_code/static/description/index.html b/hr_department_code/static/description/index.html new file mode 100644 index 00000000000..70df1521539 --- /dev/null +++ b/hr_department_code/static/description/index.html @@ -0,0 +1,424 @@ + + + + + +HR department code + + + +
+

HR department code

+ + +

Beta License: AGPL-3 OCA/hr Translate me on Weblate Try me on Runboat

+

This module add code in department.

+

Table of contents

+ +
+

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/hr project on GitHub.

+

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

+
+
+
+ + diff --git a/hr_department_code/tests/__init__.py b/hr_department_code/tests/__init__.py new file mode 100644 index 00000000000..c6a17b3312c --- /dev/null +++ b/hr_department_code/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_hr_department_code diff --git a/hr_department_code/tests/test_hr_department_code.py b/hr_department_code/tests/test_hr_department_code.py new file mode 100644 index 00000000000..62fce65fbbe --- /dev/null +++ b/hr_department_code/tests/test_hr_department_code.py @@ -0,0 +1,19 @@ +# Copyright 2021 Ecosoft Co., Ltd. (http://ecosoft.co.th) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestHrDepartmentCode(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.department_model = cls.env["hr.department"] + + def create_department(self, name, code=False): + return self.department_model.create({"name": name, "code": code}) + + def test_name_get_department(self): + department1 = self.create_department("Department1") + self.assertEqual(department1.name, "Department1") + self.assertEqual(department1.display_name, "Department1") diff --git a/hr_department_code/views/hr_department_views.xml b/hr_department_code/views/hr_department_views.xml new file mode 100644 index 00000000000..2c0985975fc --- /dev/null +++ b/hr_department_code/views/hr_department_views.xml @@ -0,0 +1,37 @@ + + + + hr.department + + + +
+
+
+
+
+ + hr.department + + + + + + + + + hr.department + + + + + ['|', ('name','ilike',self), ('code','ilike',self)] + + + + +