-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by AaronHForgeFlow
- Loading branch information
Showing
18 changed files
with
923 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
================= | ||
Purchase Analytic | ||
================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/15.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-15-0/account-analytic-15-0-purchase_analytic | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/87/15.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
The goal of this module is to ease analytic account management on purchase order. | ||
This module add analytic account on purchase order. | ||
|
||
If all lines of the purchase order have the same analytic account, the analytic account on the purchase order is automatically set with this value. | ||
If a analytic account is set on the purchase order, all lines of the purchase will take this value. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Changelog | ||
========= | ||
|
||
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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20purchase_analytic%0Aversion:%2015.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 | ||
|
||
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/15.0/purchase_analytic>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "15.0.1.0.0", | ||
"author": "Acsone SA/NV, Odoo Community Association (OCA)", | ||
"category": "Purchase Management", | ||
"website": "https://github.com/OCA/account-analytic", | ||
"depends": ["purchase"], | ||
"data": ["views/purchase_views.xml"], | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"application": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# 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" | ||
"Last-Translator: Automatically generated\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" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__project_id | ||
msgid "Contract / Analytic" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__project_id2 | ||
msgid "Project Id2" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,help:purchase_analytic.field_purchase_order__project_id | ||
msgid "The analytic account related to a sales order." | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,help:purchase_analytic.field_purchase_order__project_id2 | ||
msgid "Use to store the value of project_id if there is no lines" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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: 2016-04-07 08:25+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"Language: \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__project_id | ||
msgid "Contract / Analytic" | ||
msgstr "Contrat / analytique" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__project_id2 | ||
msgid "Project Id2" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "Bon de commande" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,help:purchase_analytic.field_purchase_order__project_id | ||
msgid "The analytic account related to a sales order." | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,help:purchase_analytic.field_purchase_order__project_id2 | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 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" | ||
"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__project_id | ||
msgid "Contract / Analytic" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,field_description:purchase_analytic.field_purchase_order__project_id2 | ||
msgid "Project Id2" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model,name:purchase_analytic.model_purchase_order | ||
msgid "Purchase Order" | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,help:purchase_analytic.field_purchase_order__project_id | ||
msgid "The analytic account related to a sales order." | ||
msgstr "" | ||
|
||
#. module: purchase_analytic | ||
#: model:ir.model.fields,help:purchase_analytic.field_purchase_order__project_id2 | ||
msgid "Use to store the value of project_id if there is no lines" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import purchase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# © 2016 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class PurchaseOrder(models.Model): | ||
_inherit = "purchase.order" | ||
|
||
project_id2 = fields.Many2one( | ||
comodel_name="account.analytic.account", | ||
help="Use to store the value of project_id if there is no lines", | ||
) | ||
project_id = fields.Many2one( | ||
compute="_compute_project_id", | ||
inverse="_inverse_project_id", | ||
comodel_name="account.analytic.account", | ||
string="Contract / Analytic", | ||
readonly=True, | ||
states={"draft": [("readonly", False)]}, | ||
store=True, | ||
help="The analytic account related to a sales order.", | ||
) | ||
|
||
@api.depends("order_line.account_analytic_id") | ||
def _compute_project_id(self): | ||
"""If all order line have same analytic account set project_id""" | ||
for po in self: | ||
al = po.project_id2 | ||
if po.order_line: | ||
al = po.order_line[0].account_analytic_id or False | ||
for ol in po.order_line: | ||
if ol.account_analytic_id != al: | ||
al = False | ||
break | ||
po.project_id = al | ||
|
||
def _inverse_project_id(self): | ||
"""When set project_id set analytic account on all order lines""" | ||
for po in self: | ||
if po.project_id: | ||
po.order_line.write({"account_analytic_id": po.project_id.id}) | ||
po.project_id2 = po.project_id | ||
|
||
@api.onchange("project_id") | ||
def _onchange_project_id(self): | ||
"""When change project_id set analytic account on all order lines | ||
Do it in one operation to avoid to recompute the project_id field | ||
during the change. | ||
In case of new record, nothing is recomputed to avoid ugly message | ||
""" | ||
r = [] | ||
for ol in self.order_line: | ||
if isinstance(ol.id, int): | ||
r.append((1, ol.id, {"account_analytic_id": self.project_id.id})) | ||
else: | ||
# this is new record, do nothing ! | ||
return | ||
self.project_id2 = self.project_id | ||
self.order_line = r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* Laetitia Gangloff <[email protected]> | ||
* Cédric Pigeon <[email protected]> | ||
* Pimolnat Suntian <[email protected]> | ||
* `Jarsa <https://www.jarsa.com>`_ | ||
|
||
* Alan Ramos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The goal of this module is to ease analytic account management on purchase order. | ||
This module add analytic account on purchase order. | ||
|
||
If all lines of the purchase order have the same analytic account, the analytic account on the purchase order is automatically set with this value. | ||
If a analytic account is set on the purchase order, all lines of the purchase will take this value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.