Skip to content

Commit

Permalink
Merge PR #1262 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Aug 5, 2024
2 parents 1791091 + 08a761d commit 711b6c3
Show file tree
Hide file tree
Showing 22 changed files with 1,096 additions and 0 deletions.
88 changes: 88 additions & 0 deletions mrp_subcontracting_purchase_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
===================================================
Link Purchase Order Line to Subcontract Productions
===================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:074986a18935844303cc29216277c6fd630f383750f4ef24800ab0cf07c6a4c3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_purchase_link
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_subcontracting_purchase_link
: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/manufacture&target_branch=14.0
:alt: Try me on Runboat

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

This module does the following:

- Extends _prepare_subcontract_mo_vals() and adds the purchase order line reference to the subcontracted manufacturing orders.
- Adds an action button in the purchase order form view to open related subcontracted manufacturing orders.

**Table of contents**

.. contents::
:local:

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

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

* Quartile Limited
* ForgeFlow

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

* `Quartile Limited <https://www.quartile.co>`__:

* Yoshi Tashiro <tashiro@quartile.co>
* Tim Lai <tl@quartile.com>

* `ForgeFlow <https://www.forgeflow.com>`__:

* Thiago Mulero <thuago.mulero@forgeflow.com>
* Jordi Ballester <jordi.ballester@forgeflow.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/manufacture <https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_purchase_link>`_ 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 mrp_subcontracting_purchase_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook
14 changes: 14 additions & 0 deletions mrp_subcontracting_purchase_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Link Purchase Order Line to Subcontract Productions",
"version": "15.0.1.0.0",
"category": "Manufacturing",
"license": "LGPL-3",
"author": "Quartile Limited, ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"depends": ["mrp_subcontracting_purchase"],
"data": ["views/purchase_order_views.xml", "views/mrp_production_views.xml"],
"post_init_hook": "post_init_hook",
"installable": True,
}
39 changes: 39 additions & 0 deletions mrp_subcontracting_purchase_link/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2023 ForgeFlow, S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import logging

_logger = logging.getLogger(__name__)


def update_po_line_in_mrp_production(cr):
""" """
_logger.info("Updating PO line in MRP production")
cr.execute(
"""
UPDATE mrp_production
SET
purchase_line_id = Q.purchase_line_id,
purchase_order_id = Q.purchase_id
FROM (
SELECT po_sm.purchase_line_id, mo_sm.production_id, po.id as purchase_id
FROM stock_move as po_sm
INNER JOIN stock_move_move_rel as rel
ON rel.move_dest_id = po_sm.id
INNER JOIN stock_move as mo_sm
ON mo_sm.id = rel.move_orig_id
INNER JOIN purchase_order_line as pol
ON pol.id = po_sm.purchase_line_id
INNER JOIN purchase_order as po
ON po.id = pol.order_id
where po_sm.is_subcontract = true
AND po_sm.purchase_line_id is not null
AND mo_sm.production_id is not null
) AS Q
WHERE mrp_production.id = Q.production_id
"""
)


def post_init_hook(cr, registry):
update_po_line_in_mrp_production(cr)
78 changes: 78 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_subcontracting_purchase_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-23 00:01+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__display_name
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__display_name
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking__display_name
msgid "Display Name"
msgstr "Mostrar Nombre"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__id
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__id
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking__id
msgid "ID"
msgstr "ID"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production____last_update
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order____last_update
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking____last_update
msgid "Last Modified on"
msgstr "Última Modificación el"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_mrp_production
msgid "Production Order"
msgstr "Orden de Producción"

#. module: mrp_subcontracting_purchase_link
#: model_terms:ir.ui.view,arch_db:mrp_subcontracting_purchase_link.purchase_order_form
msgid "Productions"
msgstr "Producciones"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_purchase_order
msgid "Purchase Order"
msgstr "Orden de Compra"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__subcontract_production_count
msgid "Subcontract Production Count"
msgstr "Recuento de la Producción Subcontratada"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__subcontract_production_ids
msgid "Subcontract Production Orders"
msgstr "Órdenes de Fabricación de Subcontratas"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__purchase_order_id
msgid "Subcontract Purchase Order"
msgstr "Orden de Compra de Subcontratación"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__purchase_line_id
msgid "Subcontract Purchase Order Line"
msgstr "Línea de Orden de Compra de Subcontratación"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_stock_picking
msgid "Transfer"
msgstr "Transferencia"
78 changes: 78 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_subcontracting_purchase_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-08 22:23+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__display_name
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__display_name
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__id
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__id
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking__id
msgid "ID"
msgstr "ID"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production____last_update
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order____last_update
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_mrp_production
msgid "Production Order"
msgstr "Ordine di produzione"

#. module: mrp_subcontracting_purchase_link
#: model_terms:ir.ui.view,arch_db:mrp_subcontracting_purchase_link.purchase_order_form
msgid "Productions"
msgstr "Produzioni"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_purchase_order
msgid "Purchase Order"
msgstr "Ordine di acquisto"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__subcontract_production_count
msgid "Subcontract Production Count"
msgstr "Conteggio produzione terzisti"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__subcontract_production_ids
msgid "Subcontract Production Orders"
msgstr "Ordini produzione terzisti"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__purchase_order_id
msgid "Subcontract Purchase Order"
msgstr "Ordine produzione terzisti"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__purchase_line_id
msgid "Subcontract Purchase Order Line"
msgstr "Riga ordine acquisto terzista"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_stock_picking
msgid "Transfer"
msgstr "Trasferimento"
78 changes: 78 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_subcontracting_purchase_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-13 08:00+0000\n"
"PO-Revision-Date: 2020-10-13 08:00+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: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__display_name
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__display_name
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking__display_name
msgid "Display Name"
msgstr ""

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__id
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__id
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking__id
msgid "ID"
msgstr ""

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production____last_update
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order____last_update
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_stock_picking____last_update
msgid "Last Modified on"
msgstr ""

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_mrp_production
msgid "Production Order"
msgstr "製造"

#. module: mrp_subcontracting_purchase_link
#: model_terms:ir.ui.view,arch_db:mrp_subcontracting_purchase_link.purchase_order_form
msgid "Productions"
msgstr "製造"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_purchase_order
msgid "Purchase Order"
msgstr "購買オーダ"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__subcontract_production_count
msgid "Subcontract Production Count"
msgstr ""

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_purchase_order__subcontract_production_ids
msgid "Subcontract Production Orders"
msgstr "製造"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__purchase_order_id
msgid "Subcontract Purchase Order"
msgstr "外注加工購買オーダ"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model.fields,field_description:mrp_subcontracting_purchase_link.field_mrp_production__purchase_line_id
msgid "Subcontract Purchase Order Line"
msgstr ""

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_stock_picking
msgid "Transfer"
msgstr "運送"
Loading

0 comments on commit 711b6c3

Please sign in to comment.