Skip to content

Commit

Permalink
Merge PR #722 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by hveficent
  • Loading branch information
OCA-git-bot committed Nov 26, 2019
2 parents 44c5c17 + 531bed0 commit 1830c5a
Show file tree
Hide file tree
Showing 19 changed files with 886 additions and 0 deletions.
76 changes: 76 additions & 0 deletions purchase_request_order_approved/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
===============================
Purchase Request Order Approved
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_request_order_approved
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_request_order_approved
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/142/12.0
:alt: Try me on Runbot

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

This module computes the new PO state 'Approved' related to a Purchase
Request Line to display it in the Purchase Request Line tree view and adds a
'Purchase Approved' filter.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/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/purchase-workflow/issues/new?body=module:%20purchase_request_order_approved%0Aversion:%2012.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
~~~~~~~

* Eficent

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

* Gisela Mora <gisela.mora@eficent.com>
* Lois Rilo <lois.rilo@eficent.com>

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/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/12.0/purchase_request_order_approved>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions purchase_request_order_approved/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .init_hook import post_init_hook
22 changes: 22 additions & 0 deletions purchase_request_order_approved/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).

{
"name": "Purchase Request Order Approved",
"author": "Eficent, "
"Odoo Community Association (OCA)",
"version": "12.0.1.0.0",
"website": "https://github.com/OCA/purchase-workflow",
"category": "Purchase Management",
"depends": [
"purchase_request",
"purchase_order_approved",
],
"data": [
"views/purchase_request_view.xml",
],
"license": 'LGPL-3',
"installable": True,
"post_init_hook": 'post_init_hook',
"auto_install": True,
}
34 changes: 34 additions & 0 deletions purchase_request_order_approved/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request_to_rfq_order_approved
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-13 03:10+0000\n"
"PO-Revision-Date: 2017-06-13 03:10+0000\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>, 2017\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "At least a Purchase Order has been approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "Purchase Approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.model,name:purchase_request_order_approved.model_purchase_request_line
msgid "Purchase Request Line"
msgstr "Línea de petición de compra"
34 changes: 34 additions & 0 deletions purchase_request_order_approved/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request_to_rfq_order_approved
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-13 03:10+0000\n"
"PO-Revision-Date: 2017-06-13 03:10+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\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"

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "At least a Purchase Order has been approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "Purchase Approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.model,name:purchase_request_order_approved.model_purchase_request_line
msgid "Purchase Request Line"
msgstr "Ligne de demande d'achat"
32 changes: 32 additions & 0 deletions purchase_request_order_approved/i18n/nl_NL.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request_order_approved
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-05-29 15:20+0000\n"
"Last-Translator: Cas Vissers <c.vissers@brahoo.nl>\n"
"Language-Team: none\n"
"Language: nl_NL\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 3.6.1\n"

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "At least a Purchase Order has been approved"
msgstr "Tenminste een inkooporder is goedgekeurd"

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "Purchase Approved"
msgstr "Inkoop goedgekeurd"

#. module: purchase_request_order_approved
#: model:ir.model,name:purchase_request_order_approved.model_purchase_request_line
msgid "Purchase Request Line"
msgstr "Inkoopaanvraagregel"
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_order_approved
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.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_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "At least a Purchase Order has been approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "Purchase Approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.model,name:purchase_request_order_approved.model_purchase_request_line
msgid "Purchase Request Line"
msgstr ""

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_to_rfq_order_approved
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.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_to_rfq_order_approved
#: model:ir.ui.view,arch_db:purchase_request_to_rfq_order_approved.purchase_request_line_search
msgid "At least a Purchase Order has been approved"
msgstr ""

#. module: purchase_request_to_rfq_order_approved
#: model:ir.ui.view,arch_db:purchase_request_to_rfq_order_approved.purchase_request_line_search
msgid "Purchase Approved"
msgstr ""

#. module: purchase_request_to_rfq_order_approved
#: model:ir.model,name:purchase_request_to_rfq_order_approved.model_purchase_request_line
msgid "Purchase Request Line"
msgstr ""

35 changes: 35 additions & 0 deletions purchase_request_order_approved/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request_to_rfq_order_approved
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-13 03:10+0000\n"
"PO-Revision-Date: 2017-06-13 03:10+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "At least a Purchase Order has been approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.ui.view,arch_db:purchase_request_order_approved.purchase_request_line_search
msgid "Purchase Approved"
msgstr ""

#. module: purchase_request_order_approved
#: model:ir.model,name:purchase_request_order_approved.model_purchase_request_line
msgid "Purchase Request Line"
msgstr "Postavka zahteve po nabavi"
34 changes: 34 additions & 0 deletions purchase_request_order_approved/init_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import logging


logger = logging.getLogger(__name__)


def post_init_hook(cr, registry):
"""
The objective of this hook is to update the field purchase_state in
existing purchase request lines
"""
update_field_purchase_state(cr)


def update_field_purchase_state(cr):

logger.info('Updating field purchase_state on purchase_request_line')

cr.execute(
"""
UPDATE purchase_request_line prl
SET purchase_state = 'approved'
FROM purchase_request_purchase_order_line_rel AS prpol
JOIN purchase_order_line AS pol
ON pol.id = prpol.purchase_order_line_id
JOIN purchase_order AS po
ON po.id = pol.order_id
WHERE prpol.purchase_request_line_id = prl.id
AND po.state = 'approved'
"""
)
1 change: 1 addition & 0 deletions purchase_request_order_approved/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_request
20 changes: 20 additions & 0 deletions purchase_request_order_approved/models/purchase_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).

from odoo import api, models


class PurchaseRequestLine(models.Model):
_inherit = "purchase.request.line"

@api.multi
@api.depends('purchase_lines', 'purchase_lines.order_id.state')
def _compute_purchase_state(self):
super(PurchaseRequestLine, self)._compute_purchase_state()
for rec in self:
if rec.purchase_lines:
if any([po_line.state == 'approved' for po_line in
rec.purchase_lines]) and not any(
[po_line.state in ['purchase', 'done'] for po_line in
rec.purchase_lines]):
rec.purchase_state = 'approved'
2 changes: 2 additions & 0 deletions purchase_request_order_approved/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Gisela Mora <gisela.mora@eficent.com>
* Lois Rilo <lois.rilo@eficent.com>
3 changes: 3 additions & 0 deletions purchase_request_order_approved/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module computes the new PO state 'Approved' related to a Purchase
Request Line to display it in the Purchase Request Line tree view and adds a
'Purchase Approved' filter.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1830c5a

Please sign in to comment.