Skip to content
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
106 changes: 106 additions & 0 deletions sale_analytic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
=============
Sale Analytic
=============

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

.. |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%2Faccount--analytic-lightgray.png?logo=github
:target: https://github.com/OCA/account-analytic/tree/18.0/sale_analytic
:alt: OCA/account-analytic
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-sale_analytic
: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/account-analytic&target_branch=18.0
:alt: Try me on Runboat

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

The goal of this module is to ease analytic distribution management on
sale order. This module add analytic distribution on sale order.

If all lines of the sale order have the same analytic distribution, the
analytic distribution on the sale order is automatically set with this
value. If a analytic distribution is set on the sale order, all lines of
the sale will take this value.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/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/account-analytic/issues/new?body=module:%20sale_analytic%0Aversion:%2018.0%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
-------

* Exo Software
* Acsone SA/NV

Contributors
------------

- Laetitia Gangloff <[email protected]>
- Cédric Pigeon <[email protected]>
- Pimolnat Suntian <[email protected]>
- `Jarsa <https://www.jarsa.com>`__

- Alan Ramos

- Lois Rilo <[email protected]>
- `Quartile <https://www.quartile.co>`__:

- Aung Ko Ko Lin

- `Exo Software <https://www.exosoftware.pt>`__:

- André Leite <[email protected]>
- Fábio Paiva <[email protected]>

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-andrel-exo| image:: https://github.com/andrel-exo.png?size=40px
:target: https://github.com/andrel-exo
:alt: andrel-exo

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-andrel-exo|

This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/18.0/sale_analytic>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_analytic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions sale_analytic/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# © 2016 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Sale Analytic",
"version": "18.0.1.0.0",
"author": "Exo Software, Acsone SA/NV, Odoo Community Association (OCA)",
"category": "Sale Management",
"website": "https://github.com/OCA/account-analytic",
"depends": ["sale", "base_view_inheritance_extension"],
"data": ["views/sale_order_views.xml"],
"license": "AGPL-3",
"installable": True,
"application": False,
"maintainers": ["andrel-exo"],
}
36 changes: 36 additions & 0 deletions sale_analytic/i18n/sale_analytic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-08-29 08:21+0000\n"
"PO-Revision-Date: 2025-08-29 08:21+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_analytic
#: model:ir.model.fields,field_description:sale_analytic.field_sale_order__analytic_distribution
msgid "Analytic Distribution"
msgstr ""

#. module: sale_analytic
#: model:ir.model.fields,field_description:sale_analytic.field_sale_order__analytic_precision
msgid "Analytic Precision"
msgstr ""

#. module: sale_analytic
#: model:ir.model.fields,field_description:sale_analytic.field_sale_order__distribution_analytic_account_ids
msgid "Distribution Analytic Account"
msgstr ""

#. module: sale_analytic
#: model:ir.model,name:sale_analytic.model_sale_order
msgid "Sales Order"
msgstr ""
1 change: 1 addition & 0 deletions sale_analytic/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
37 changes: 37 additions & 0 deletions sale_analytic/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from odoo import api, fields, models


class SaleOrder(models.Model):
_name = "sale.order"
_inherit = ["sale.order", "analytic.mixin"]

analytic_distribution = fields.Json(inverse="_inverse_analytic_distribution")

@api.depends("order_line.analytic_distribution")
def _compute_analytic_distribution(self):
"""If all lines have the same analytic distribution, set it on the order.

If no lines exist, respect the value given by the user.
"""
for so in self:
if so.order_line:
al = so.order_line[0].analytic_distribution or False
for ol in so.order_line:
if ol.analytic_distribution != al:
al = False
break
so.analytic_distribution = al

def _inverse_analytic_distribution(self):
"""When setting the analytic distribution`, apply it to all order lines."""
for so in self:
if so.analytic_distribution:
so.order_line.write({"analytic_distribution": so.analytic_distribution})

@api.onchange("analytic_distribution")
def _onchange_analytic_distribution(self):
"""When changing the analytic distribution, apply it to all order lines."""
if self.analytic_distribution:
self.order_line.update(
{"analytic_distribution": self.analytic_distribution}
)
3 changes: 3 additions & 0 deletions sale_analytic/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
11 changes: 11 additions & 0 deletions sale_analytic/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- Laetitia Gangloff \<<[email protected]>\>
- Cédric Pigeon \<<[email protected]>\>
- Pimolnat Suntian \<<[email protected]>\>
- [Jarsa](https://www.jarsa.com)
- Alan Ramos
- Lois Rilo \<<[email protected]>\>
- [Quartile](https://www.quartile.co):
- Aung Ko Ko Lin
- [Exo Software](https://www.exosoftware.pt):
- André Leite \<<[email protected]>\>
- Fábio Paiva \<<[email protected]>\>
7 changes: 7 additions & 0 deletions sale_analytic/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The goal of this module is to ease analytic distribution management on
sale order. This module add analytic distribution on sale order.

If all lines of the sale order have the same analytic distribution,
the analytic distribution on the sale order is automatically set
with this value. If a analytic distribution is set on the sale
order, all lines of the sale will take this value.
Binary file added sale_analytic/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading