Skip to content

Commit

Permalink
Merge PR #1441 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Jan 9, 2025
2 parents f4a9d0a + 7b91bba commit 3c76e34
Show file tree
Hide file tree
Showing 23 changed files with 1,114 additions and 0 deletions.
90 changes: 90 additions & 0 deletions mrp_subcontracting_purchase_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
===================================================
Link Purchase Order Line to Subcontract Productions
===================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fcb1900c633f34a9bad831462e059fb9d5e537bd609cc618abc48e86a49175be
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/17.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-17-0/manufacture-17-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=17.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:%2017.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 <[email protected]>
- Tim Lai <[email protected]>

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

- Thiago Mulero <[email protected]>
- Jordi Ballester <[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/manufacture <https://github.com/OCA/manufacture/tree/17.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": "17.0.1.0.0",
"category": "Manufacturing",
"license": "LGPL-3",
"author": "Quartile Limited, ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"depends": ["purchase", "mrp_subcontracting"],
"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(env):
update_po_line_in_mrp_production(env.cr)
57 changes: 57 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_subcontracting_purchase_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-25 21:33+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\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,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"
57 changes: 57 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_subcontracting_purchase_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-06-29 16:47+0000\n"
"Last-Translator: mde-spring <[email protected]>\n"
"Language-Team: none\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"
"X-Generator: Weblate 4.17\n"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_mrp_production
msgid "Production Order"
msgstr "Ordre de fabrication"

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

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

#. 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 "Nombre d'ordre de fabrication de sous-traitance"

#. 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 "Ordres de fabrication de sous-traitance"

#. 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 "Bon de commande de sous-traitance"

#. 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 "Ligne de bon de commande de sous-traitance"

#. module: mrp_subcontracting_purchase_link
#: model:ir.model,name:mrp_subcontracting_purchase_link.model_stock_picking
msgid "Transfer"
msgstr "Transfert"
66 changes: 66 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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 <[email protected]>\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,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"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"
57 changes: 57 additions & 0 deletions mrp_subcontracting_purchase_link/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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,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 3c76e34

Please sign in to comment.