diff --git a/partner_end_customer/README.rst b/partner_end_customer/README.rst new file mode 100644 index 00000000..7626d5ea --- /dev/null +++ b/partner_end_customer/README.rst @@ -0,0 +1,56 @@ +==================== +Partner End Customer +==================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b2eb3927533770e9a5e73c6dfafaad052524759813cebac5606d522c19a96d98 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Fhls--custom-lightgray.png?logo=github + :target: https://github.com/qrtl/hls-custom/tree/18.0/partner_end_customer + :alt: qrtl/hls-custom + +|badge1| |badge2| |badge3| + +This module adds an end customer field to partners, shown and searchable +on sale orders and customer invoices. + +**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 +------- + +* Quartile + +Maintainers +----------- + +This module is part of the `qrtl/hls-custom `_ project on GitHub. + +You are welcome to contribute. diff --git a/partner_end_customer/__init__.py b/partner_end_customer/__init__.py new file mode 100644 index 00000000..6d58305f --- /dev/null +++ b/partner_end_customer/__init__.py @@ -0,0 +1,2 @@ +from . import models +from .hooks import pre_init_hook diff --git a/partner_end_customer/__manifest__.py b/partner_end_customer/__manifest__.py new file mode 100644 index 00000000..370f8a66 --- /dev/null +++ b/partner_end_customer/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "Partner End Customer", + "summary": "Add an end customer field to partners, searchable on sale orders", + "version": "18.0.1.0.0", + "category": "Sales", + "website": "https://www.quartile.co", + "author": "Quartile", + "license": "LGPL-3", + "installable": True, + "depends": ["sale"], + "pre_init_hook": "pre_init_hook", + "data": [ + "views/account_move_views.xml", + "views/res_partner_views.xml", + "views/sale_order_views.xml", + ], +} diff --git a/partner_end_customer/hooks.py b/partner_end_customer/hooks.py new file mode 100644 index 00000000..4250be7b --- /dev/null +++ b/partner_end_customer/hooks.py @@ -0,0 +1,10 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo.tools.sql import column_exists + + +def pre_init_hook(env): + for table in ("sale_order", "account_move"): + if not column_exists(env.cr, table, "end_customer"): + env.cr.execute(f"ALTER TABLE {table} ADD COLUMN end_customer VARCHAR") diff --git a/partner_end_customer/i18n/ja.po b/partner_end_customer/i18n/ja.po new file mode 100644 index 00000000..89dd1b28 --- /dev/null +++ b/partner_end_customer/i18n/ja.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * partner_end_customer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-09-03 08:39+0000\n" +"PO-Revision-Date: 2026-09-03 08:39+0000\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: partner_end_customer +#: model:ir.model,name:partner_end_customer.model_res_partner +msgid "Contact" +msgstr "連絡先" + +#. module: partner_end_customer +#: model:ir.model.fields,help:partner_end_customer.field_res_partner__end_customer +#: model:ir.model.fields,help:partner_end_customer.field_res_users__end_customer +msgid "" +"E.g. the customer beyond a trading company or wholesaler, such as a " +"restaurant or supermarket." +msgstr "例:商社・卸の先にいる顧客(外食・スーパーなど)。" + +#. module: partner_end_customer +#: model:ir.model.fields,field_description:partner_end_customer.field_account_bank_statement_line__end_customer +#: model:ir.model.fields,field_description:partner_end_customer.field_account_move__end_customer +#: model:ir.model.fields,field_description:partner_end_customer.field_res_partner__end_customer +#: model:ir.model.fields,field_description:partner_end_customer.field_res_users__end_customer +#: model:ir.model.fields,field_description:partner_end_customer.field_sale_order__end_customer +msgid "End Customer" +msgstr "最終顧客" + +#. module: partner_end_customer +#: model:ir.model,name:partner_end_customer.model_account_move +msgid "Journal Entry" +msgstr "仕訳" + +#. module: partner_end_customer +#: model:ir.model,name:partner_end_customer.model_sale_order +msgid "Sales Order" +msgstr "販売オーダ" diff --git a/partner_end_customer/models/__init__.py b/partner_end_customer/models/__init__.py new file mode 100644 index 00000000..a98c06a5 --- /dev/null +++ b/partner_end_customer/models/__init__.py @@ -0,0 +1,3 @@ +from . import account_move +from . import res_partner +from . import sale_order diff --git a/partner_end_customer/models/account_move.py b/partner_end_customer/models/account_move.py new file mode 100644 index 00000000..277fc158 --- /dev/null +++ b/partner_end_customer/models/account_move.py @@ -0,0 +1,24 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + end_customer = fields.Char( + compute="_compute_end_customer", + store=True, + readonly=False, + tracking=True, + ) + + @api.depends("move_type", "partner_shipping_id") + def _compute_end_customer(self): + for move in self: + move.end_customer = ( + move.partner_shipping_id.end_customer + if move.is_sale_document() + else False + ) diff --git a/partner_end_customer/models/res_partner.py b/partner_end_customer/models/res_partner.py new file mode 100644 index 00000000..1fa44e1e --- /dev/null +++ b/partner_end_customer/models/res_partner.py @@ -0,0 +1,13 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + end_customer = fields.Char( + help="E.g. the customer beyond a trading company or wholesaler, such " + "as a restaurant or supermarket." + ) diff --git a/partner_end_customer/models/sale_order.py b/partner_end_customer/models/sale_order.py new file mode 100644 index 00000000..b5c548c4 --- /dev/null +++ b/partner_end_customer/models/sale_order.py @@ -0,0 +1,25 @@ +# Copyright 2026 Quartile (https://www.quartile.co) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + end_customer = fields.Char( + compute="_compute_end_customer", + store=True, + readonly=False, + tracking=True, + ) + + @api.depends("partner_shipping_id") + def _compute_end_customer(self): + for order in self: + order.end_customer = order.partner_shipping_id.end_customer + + def _prepare_invoice(self): + values = super()._prepare_invoice() + values["end_customer"] = self.end_customer + return values diff --git a/partner_end_customer/pyproject.toml b/partner_end_customer/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/partner_end_customer/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/partner_end_customer/readme/DESCRIPTION.md b/partner_end_customer/readme/DESCRIPTION.md new file mode 100644 index 00000000..432aa869 --- /dev/null +++ b/partner_end_customer/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module adds an end customer field to partners, shown and searchable on sale +orders and customer invoices. diff --git a/partner_end_customer/static/description/index.html b/partner_end_customer/static/description/index.html new file mode 100644 index 00000000..8e13fd05 --- /dev/null +++ b/partner_end_customer/static/description/index.html @@ -0,0 +1,410 @@ + + + + + +Partner End Customer + + + +
+

Partner End Customer

+ + +

Beta License: LGPL-3 qrtl/hls-custom

+

This module adds an end customer field to partners, shown and searchable +on sale orders and customer invoices.

+

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

+
    +
  • Quartile
  • +
+
+
+

Maintainers

+

This module is part of the qrtl/hls-custom project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/partner_end_customer/views/account_move_views.xml b/partner_end_customer/views/account_move_views.xml new file mode 100644 index 00000000..178d2da9 --- /dev/null +++ b/partner_end_customer/views/account_move_views.xml @@ -0,0 +1,36 @@ + + + + account.out.invoice.list + account.move + + + + + + + + + account.move.form + account.move + + + + + + + + + account.invoice.select + account.move + + + + + + + + diff --git a/partner_end_customer/views/res_partner_views.xml b/partner_end_customer/views/res_partner_views.xml new file mode 100644 index 00000000..e4e0c32a --- /dev/null +++ b/partner_end_customer/views/res_partner_views.xml @@ -0,0 +1,33 @@ + + + + res.partner.form + res.partner + + + + + + + + + res.partner.list + res.partner + + + + + + + + + res.partner.select + res.partner + + + + + + + + diff --git a/partner_end_customer/views/sale_order_views.xml b/partner_end_customer/views/sale_order_views.xml new file mode 100644 index 00000000..72ec4dd0 --- /dev/null +++ b/partner_end_customer/views/sale_order_views.xml @@ -0,0 +1,33 @@ + + + + sale.order.list + sale.order + + + + + + + + + sale.order.form + sale.order + + + + + + + + + sale.order.list.select + sale.order + + + + + + + +