diff --git a/report_partner_address/README.rst b/report_partner_address/README.rst new file mode 100644 index 0000000000..00ddf4f39e --- /dev/null +++ b/report_partner_address/README.rst @@ -0,0 +1,109 @@ +====================== +Report Partner Address +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7c019dbfd9524b0b0daaaafa5fbbc77df627c40d3bb1e1b6bf9bea2f5a224972 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/18.0/report_partner_address + :alt: OCA/reporting-engine +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-report_partner_address + :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/reporting-engine&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds a translatable Address Details field on partners for use in reports +and portal. + +Odoo prints documents in the partner's language but lacks a standard way +to display addresses in multiple languages. This module fills that gap. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +- Go to the partner record. +- Fill in Address Details, including translations for the active + languages. + +The address in reports and portal pages will use the value from Address +Details. + +If Address Details is left blank, the standard address format is used. + +Note: Unlike standard address fields, Address Details is not inherited +by child contacts. + +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 +------- + +* Quartile + +Contributors +------------ + +- Quartile + + - Yoshi Tashiro + - Aung Ko Ko Lin + +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-yostashiro| image:: https://github.com/yostashiro.png?size=40px + :target: https://github.com/yostashiro + :alt: yostashiro +.. |maintainer-aungkokolin1997| image:: https://github.com/aungkokolin1997.png?size=40px + :target: https://github.com/aungkokolin1997 + :alt: aungkokolin1997 + +Current `maintainers `__: + +|maintainer-yostashiro| |maintainer-aungkokolin1997| + +This module is part of the `OCA/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_partner_address/__init__.py b/report_partner_address/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/report_partner_address/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/report_partner_address/__manifest__.py b/report_partner_address/__manifest__.py new file mode 100644 index 0000000000..0a8548df78 --- /dev/null +++ b/report_partner_address/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Report Partner Address", + "summary": "Translatable partner address details for reports and portal", + "version": "18.0.1.0.0", + "author": "Quartile, Odoo Community Association (OCA)", + "category": "Reporting", + "website": "https://github.com/OCA/reporting-engine", + "license": "AGPL-3", + "depends": ["web"], + "data": [ + "views/ir_qweb_widget_templates.xml", + "views/res_partner_views.xml", + ], + "maintainers": ["yostashiro", "aungkokolin1997"], + "installable": True, +} diff --git a/report_partner_address/i18n/ja.po b/report_partner_address/i18n/ja.po new file mode 100644 index 0000000000..8540d01e86 --- /dev/null +++ b/report_partner_address/i18n/ja.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_partner_address +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-21 08:50+0000\n" +"PO-Revision-Date: 2025-12-21 08:50+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: report_partner_address +#: model:ir.model.fields,field_description:report_partner_address.field_res_partner__address_details +#: model:ir.model.fields,field_description:report_partner_address.field_res_users__address_details +msgid "Address Details" +msgstr "アドレス詳細" + +#. module: report_partner_address +#: model:ir.model,name:report_partner_address.model_res_partner +msgid "Contact" +msgstr "連絡先" + +#. module: report_partner_address +#: model:ir.model.fields,help:report_partner_address.field_res_partner__address_details +#: model:ir.model.fields,help:report_partner_address.field_res_users__address_details +msgid "" +"Custom address format used in reports and portal pages. When set, this " +"replaces the standard address format for external display." +msgstr "" +"レポートやポータルページに適用されるアドレスフォーマット。設定されている場" +"合、対外表示用に標準のアドレスフォーマットがその内容で置き換えられます。" diff --git a/report_partner_address/i18n/report_partner_address.pot b/report_partner_address/i18n/report_partner_address.pot new file mode 100644 index 0000000000..be4a3fd574 --- /dev/null +++ b/report_partner_address/i18n/report_partner_address.pot @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_partner_address +# +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: report_partner_address +#: model:ir.model.fields,field_description:report_partner_address.field_res_partner__address_details +#: model:ir.model.fields,field_description:report_partner_address.field_res_users__address_details +msgid "Address Details" +msgstr "" + +#. module: report_partner_address +#: model:ir.model,name:report_partner_address.model_res_partner +msgid "Contact" +msgstr "" + +#. module: report_partner_address +#: model:ir.model.fields,help:report_partner_address.field_res_partner__address_details +#: model:ir.model.fields,help:report_partner_address.field_res_users__address_details +msgid "" +"Custom address format used in reports and portal pages. When set, this " +"replaces the standard address format for external display." +msgstr "" diff --git a/report_partner_address/models/__init__.py b/report_partner_address/models/__init__.py new file mode 100644 index 0000000000..91fed54d40 --- /dev/null +++ b/report_partner_address/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner diff --git a/report_partner_address/models/res_partner.py b/report_partner_address/models/res_partner.py new file mode 100644 index 0000000000..89c58cd47e --- /dev/null +++ b/report_partner_address/models/res_partner.py @@ -0,0 +1,23 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + address_details = fields.Text( + translate=True, + help="Custom address format used in reports and portal pages. " + "When set, this replaces the standard address format for external display.", + ) + + def _prepare_display_address(self, without_company=False): + self.ensure_one() + address_format, args = super()._prepare_display_address( + without_company=without_company + ) + if self.address_details: + address_format = self.address_details + return address_format, args diff --git a/report_partner_address/pyproject.toml b/report_partner_address/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/report_partner_address/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/report_partner_address/readme/CONTRIBUTORS.md b/report_partner_address/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..2794613f37 --- /dev/null +++ b/report_partner_address/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Quartile \<\> + - Yoshi Tashiro + - Aung Ko Ko Lin diff --git a/report_partner_address/readme/DESCRIPTION.md b/report_partner_address/readme/DESCRIPTION.md new file mode 100644 index 0000000000..61e62efa74 --- /dev/null +++ b/report_partner_address/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +Adds a translatable Address Details field on partners for use in reports and portal. + +Odoo prints documents in the partner's language but lacks a standard way to display +addresses in multiple languages. This module fills that gap. diff --git a/report_partner_address/readme/USAGE.md b/report_partner_address/readme/USAGE.md new file mode 100644 index 0000000000..b794bf0afd --- /dev/null +++ b/report_partner_address/readme/USAGE.md @@ -0,0 +1,8 @@ +- Go to the partner record. +- Fill in Address Details, including translations for the active languages. + +The address in reports and portal pages will use the value from Address Details. + +If Address Details is left blank, the standard address format is used. + +Note: Unlike standard address fields, Address Details is not inherited by child contacts. diff --git a/report_partner_address/static/description/icon.png b/report_partner_address/static/description/icon.png new file mode 100644 index 0000000000..1dcc49c24f Binary files /dev/null and b/report_partner_address/static/description/icon.png differ diff --git a/report_partner_address/static/description/index.html b/report_partner_address/static/description/index.html new file mode 100644 index 0000000000..21f3d799b4 --- /dev/null +++ b/report_partner_address/static/description/index.html @@ -0,0 +1,446 @@ + + + + + +Report Partner Address + + + +
+

Report Partner Address

+ + +

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

+

Adds a translatable Address Details field on partners for use in reports +and portal.

+

Odoo prints documents in the partner’s language but lacks a standard way +to display addresses in multiple languages. This module fills that gap.

+

Table of contents

+ +
+

Usage

+
    +
  • Go to the partner record.
  • +
  • Fill in Address Details, including translations for the active +languages.
  • +
+

The address in reports and portal pages will use the value from Address +Details.

+

If Address Details is left blank, the standard address format is used.

+

Note: Unlike standard address fields, Address Details is not inherited +by child contacts.

+
+
+

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

+
    +
  • Quartile
  • +
+
+
+

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.

+

Current maintainers:

+

yostashiro aungkokolin1997

+

This module is part of the OCA/reporting-engine project on GitHub.

+

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

+
+
+
+ + diff --git a/report_partner_address/tests/__init__.py b/report_partner_address/tests/__init__.py new file mode 100644 index 0000000000..7ad72d135d --- /dev/null +++ b/report_partner_address/tests/__init__.py @@ -0,0 +1 @@ +from . import test_report_partner_address diff --git a/report_partner_address/tests/test_report_partner_address.py b/report_partner_address/tests/test_report_partner_address.py new file mode 100644 index 0000000000..5a5cb03f73 --- /dev/null +++ b/report_partner_address/tests/test_report_partner_address.py @@ -0,0 +1,56 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase, tagged + + +@tagged("post_install", "-at_install") +class TestReportPartnerAddress(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + ja = ( + cls.env["res.lang"] + .with_context(active_test=False) + .search([("code", "=", "ja_JP")]) + ) + cls.env["base.language.install"].create({"lang_ids": [ja.id]}).lang_install() + cls.partner = cls.env["res.partner"].create( + { + "name": "Test Company", + "street": "1-2-3 Jingumae", + "city": "Shibuya-ku, Tokyo", + "zip": "150-0001", + "country_id": cls.env.ref("base.jp").id, + } + ) + # Japanese address format (native) + cls.partner.with_context(lang="ja_JP").write( + {"address_details": "〒150-0001\n東京都渋谷区神宮前1-2-3\nテスト株式会社"} + ) + # English transliteration for international use + cls.partner.address_details = ( + "Test Company\n1-2-3 Jingumae, Shibuya-ku\nTokyo 150-0001\nJapan" + ) + + def test_address_details_always_used(self): + res = self.partner.with_context(lang="en_US")._display_address() + self.assertEqual( + res, "Test Company\n1-2-3 Jingumae, Shibuya-ku\nTokyo 150-0001\nJapan" + ) + res = self.partner.with_context(lang="ja_JP")._display_address() + self.assertEqual(res, "〒150-0001\n東京都渋谷区神宮前1-2-3\nテスト株式会社") + + def test_address_details_empty_uses_standard_format(self): + partner = self.env["res.partner"].create( + { + "name": "No Details Partner", + "street": "123 Main St", + "city": "Springfield", + "zip": "12345", + "country_id": self.env.ref("base.us").id, + } + ) + res = partner._display_address() + self.assertIn("123 Main St", res) + self.assertIn("Springfield", res) diff --git a/report_partner_address/views/ir_qweb_widget_templates.xml b/report_partner_address/views/ir_qweb_widget_templates.xml new file mode 100644 index 0000000000..cda0b2f466 --- /dev/null +++ b/report_partner_address/views/ir_qweb_widget_templates.xml @@ -0,0 +1,9 @@ + + + diff --git a/report_partner_address/views/res_partner_views.xml b/report_partner_address/views/res_partner_views.xml new file mode 100644 index 0000000000..ef3a2b1407 --- /dev/null +++ b/report_partner_address/views/res_partner_views.xml @@ -0,0 +1,12 @@ + + + res.partner.form + res.partner + + + + + + + +