Skip to content
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

[15.0][mig]-purchase_request_analytic #539

Merged
merged 16 commits into from
Jul 26, 2023
Merged
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
104 changes: 104 additions & 0 deletions purchase_request_analytic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
=========================
Purchase Request 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_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-15-0/account-analytic-15-0-purchase_request_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|

This module adds the analytic account field to Purchase Requests.

**Table of contents**

.. contents::
:local:

Usage
=====

* Assign an analytic account 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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20purchase_request_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
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* Beñat Jimenez <[email protected]>
* Pimolnat Suntian <[email protected]>
* Juany Davila <[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/15.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": "15.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,
}
55 changes: 55 additions & 0 deletions purchase_request_analytic/i18n/purchase_request_analytic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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.fields,field_description:purchase_request_analytic.field_purchase_request__analytic_account_id2
msgid "Analytic Account Id2"
msgstr ""

#. module: purchase_request_analytic
#: model:ir.model.fields,field_description:purchase_request_analytic.field_purchase_request__display_name
msgid "Display Name"
msgstr ""

#. module: purchase_request_analytic
#: model:ir.model.fields,field_description:purchase_request_analytic.field_purchase_request__id
msgid "ID"
msgstr ""

#. module: purchase_request_analytic
#: model:ir.model.fields,field_description:purchase_request_analytic.field_purchase_request____last_update
msgid "Last Modified on"
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 ""

#. module: purchase_request_analytic
#: model:ir.model.fields,help:purchase_request_analytic.field_purchase_request__analytic_account_id2
msgid "Use to store the value of analytic_account if there is no lines"
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
42 changes: 42 additions & 0 deletions purchase_request_analytic/models/purchase_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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):
_inherit = "purchase.request"

analytic_account_id = fields.Many2one(
compute="_compute_analytic_account_id",
inverse="_inverse_analytic_account_id",
comodel_name="account.analytic.account",
string="Analytic Account",
readonly=True,
states={"draft": [("readonly", False)]},
store=True,
help="The analytic account related to a sales order.",
)

@api.depends("line_ids.analytic_account_id")
def _compute_analytic_account_id(self):
"""If all purchase request lines have same analytic account set
analytic_account_id
"""
for pr in self:
al = pr.analytic_account_id

Check warning on line 27 in purchase_request_analytic/models/purchase_request.py

View check run for this annotation

Codecov / codecov/patch

purchase_request_analytic/models/purchase_request.py#L27

Added line #L27 was not covered by tests
if pr.line_ids:
for prl in pr.line_ids:
if prl.analytic_account_id != al:
al = False
break
pr.analytic_account_id = al

Check warning on line 33 in purchase_request_analytic/models/purchase_request.py

View check run for this annotation

Codecov / codecov/patch

purchase_request_analytic/models/purchase_request.py#L31-L33

Added lines #L31 - L33 were not covered by tests

def _inverse_analytic_account_id(self):
"""If analytic_account is set on PR, propagate it to all purchase
request lines
"""
for pr in self:
if pr.analytic_account_id:
for line in pr.line_ids:
line.analytic_account_id = pr.analytic_account_id.id
3 changes: 3 additions & 0 deletions purchase_request_analytic/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Beñat Jimenez <[email protected]>
* Pimolnat Suntian <[email protected]>
* Juany Davila <[email protected]>
1 change: 1 addition & 0 deletions purchase_request_analytic/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the analytic account field to Purchase Requests.
20 changes: 20 additions & 0 deletions purchase_request_analytic/readme/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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.
1 change: 1 addition & 0 deletions purchase_request_analytic/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Assign an analytic account 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
Loading