From b5e3457fa6acea01b101427a0f0bb6c44ac57468 Mon Sep 17 00:00:00 2001 From: LorenzoC0 Date: Tue, 1 Jul 2025 15:05:52 +0200 Subject: [PATCH] [ADD] subscription_analytic_project: Added module --- .../odoo/addons/subscription_analytic_project | 1 + setup/subscription_analytic_project/setup.py | 6 + subscription_analytic_project/README.rst | 82 ++++ subscription_analytic_project/__init__.py | 1 + subscription_analytic_project/__manifest__.py | 15 + .../models/__init__.py | 1 + .../models/sale_order_line.py | 16 + .../readme/DESCRIPTION.rst | 4 + .../static/description/index.html | 420 ++++++++++++++++++ 9 files changed, 546 insertions(+) create mode 120000 setup/subscription_analytic_project/odoo/addons/subscription_analytic_project create mode 100644 setup/subscription_analytic_project/setup.py create mode 100644 subscription_analytic_project/README.rst create mode 100644 subscription_analytic_project/__init__.py create mode 100644 subscription_analytic_project/__manifest__.py create mode 100644 subscription_analytic_project/models/__init__.py create mode 100644 subscription_analytic_project/models/sale_order_line.py create mode 100644 subscription_analytic_project/readme/DESCRIPTION.rst create mode 100644 subscription_analytic_project/static/description/index.html diff --git a/setup/subscription_analytic_project/odoo/addons/subscription_analytic_project b/setup/subscription_analytic_project/odoo/addons/subscription_analytic_project new file mode 120000 index 0000000000..e8b5350ade --- /dev/null +++ b/setup/subscription_analytic_project/odoo/addons/subscription_analytic_project @@ -0,0 +1 @@ +../../../../subscription_analytic_project \ No newline at end of file diff --git a/setup/subscription_analytic_project/setup.py b/setup/subscription_analytic_project/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/subscription_analytic_project/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/subscription_analytic_project/README.rst b/subscription_analytic_project/README.rst new file mode 100644 index 0000000000..409af64f50 --- /dev/null +++ b/subscription_analytic_project/README.rst @@ -0,0 +1,82 @@ +============================= +Subscription Analytic Project +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:cd2eb920a17ef326e33d3b184d0e6687de96a04539245781796a1b0b411f2fe5 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fcontract-lightgray.png?logo=github + :target: https://github.com/OCA/contract/tree/16.0/subscription_analytic_project + :alt: OCA/contract +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-subscription_analytic_project + :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/contract&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the subscription functionality to integrate with project management. + +When a subscription line is created from a sale order line that has an associated project, +this module automatically updates the analytic distribution to use the project's analytic account. + +**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 +~~~~~~~ + +* Innovyou + +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-LorenzoC0| image:: https://github.com/LorenzoC0.png?size=40px + :target: https://github.com/LorenzoC0 + :alt: LorenzoC0 + +Current `maintainer `__: + +|maintainer-LorenzoC0| + +This module is part of the `OCA/contract `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/subscription_analytic_project/__init__.py b/subscription_analytic_project/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/subscription_analytic_project/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/subscription_analytic_project/__manifest__.py b/subscription_analytic_project/__manifest__.py new file mode 100644 index 0000000000..4c345ee070 --- /dev/null +++ b/subscription_analytic_project/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2025 Innovyou - Lorenzo Carta +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Subscription Analytic Project", + "summary": "Link subscription lines to project analytic accounts", + "version": "16.0.1.0.0", + "category": "Hidden", + "website": "https://github.com/OCA/contract", + "author": "Innovyou, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["subscription_oca", "sale_project"], + "installable": True, + "auto_install": True, + "maintainers": ["LorenzoC0"], +} diff --git a/subscription_analytic_project/models/__init__.py b/subscription_analytic_project/models/__init__.py new file mode 100644 index 0000000000..8eb9d1d404 --- /dev/null +++ b/subscription_analytic_project/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order_line diff --git a/subscription_analytic_project/models/sale_order_line.py b/subscription_analytic_project/models/sale_order_line.py new file mode 100644 index 0000000000..740dbfd895 --- /dev/null +++ b/subscription_analytic_project/models/sale_order_line.py @@ -0,0 +1,16 @@ +from odoo import models + + +class SaleSubscription(models.Model): + _inherit = "sale.order.line" + + def get_subscription_line_values(self): + res = super().get_subscription_line_values() + + if not res["analytic_distribution"]: + if self.project_id.analytic_account_id: + res["analytic_distribution"] = { + self.project_id.analytic_account_id.id: 100.0 + } + + return res diff --git a/subscription_analytic_project/readme/DESCRIPTION.rst b/subscription_analytic_project/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..ba84b27f47 --- /dev/null +++ b/subscription_analytic_project/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module extends the subscription functionality to integrate with project management. + +When a subscription line is created from a sale order line that has an associated project, +this module automatically updates the analytic distribution to use the project's analytic account. \ No newline at end of file diff --git a/subscription_analytic_project/static/description/index.html b/subscription_analytic_project/static/description/index.html new file mode 100644 index 0000000000..1b13bc38a9 --- /dev/null +++ b/subscription_analytic_project/static/description/index.html @@ -0,0 +1,420 @@ + + + + + +Subscription Analytic Project + + + +
+

Subscription Analytic Project

+ + +

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

+

This module extends the subscription functionality to integrate with project management.

+

When a subscription line is created from a sale order line that has an associated project, +this module automatically updates the analytic distribution to use the project’s analytic account.

+

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

+
    +
  • Innovyou
  • +
+
+
+

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 maintainer:

+

LorenzoC0

+

This module is part of the OCA/contract project on GitHub.

+

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

+
+
+
+ +