Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a53297c
[10.0][ADD] purchase_request_analytic: Add analytic account to Purcha…
bjeficent Apr 29, 2019
438a1fa
[FIX]do not restrict picking type for analytic.
AaronHForgeFlow May 9, 2019
4259b70
[UPD] Update purchase_request_analytic.pot
oca-travis Oct 29, 2019
9190565
[ADD] icon.png
OCA-git-bot Oct 29, 2019
a2b5521
[MIG] purchase_request_analytic: Migration to 12.0
MiquelRForgeFlow Oct 29, 2019
bc03830
[UPD] Update purchase_request_analytic.pot
oca-travis Nov 5, 2019
45735e1
[UPD] README.rst
OCA-git-bot Nov 5, 2019
fbafc2d
[IMP] purchase_request_analytic: black, isort
ps-tubtim Jan 8, 2020
d823bb8
[MIG] purchase_request_analytic: Migration to 13.0
ps-tubtim Mar 24, 2020
db0e1f6
[UPD] Update purchase_request_analytic.pot
oca-travis Dec 2, 2021
7530d1a
[IMP] purchase_request_analytic: black, isort, prettier
May 18, 2022
9a40158
[MIG] purchase_request_analytic: Migration to 14.0
May 18, 2022
2aeaed1
[UPD] Update purchase_request_analytic.pot
May 20, 2022
c394d27
[UPD] README.rst
OCA-git-bot May 20, 2022
7596b08
[MIG] purchase_request_analytic: Migration to 15.0
Jun 21, 2022
377f5ef
[UPD] Update purchase_request_analytic.pot
Jul 26, 2023
6c81830
[UPD] README.rst
OCA-git-bot Jul 26, 2023
2944881
[UPD] README.rst
OCA-git-bot Sep 3, 2023
9845d3a
[FIX] purchase_request_analytic: fill analytic account id in the purc…
AaronHForgeFlow Mar 19, 2024
ddb1a76
[BOT] post-merge updates
OCA-git-bot Jul 4, 2024
cb9f523
[IMP] purchase_request_analytic: pre-commit auto fixes
StefanRijnhart Jul 4, 2024
5042826
[MIG] purchase_request_analytic: Migration to 17.0
StefanRijnhart Jul 8, 2024
5382640
[MIG] purchase_request_analytic: Migration to 18.0
dreispt Jun 2, 2025
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
109 changes: 109 additions & 0 deletions purchase_request_analytic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
=========================
Purchase Request Analytic
=========================

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

.. |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/purchase_request_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-purchase_request_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|

This module adds an analytic distribution field to Purchase Requests.
The field serves as a default for new lines on a request.

**Table of contents**

.. contents::
:local:

Usage
=====

- Assign an analytic distribution to the purchase request or to
purchase request lines.

Changelog
=========

13.0.1.0.0 (2020-01-08)
-----------------------

Migrated to odoo 13.

12.0.1.0.0 (2019-10-30)
-----------------------

Migrated to odoo 12.

10.0.1.0.1 (2019-05-09)
-----------------------

[FIX] Do not restrict picking type for analytic. [IMP] Add tests.

10.0.1.0.0 (2019-04-29)
-----------------------

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_request_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
-------

* ForgeFlow

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

- Beñat Jimenez <[email protected]>
- Pimolnat Suntian <[email protected]>
- Juany Davila <[email protected]>
- Daniel Reis <[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.

This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/18.0/purchase_request_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 purchase_request_analytic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions purchase_request_analytic/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Purchase Request Analytic",
"version": "18.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Purchase Management",
"website": "https://github.com/OCA/account-analytic",
"depends": ["purchase_request"],
"data": ["views/purchase_request_views.xml"],
"license": "AGPL-3",
"installable": True,
}
30 changes: 30 additions & 0 deletions purchase_request_analytic/i18n/purchase_request_analytic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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_request_analytic
#: model:ir.model.fields,field_description:purchase_request_analytic.field_purchase_request__analytic_account_id
#: model_terms:ir.ui.view,arch_db:purchase_request_analytic.view_purchase_request_search
msgid "Analytic Account"
msgstr ""

#. module: purchase_request_analytic
#: model:ir.model,name:purchase_request_analytic.model_purchase_request
msgid "Purchase Request"
msgstr ""

#. module: purchase_request_analytic
#: model:ir.model.fields,help:purchase_request_analytic.field_purchase_request__analytic_account_id
msgid "The analytic account related to a sales order."
msgstr ""
1 change: 1 addition & 0 deletions purchase_request_analytic/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_request
41 changes: 41 additions & 0 deletions purchase_request_analytic/models/purchase_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2019 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class PurchaseRequest(models.Model):
_name = "purchase.request"
_inherit = ["analytic.mixin", "purchase.request"]

analytic_distribution = fields.Json(
inverse="_inverse_analytic_distribution",
help="The default distribution for new lines on this request",
)

@api.depends("line_ids.analytic_distribution")
def _compute_analytic_distribution(self):
"""Take the distribution that is already set on all of our lines."""
for pr in self:
al = pr.analytic_distribution
if pr.line_ids:
first_line_analytic_distribution = pr.line_ids[0].analytic_distribution
all_lines_same = all(
prl.analytic_distribution == first_line_analytic_distribution
for prl in pr.line_ids
)
# If all lines share the same analytic_distribution,
# set it to the purchase request.
if all_lines_same:
pr.analytic_distribution = first_line_analytic_distribution
continue
for prl in pr.line_ids:
if prl.analytic_distribution != al:
al = False
break
pr.analytic_distribution = al

def _inverse_analytic_distribution(self):
"""Set this requests's distribution on all of its lines."""
for pr in self.filtered("analytic_distribution"):
pr.line_ids.analytic_distribution = pr.analytic_distribution
3 changes: 3 additions & 0 deletions purchase_request_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"
4 changes: 4 additions & 0 deletions purchase_request_analytic/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Beñat Jimenez \<<[email protected]>\>
- Pimolnat Suntian \<<[email protected]>\>
- Juany Davila \<<[email protected]>\>
- Daniel Reis \<<[email protected]>\>
2 changes: 2 additions & 0 deletions purchase_request_analytic/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds an analytic distribution field to Purchase Requests. The field
serves as a default for new lines on a request.
15 changes: 15 additions & 0 deletions purchase_request_analytic/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 13.0.1.0.0 (2020-01-08)

Migrated to odoo 13.

## 12.0.1.0.0 (2019-10-30)

Migrated to odoo 12.

## 10.0.1.0.1 (2019-05-09)

\[FIX\] Do not restrict picking type for analytic. \[IMP\] Add tests.

## 10.0.1.0.0 (2019-04-29)

First version.
3 changes: 3 additions & 0 deletions purchase_request_analytic/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Assign an analytic distribution to the purchase request or to purchase
request lines.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading