From 669c7cb3e8dfd11e899ff50352a7c941ee70af8f Mon Sep 17 00:00:00 2001 From: natuan9 Date: Wed, 23 Oct 2024 16:39:27 +0700 Subject: [PATCH] [ADD] sale_partner_utm_source --- sale_partner_utm_source/README.rst | 89 ++++ sale_partner_utm_source/__init__.py | 2 + sale_partner_utm_source/__manifest__.py | 16 + sale_partner_utm_source/models/__init__.py | 3 + sale_partner_utm_source/models/sale_order.py | 15 + sale_partner_utm_source/pyproject.toml | 3 + sale_partner_utm_source/readme/CONTEXT.md | 1 + .../readme/CONTRIBUTORS.md | 1 + sale_partner_utm_source/readme/DESCRIPTION.md | 1 + .../static/description/index.html | 436 ++++++++++++++++++ .../views/account_move_views.xml | 29 ++ .../views/sale_order_views.xml | 40 ++ 12 files changed, 636 insertions(+) create mode 100644 sale_partner_utm_source/README.rst create mode 100644 sale_partner_utm_source/__init__.py create mode 100644 sale_partner_utm_source/__manifest__.py create mode 100644 sale_partner_utm_source/models/__init__.py create mode 100644 sale_partner_utm_source/models/sale_order.py create mode 100644 sale_partner_utm_source/pyproject.toml create mode 100644 sale_partner_utm_source/readme/CONTEXT.md create mode 100644 sale_partner_utm_source/readme/CONTRIBUTORS.md create mode 100644 sale_partner_utm_source/readme/DESCRIPTION.md create mode 100644 sale_partner_utm_source/static/description/index.html create mode 100644 sale_partner_utm_source/views/account_move_views.xml create mode 100644 sale_partner_utm_source/views/sale_order_views.xml diff --git a/sale_partner_utm_source/README.rst b/sale_partner_utm_source/README.rst new file mode 100644 index 00000000000..5d89e31ebe3 --- /dev/null +++ b/sale_partner_utm_source/README.rst @@ -0,0 +1,89 @@ +=================== +Sale Partner Source +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:a6a90083324f96b5febd24b681e158a4972500d112410f405a2d7ba394485cc9 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/17.0/sale_partner_utm_source + :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-17-0/sale-workflow-17-0-sale_partner_utm_source + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides a way to classify partners using Odoo’s native +**utm.source** model. Each partner can be assigned a Source, which is +added just below the partner's name on the form view. When creating a +Quotation, the Source field of the partner is automatically copied to +the Quotation. Users can manually adjust the Source in the Quotation if +needed. + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +Odoo does not natively provide the ability to track the origin of +customers through a Source field. This module addresses that by allowing +each Partner to have a Source assigned. The Source is automatically +copied to the Quotation when it is created + +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 +------- + +* Trobz + +Contributors +------------ + +- Tuan Nguyen Anh tuanna@trobz.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/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_partner_utm_source/__init__.py b/sale_partner_utm_source/__init__.py new file mode 100644 index 00000000000..02179fb0440 --- /dev/null +++ b/sale_partner_utm_source/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import models diff --git a/sale_partner_utm_source/__manifest__.py b/sale_partner_utm_source/__manifest__.py new file mode 100644 index 00000000000..8547e98155c --- /dev/null +++ b/sale_partner_utm_source/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2024 Trobz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Sale Partner Source", + "summary": "", + "version": "17.0.1.0.0", + "category": "Sales Management", + "author": "Trobz, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["account", "sale", "partner_utm_source"], + "website": "https://github.com/OCA/sale-workflow", + "data": [ + "views/sale_order_views.xml", + "views/account_move_views.xml", + ], +} diff --git a/sale_partner_utm_source/models/__init__.py b/sale_partner_utm_source/models/__init__.py new file mode 100644 index 00000000000..d1d09e0213d --- /dev/null +++ b/sale_partner_utm_source/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import sale_order diff --git a/sale_partner_utm_source/models/sale_order.py b/sale_partner_utm_source/models/sale_order.py new file mode 100644 index 00000000000..4c3ad326719 --- /dev/null +++ b/sale_partner_utm_source/models/sale_order.py @@ -0,0 +1,15 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields, api + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + @api.model + def create(self, vals): + if not vals.get('source_id'): + partner = self.env['res.partner'].browse(vals['partner_id']) + if partner.source_id: + vals['source_id'] = partner.source_id.id + return super().create(vals) diff --git a/sale_partner_utm_source/pyproject.toml b/sale_partner_utm_source/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_partner_utm_source/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_partner_utm_source/readme/CONTEXT.md b/sale_partner_utm_source/readme/CONTEXT.md new file mode 100644 index 00000000000..daf75f95cc5 --- /dev/null +++ b/sale_partner_utm_source/readme/CONTEXT.md @@ -0,0 +1 @@ +Odoo does not natively provide the ability to track the origin of customers through a Source field. This module addresses that by allowing each Partner to have a Source assigned. The Source is automatically copied to the Quotation when it is created diff --git a/sale_partner_utm_source/readme/CONTRIBUTORS.md b/sale_partner_utm_source/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..6ed3296bc58 --- /dev/null +++ b/sale_partner_utm_source/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Tuan Nguyen Anh \ No newline at end of file diff --git a/sale_partner_utm_source/readme/DESCRIPTION.md b/sale_partner_utm_source/readme/DESCRIPTION.md new file mode 100644 index 00000000000..8c2fb2db249 --- /dev/null +++ b/sale_partner_utm_source/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module provides a way to classify partners using Odoo’s native **utm.source** model. Each partner can be assigned a Source, which is added just below the partner's name on the form view. When creating a Quotation, the Source field of the partner is automatically copied to the Quotation. Users can manually adjust the Source in the Quotation if needed. diff --git a/sale_partner_utm_source/static/description/index.html b/sale_partner_utm_source/static/description/index.html new file mode 100644 index 00000000000..a750805e0b4 --- /dev/null +++ b/sale_partner_utm_source/static/description/index.html @@ -0,0 +1,436 @@ + + + + + +Sale Partner Source + + + +
+

Sale Partner Source

+ + +

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

+

This module provides a way to classify partners using Odoo’s native +utm.source model. Each partner can be assigned a Source, which is +added just below the partner’s name on the form view. When creating a +Quotation, the Source field of the partner is automatically copied to +the Quotation. Users can manually adjust the Source in the Quotation if +needed.

+

Table of contents

+ +
+

Use Cases / Context

+

Odoo does not natively provide the ability to track the origin of +customers through a Source field. This module addresses that by allowing +each Partner to have a Source assigned. The Source is automatically +copied to the Quotation when it is created

+
+
+

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

+
    +
  • Trobz
  • +
+
+
+

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/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_partner_utm_source/views/account_move_views.xml b/sale_partner_utm_source/views/account_move_views.xml new file mode 100644 index 00000000000..1bbe359c143 --- /dev/null +++ b/sale_partner_utm_source/views/account_move_views.xml @@ -0,0 +1,29 @@ + + + + account.invoice.tree.inherit + account.move + + + + + + + + + + account.move.search.inherit + account.move + + + + + + + + + diff --git a/sale_partner_utm_source/views/sale_order_views.xml b/sale_partner_utm_source/views/sale_order_views.xml new file mode 100644 index 00000000000..d89d78e1530 --- /dev/null +++ b/sale_partner_utm_source/views/sale_order_views.xml @@ -0,0 +1,40 @@ + + + + quotation.tree.inherit + sale.order + + + + + + + + + + sale.order.tree.inherit + sale.order + + + + + + + + + + sale.order.search.inherit + sale.order + + + + + + + + +