mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] add migration script
This commit is contained in:
committed by
Marina Alapont
parent
028d513a85
commit
6fff7b0c13
@@ -1,6 +1,6 @@
|
||||
==============================================
|
||||
Link Purchase Order to Subcontract Productions
|
||||
==============================================
|
||||
===================================================
|
||||
Link Purchase Order Line to Subcontract Productions
|
||||
===================================================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
@@ -27,7 +27,7 @@ Link Purchase Order to Subcontract Productions
|
||||
|
||||
This module does the following:
|
||||
|
||||
- Extends _prepare_subcontract_mo_vals() and adds the purchase order reference to the subcontracted manufacturing orders.
|
||||
- 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**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
{
|
||||
"name": "Link Purchase Order Line to Subcontract Productions",
|
||||
"version": "14.0.1.0.1",
|
||||
"version": "14.0.2.0.0",
|
||||
"category": "Manufacturing",
|
||||
"license": "LGPL-3",
|
||||
"author": "Quartile Limited, Odoo Community Association (OCA)",
|
||||
|
||||
@@ -64,6 +64,11 @@ msgstr ""
|
||||
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"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
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 migrate(cr, version=None):
|
||||
if not version:
|
||||
return
|
||||
update_po_line_in_mrp_production(cr)
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<title>Link Purchase Order to Subcontract Productions</title>
|
||||
<title>Link Purchase Order Line to Subcontract Productions</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
@@ -360,8 +360,8 @@ ul.auto-toc {
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="link-purchase-order-to-subcontract-productions">
|
||||
<h1 class="title">Link Purchase Order to Subcontract Productions</h1>
|
||||
<div class="document" id="link-purchase-order-line-to-subcontract-productions">
|
||||
<h1 class="title">Link Purchase Order Line to Subcontract Productions</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
@@ -370,7 +370,7 @@ ul.auto-toc {
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_purchase_link"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_subcontracting_purchase_link"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module does the following:</p>
|
||||
<ul class="simple">
|
||||
<li>Extends _prepare_subcontract_mo_vals() and adds the purchase order reference to the subcontracted manufacturing orders.</li>
|
||||
<li>Extends _prepare_subcontract_mo_vals() and adds the purchase order line reference to the subcontracted manufacturing orders.</li>
|
||||
<li>Adds an action button in the purchase order form view to open related subcontracted manufacturing orders.</li>
|
||||
</ul>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
|
||||
Reference in New Issue
Block a user