Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][ADD] sale_partner_utm_source #3373

Open
wants to merge 2 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions sale_partner_utm_source/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
===================
Sale Partner Source
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:958a5a4f0e0861de9010c29c432d436cecde0b25b798df171b537e3a2aacbe43
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-add-sale_partner_source/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-add-sale_partner_source/sale-workflow-17-0-add-sale_partner_source-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-add-sale_partner_source
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module provides the following features:

- When a quotation is created, it automatically copies the source from
the partner. Users can manually adjust the source in the quotation if
necessary.
- Enables grouping by source in the order and invoice tree views.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

Odoo doesn't natively provide the ability to automatically fills the
field source for quotation when it is left blank. This module addresses
that by copying from Partner.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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 <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_partner_utm_source%0Aversion:%2017.0-add-sale_partner_source%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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 <https://github.com/OCA/sale-workflow/tree/17.0-add-sale_partner_source/sale_partner_utm_source>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions sale_partner_utm_source/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
16 changes: 16 additions & 0 deletions sale_partner_utm_source/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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": "This module adds the use of utm source in sales",
"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",
],
}
3 changes: 3 additions & 0 deletions sale_partner_utm_source/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import sale_order
16 changes: 16 additions & 0 deletions sale_partner_utm_source/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class SaleOrder(models.Model):
_inherit = "sale.order"

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get("source_id"):
partner = self.env["res.partner"].browse(vals["partner_id"])
if partner.utm_source_id:
vals["source_id"] = partner.utm_source_id.id

Check warning on line 15 in sale_partner_utm_source/models/sale_order.py

View check run for this annotation

Codecov / codecov/patch

sale_partner_utm_source/models/sale_order.py#L15

Added line #L15 was not covered by tests
return super().create(vals_list)
3 changes: 3 additions & 0 deletions sale_partner_utm_source/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions sale_partner_utm_source/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Odoo doesn't natively provide the ability to automatically fills the field source for quotation when it is left blank. This module addresses that by copying from Partner.
1 change: 1 addition & 0 deletions sale_partner_utm_source/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Tuan Nguyen Anh <tuanna@trobz.com>
3 changes: 3 additions & 0 deletions sale_partner_utm_source/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module provides the following features:
- When a quotation is created, it automatically copies the source from the partner. Users can manually adjust the source in the quotation if necessary.
- Enables grouping by source in the order and invoice tree views.
Loading
Loading