-
-
Notifications
You must be signed in to change notification settings - Fork 370
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][mig] purchase_analytic #707
base: 17.0
Are you sure you want to change the base?
Changes from all commits
bbaf49e
25ea752
4223423
9324f28
6a88e54
36683af
8ceb316
dc2f836
46480ff
03aa83e
c496b41
e78a380
232da31
577e18c
dd867e1
508cf05
c4b357b
7d97a88
086d1e0
33abf0d
5f777ac
2f3bc9a
aae4f08
8da0448
e69fafd
5859849
eeacecd
0fab286
8dd3e5f
1870f06
632697a
c09a8aa
c35aee5
e4e3bf0
e82d3c5
05afc0d
24f6ed0
8dd9c63
40cdceb
2e8c97f
73a3697
3a99e36
8e64cf8
c729dbc
1cae1c8
31fcdc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
================= | ||
Purchase Analytic | ||
================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:29e780dfe7855cc5a36aa1348802e5d1035bffb39eb3825103ed2a4fa61f4ada | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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/17.0/purchase_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-17-0/account-analytic-17-0-purchase_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=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
The goal of this module is to ease analytic distribution management on | ||
purchase order. This module add analytic distribution on purchase order. | ||
|
||
If all lines of the purchase order have the same analytic distribution, | ||
the analytic distribution on the purchase order is automatically set | ||
with this value. If a analytic distribution is set on the purchase | ||
order, all lines of the purchase will take this value. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Changelog | ||
========= | ||
|
||
16.0.1.0.0 (2023-01-16) | ||
----------------------- | ||
|
||
Migrated to odoo 16. | ||
|
||
15.0.1.0.0 (2022-05-17) | ||
----------------------- | ||
|
||
Migrated to odoo 15. | ||
|
||
13.0.1.0.0 (2020-01-08) | ||
----------------------- | ||
|
||
Migrated to odoo 13. | ||
|
||
12.0.1.0.0 (2019-10-23) | ||
----------------------- | ||
|
||
Migrated to odoo 12. | ||
|
||
10.0.1.0.0 (2017-05-11) | ||
----------------------- | ||
|
||
Migrated to odoo 10. | ||
|
||
8.0.1.0.0 (2016-04-22) | ||
---------------------- | ||
|
||
First version. | ||
|
||
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:%20purchase_analytic%0Aversion:%2017.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 | ||
------- | ||
|
||
* 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 | ||
|
||
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/account-analytic <https://github.com/OCA/account-analytic/tree/17.0/purchase_analytic>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# © 2016 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Purchase Analytic", | ||
"version": "17.0.1.0.0", | ||
"author": "Acsone SA/NV, Odoo Community Association (OCA)", | ||
"category": "Purchase Management", | ||
"website": "https://github.com/OCA/account-analytic", | ||
"depends": ["purchase", "base_view_inheritance_extension"], | ||
"data": ["views/purchase_views.xml"], | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"application": False, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * purchase_analytic | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-07-11 10:10+0000\n" | ||
"Last-Translator: Ivorra78 <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution | ||
msgid "Analytic" | ||
msgstr "Analítico" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution_search | ||
msgid "Analytic Distribution Search" | ||
msgstr "Búsqueda de distribución analítica" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_precision | ||
msgid "Analytic Precision" | ||
msgstr "Precisión analítica" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "Pedido de Compra" | ||
|
||
#~ msgid "Analytic Account" | ||
#~ msgstr "Cuenta Analítica" | ||
|
||
#~ msgid "The analytic account related to a purchase order." | ||
#~ msgstr "La cuenta analítica relacionada al pedido de compra." |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * purchase_analytic | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-04-07 08:25+0000\n" | ||
"PO-Revision-Date: 2023-05-15 18:34+0000\n" | ||
"Last-Translator: Sandrine (ACSONE) <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: fr\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n > 1;\n" | ||
"X-Generator: Weblate 4.14.1\n" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution | ||
msgid "Analytic" | ||
msgstr "Analytique" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution_search | ||
msgid "Analytic Distribution Search" | ||
msgstr "Recherche de distribution analytique" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_precision | ||
msgid "Analytic Precision" | ||
msgstr "Précision analytique" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "Bon de commande" | ||
|
||
#~ msgid "Analytic Account" | ||
#~ msgstr "Compte analytique" | ||
|
||
#~ msgid "The analytic account related to a purchase order." | ||
#~ msgstr "Le compte analytique lié à un bon de commande." | ||
|
||
#~ msgid "Contract / Analytic" | ||
#~ msgstr "Contrat / analytique" | ||
|
||
#~ msgid "Use to store the value of project_id if there is no lines" | ||
#~ msgstr "" | ||
#~ "Utilisé pour stocker la valeur du champs project_id lorsqu'il n'y a pas " | ||
#~ "de lignes" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * purchase_analytic | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-02-16 14:23+0000\n" | ||
"Last-Translator: Bole <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: hr\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" | ||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" | ||
"X-Generator: Weblate 4.14.1\n" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution | ||
msgid "Analytic" | ||
msgstr "Analitika" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution_search | ||
msgid "Analytic Distribution Search" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_precision | ||
msgid "Analytic Precision" | ||
msgstr "Preciznost analitike" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "Nalog za nabavu" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * purchase_analytic | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-06-14 20:09+0000\n" | ||
"Last-Translator: Adriano Prado <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: pt_BR\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n > 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution | ||
msgid "Analytic" | ||
msgstr "Analítica" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution_search | ||
msgid "Analytic Distribution Search" | ||
msgstr "Pesquisa Distribuição Analítica" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_precision | ||
msgid "Analytic Precision" | ||
msgstr "Precisão Analítica" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "Pedido de Compra" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Translation of Odoo Server. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are missing commits present in 16.0, mainly related to translations, e.g. de8e27f. I'd suggest retrieving the history again and then cherrypicking the migration commits. |
||
# This file contains the translation of the following modules: | ||
# * purchase_analytic | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \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: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution | ||
msgid "Analytic" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_distribution_search | ||
msgid "Analytic Distribution Search" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__analytic_precision | ||
msgid "Analytic Precision" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import purchase |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# © 2016 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu) | ||
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class PurchaseOrder(models.Model): | ||
_name = "purchase.order" | ||
_inherit = ["purchase.order", "analytic.mixin"] | ||
|
||
analytic_distribution = fields.Json(inverse="_inverse_analytic_distribution") | ||
|
||
@api.depends("order_line.analytic_distribution") | ||
def _compute_analytic_distribution(self): | ||
"""If all order line have same analytic distribution set analytic_distribution. | ||
If no lines, respect value given by the user. | ||
""" | ||
for po in self: | ||
if po.order_line: | ||
al = po.order_line[0].analytic_distribution or False | ||
for ol in po.order_line: | ||
if ol.analytic_distribution != al: | ||
al = False | ||
break | ||
po.analytic_distribution = al | ||
|
||
def _inverse_analytic_distribution(self): | ||
""" | ||
When set analytic_distribution set analytic distribution on all order lines | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "when setting Same in the below docstring. |
||
""" | ||
for po in self: | ||
if po.analytic_distribution: | ||
po.order_line.write({"analytic_distribution": po.analytic_distribution}) | ||
|
||
@api.onchange("analytic_distribution") | ||
def _onchange_analytic_distribution(self): | ||
""" | ||
When change analytic_distribution set analytic distribution on all order lines | ||
""" | ||
if self.analytic_distribution: | ||
self.order_line.update( | ||
{"analytic_distribution": self.analytic_distribution} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't fixing double spaces part of the changes performed by precommit?
I mean: