diff --git a/sale_order_line_client_order_ref/README.rst b/sale_order_line_client_order_ref/README.rst new file mode 100644 index 00000000000..d409171e234 --- /dev/null +++ b/sale_order_line_client_order_ref/README.rst @@ -0,0 +1,115 @@ +===================================== +Sale Order Line Cient Order Reference +===================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e234948b1915d6c9360620f5cbb042f16fb99d45a6d04572a5adec42024f0b67 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_line_client_order_ref + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_line_client_order_ref + :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/sale-workflow&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides the following features: + +- Adds a Customer Order Number to sale order lines and propagates the + value to invoice lines. +- Allows the Customer Order Number to be displayed in both sale and + invoice reports. + +This module is useful in cases where a single sales order represents +multiple customer orders. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To display the Customer Order Reference on sale reports: + +- Go to *Sales → Configuration → Settings*. +- Enable **Show Customer Order Reference in Sale Reports (PDF)**. If + selected, the Order Ref column will be added to the lines in the sale + report (PDF). + +To display the Customer Order Reference on invoice reports: + +- Go to *Invoicing / Accounting → Configuration → Settings*. +- Enable **Show Customer Order Reference in Invoice Reports (PDF)**. If + selected, the Order Ref column will be added to the lines in the + invoice report (PDF). + +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/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_order_line_client_order_ref/__init__.py b/sale_order_line_client_order_ref/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/sale_order_line_client_order_ref/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_order_line_client_order_ref/__manifest__.py b/sale_order_line_client_order_ref/__manifest__.py new file mode 100644 index 00000000000..6238486d72a --- /dev/null +++ b/sale_order_line_client_order_ref/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Sale Order Line Cient Order Reference", + "version": "18.0.1.0.0", + "author": "Quartile, Odoo Community Association (OCA)", + "category": "Sale", + "website": "https://github.com/OCA/sale-workflow", + "license": "AGPL-3", + "depends": ["sale"], + "data": [ + "views/account_move_views.xml", + "views/res_config_settings_views.xml", + "views/sale_order_views.xml", + "reports/report_invoice_document.xml", + "reports/report_saleorder_document.xml", + ], + "maintainers": ["yostashiro", "aungkokolin1997"], + "installable": True, +} diff --git a/sale_order_line_client_order_ref/i18n/ja.po b/sale_order_line_client_order_ref/i18n/ja.po new file mode 100644 index 00000000000..07db29b90c8 --- /dev/null +++ b/sale_order_line_client_order_ref/i18n/ja.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_order_line_client_order_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-02 03:30+0000\n" +"PO-Revision-Date: 2025-12-02 03:30+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: sale_order_line_client_order_ref +#: model:ir.model.fields,field_description:sale_order_line_client_order_ref.field_account_move_line__client_order_ref +#: model:ir.model.fields,field_description:sale_order_line_client_order_ref.field_sale_order_line__client_order_ref +msgid "Customer Order Ref" +msgstr "顧客発注番号" + +#. module: sale_order_line_client_order_ref +#: model:ir.model,name:sale_order_line_client_order_ref.model_account_move_line +msgid "Journal Item" +msgstr "仕訳明細" + +#. module: sale_order_line_client_order_ref +#: model:ir.model,name:sale_order_line_client_order_ref.model_sale_order_line +msgid "Sales Order Line" +msgstr "販売オーダ明細" diff --git a/sale_order_line_client_order_ref/models/__init__.py b/sale_order_line_client_order_ref/models/__init__.py new file mode 100644 index 00000000000..a9cfd3c4504 --- /dev/null +++ b/sale_order_line_client_order_ref/models/__init__.py @@ -0,0 +1,4 @@ +from . import account_move_line +from . import res_company +from . import res_config_settings +from . import sale_order_line diff --git a/sale_order_line_client_order_ref/models/account_move_line.py b/sale_order_line_client_order_ref/models/account_move_line.py new file mode 100644 index 00000000000..084562e0043 --- /dev/null +++ b/sale_order_line_client_order_ref/models/account_move_line.py @@ -0,0 +1,10 @@ +# 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 AccountMoveLine(models.Model): + _inherit = "account.move.line" + + client_order_ref = fields.Char("Customer Order Ref") diff --git a/sale_order_line_client_order_ref/models/res_company.py b/sale_order_line_client_order_ref/models/res_company.py new file mode 100644 index 00000000000..8fcb3ac302f --- /dev/null +++ b/sale_order_line_client_order_ref/models/res_company.py @@ -0,0 +1,11 @@ +# 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 ResCompany(models.Model): + _inherit = "res.company" + + show_client_order_ref_sale = fields.Boolean() + show_client_order_ref_invoice = fields.Boolean() diff --git a/sale_order_line_client_order_ref/models/res_config_settings.py b/sale_order_line_client_order_ref/models/res_config_settings.py new file mode 100644 index 00000000000..84394b57014 --- /dev/null +++ b/sale_order_line_client_order_ref/models/res_config_settings.py @@ -0,0 +1,15 @@ +# 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 ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + show_client_order_ref_sale = fields.Boolean( + related="company_id.show_client_order_ref_sale", readonly=False + ) + show_client_order_ref_invoice = fields.Boolean( + related="company_id.show_client_order_ref_invoice", readonly=False + ) diff --git a/sale_order_line_client_order_ref/models/sale_order_line.py b/sale_order_line_client_order_ref/models/sale_order_line.py new file mode 100644 index 00000000000..74b1acb5226 --- /dev/null +++ b/sale_order_line_client_order_ref/models/sale_order_line.py @@ -0,0 +1,25 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + client_order_ref = fields.Char( + "Customer Order Ref", + compute="_compute_client_order_ref", + store=True, + readonly=False, + ) + + @api.depends("order_id.client_order_ref") + def _compute_client_order_ref(self): + for rec in self: + rec.client_order_ref = rec.order_id.client_order_ref + + def _prepare_invoice_line(self, **optional_values): + res = super()._prepare_invoice_line(**optional_values) + res["client_order_ref"] = self.client_order_ref + return res diff --git a/sale_order_line_client_order_ref/pyproject.toml b/sale_order_line_client_order_ref/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_order_line_client_order_ref/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_order_line_client_order_ref/readme/CONFIGURE.md b/sale_order_line_client_order_ref/readme/CONFIGURE.md new file mode 100644 index 00000000000..6459119c7d8 --- /dev/null +++ b/sale_order_line_client_order_ref/readme/CONFIGURE.md @@ -0,0 +1,11 @@ +To display the Customer Order Reference on sale reports: + +- Go to *Sales → Configuration → Settings*. +- Enable **Show Customer Order Reference in Sale Reports (PDF)**. If selected, the Order + Ref column will be added to the lines in the sale report (PDF). + +To display the Customer Order Reference on invoice reports: + +- Go to *Invoicing / Accounting → Configuration → Settings*. +- Enable **Show Customer Order Reference in Invoice Reports (PDF)**. If selected, the Order + Ref column will be added to the lines in the invoice report (PDF). diff --git a/sale_order_line_client_order_ref/readme/CONTRIBUTORS.md b/sale_order_line_client_order_ref/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..2794613f37c --- /dev/null +++ b/sale_order_line_client_order_ref/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Quartile \<\> + - Yoshi Tashiro + - Aung Ko Ko Lin diff --git a/sale_order_line_client_order_ref/readme/DESCRIPTION.md b/sale_order_line_client_order_ref/readme/DESCRIPTION.md new file mode 100644 index 00000000000..63ab14b92e7 --- /dev/null +++ b/sale_order_line_client_order_ref/readme/DESCRIPTION.md @@ -0,0 +1,9 @@ +This module provides the following features: + +- Adds a Customer Order Number to sale order lines and propagates the value to + invoice lines. +- Allows the Customer Order Number to be displayed in both sale and invoice + reports. + +This module is useful in cases where a single sales order represents multiple +customer orders. diff --git a/sale_order_line_client_order_ref/reports/report_invoice_document.xml b/sale_order_line_client_order_ref/reports/report_invoice_document.xml new file mode 100644 index 00000000000..8aa75fdd208 --- /dev/null +++ b/sale_order_line_client_order_ref/reports/report_invoice_document.xml @@ -0,0 +1,23 @@ + + + diff --git a/sale_order_line_client_order_ref/reports/report_saleorder_document.xml b/sale_order_line_client_order_ref/reports/report_saleorder_document.xml new file mode 100644 index 00000000000..2438fbdb7db --- /dev/null +++ b/sale_order_line_client_order_ref/reports/report_saleorder_document.xml @@ -0,0 +1,23 @@ + + + diff --git a/sale_order_line_client_order_ref/static/description/index.html b/sale_order_line_client_order_ref/static/description/index.html new file mode 100644 index 00000000000..fad4ca5fb05 --- /dev/null +++ b/sale_order_line_client_order_ref/static/description/index.html @@ -0,0 +1,455 @@ + + + + + +Sale Order Line Cient Order Reference + + + +
+

Sale Order Line Cient Order Reference

+ + +

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

+

This module provides the following features:

+
    +
  • Adds a Customer Order Number to sale order lines and propagates the +value to invoice lines.
  • +
  • Allows the Customer Order Number to be displayed in both sale and +invoice reports.
  • +
+

This module is useful in cases where a single sales order represents +multiple customer orders.

+

Table of contents

+ +
+

Configuration

+

To display the Customer Order Reference on sale reports:

+
    +
  • Go to Sales → Configuration → Settings.
  • +
  • Enable Show Customer Order Reference in Sale Reports (PDF). If +selected, the Order Ref column will be added to the lines in the sale +report (PDF).
  • +
+

To display the Customer Order Reference on invoice reports:

+
    +
  • Go to Invoicing / Accounting → Configuration → Settings.
  • +
  • Enable Show Customer Order Reference in Invoice Reports (PDF). If +selected, the Order Ref column will be added to the lines in the +invoice report (PDF).
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/sale_order_line_client_order_ref/tests/__init__.py b/sale_order_line_client_order_ref/tests/__init__.py new file mode 100644 index 00000000000..a8be9a058af --- /dev/null +++ b/sale_order_line_client_order_ref/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_order_line_client_order_ref diff --git a/sale_order_line_client_order_ref/tests/test_sale_order_line_client_order_ref.py b/sale_order_line_client_order_ref/tests/test_sale_order_line_client_order_ref.py new file mode 100644 index 00000000000..703571665a2 --- /dev/null +++ b/sale_order_line_client_order_ref/tests/test_sale_order_line_client_order_ref.py @@ -0,0 +1,32 @@ +# Copyright 2025 Quartile (https://www.quartile.co) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import TransactionCase + + +class TestSaleOrderLineClientOrderReference(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.test_product = cls.env["product.product"].create( + {"name": "Test Product", "type": "service"} + ) + cls.test_partner = cls.env["res.partner"].create({"name": "Test Partner"}) + cls.sale_order = cls.env["sale.order"].create( + {"partner_id": cls.test_partner.id, "client_order_ref": "Test Ref"} + ) + cls.order_line = cls.env["sale.order.line"].create( + { + "order_id": cls.sale_order.id, + "product_id": cls.test_product.id, + "product_uom_qty": 1.0, + "price_unit": 100.0, + } + ) + + def test_01_prepare_invoice_line(self): + self.assertEqual(self.order_line.client_order_ref, "Test Ref") + self.order_line.write({"client_order_ref": "Test Customer Ref"}) + self.sale_order.action_confirm() + invoice = self.sale_order._create_invoices() + self.assertEqual(invoice.invoice_line_ids.client_order_ref, "Test Customer Ref") diff --git a/sale_order_line_client_order_ref/views/account_move_views.xml b/sale_order_line_client_order_ref/views/account_move_views.xml new file mode 100644 index 00000000000..46a65a71ee7 --- /dev/null +++ b/sale_order_line_client_order_ref/views/account_move_views.xml @@ -0,0 +1,20 @@ + + + + account.move.form + account.move + + + + + + + + diff --git a/sale_order_line_client_order_ref/views/res_config_settings_views.xml b/sale_order_line_client_order_ref/views/res_config_settings_views.xml new file mode 100644 index 00000000000..b729c76f77d --- /dev/null +++ b/sale_order_line_client_order_ref/views/res_config_settings_views.xml @@ -0,0 +1,37 @@ + + + + res.config.settings + res.config.settings + + + + + + + + + + + res.config.settings + res.config.settings + + + + + + + + + + diff --git a/sale_order_line_client_order_ref/views/sale_order_views.xml b/sale_order_line_client_order_ref/views/sale_order_views.xml new file mode 100644 index 00000000000..31a40f54e0a --- /dev/null +++ b/sale_order_line_client_order_ref/views/sale_order_views.xml @@ -0,0 +1,16 @@ + + + + sale.order.form + sale.order + + + + + + + +