Skip to content

Commit

Permalink
[MIG] repair_type: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Jul 8, 2024
1 parent c2b6153 commit ef54e99
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 370 deletions.
5 changes: 5 additions & 0 deletions repair_type/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ Contributors

- Bernat Puig <[email protected]>

- `APSL-Nagarro <https://apsl.tech>`__:

- Antoni Marroig <[email protected]>
- Miquel Alzanillas <[email protected]>>

Maintainers
-----------

Expand Down
6 changes: 2 additions & 4 deletions repair_type/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@

{
"name": "Repair Type",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/repair",
"summary": "Repair type",
"category": "Repair",
"depends": ["repair"],
"data": [
"views/repair.xml",
"views/repair_type.xml",
"security/ir.model.access.csv",
"views/stock_picking_type_views.xml",
],
"installable": True,
"development_status": "Alpha",
Expand Down
54 changes: 54 additions & 0 deletions repair_type/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * repair_type
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-27 13:31+0000\n"
"PO-Revision-Date: 2024-06-27 13:31+0000\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: repair_type
#: model:ir.model.fields,field_description:repair_type.field_stock_picking_type__default_recycle_location_src_id
msgid "Default Recycle Source Location"
msgstr "Ubicación de origen por defecto para reciclaje"

#. module: repair_type
#: model:ir.model.fields,field_description:repair_type.field_stock_picking_type__default_remove_location_src_id
msgid "Default Remove Source Location"
msgstr "Ubicación de origen por defecto para eliminar"

#. module: repair_type
#: model:ir.model,name:repair_type.model_stock_picking_type
msgid "Picking Type"
msgstr "Tipo de recolección"

#. module: repair_type
#: model:ir.model,name:repair_type.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de stock"

#. module: repair_type
#: model:ir.model.fields,help:repair_type.field_stock_picking_type__default_recycle_location_src_id
msgid ""
"This is the default recycle source location when you create a repair order "
"with this operation type."
msgstr ""
"Esta es la ubicación de origen por defecto para el reciclaje cuando cree "
"una orden de reparación con este tipo de operación."

#. module: repair_type
#: model:ir.model.fields,help:repair_type.field_stock_picking_type__default_remove_location_src_id
msgid ""
"This is the default remove source location when you create a repair order "
"with this operation type."
msgstr ""
"Esta es la ubicación de origen por defecto para eleminar cuando cree una "
"orden de reparación con este tipo de operación."
35 changes: 35 additions & 0 deletions repair_type/migrations/17.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (C) 2024 APSL-Nagarro Antoni Marroig
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""
INSERT INTO stock_picking_type
(create_date, default_location_dest_id, default_remove_location_dest_id,
name, default_recycle_location_dest_id, sequence_id, sequence,
sequence_code, default_location_src_id, default_remove_location_src_id)
SELECT create_date, destination_location_add_part_id,
destination_location_remove_part_id, name, refurbish_location_dest_id,
sequence_id, sequence_number_next, sequence_prefix,
source_location_add_part_id, source_location_remove_part_id
FROM repair_type;
""",
)
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE repair_order
DROP COLUMN repair_type_id;
""",
)
openupgrade.logged_query(
env.cr,
"""
DROP TABLE repair_type;
""",
)
4 changes: 2 additions & 2 deletions repair_type/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from . import repair
from . import repair_type
from . import stock_move
from . import stock_picking_type
75 changes: 0 additions & 75 deletions repair_type/models/repair.py

This file was deleted.

36 changes: 0 additions & 36 deletions repair_type/models/repair_type.py

This file was deleted.

29 changes: 29 additions & 0 deletions repair_type/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (C) 2024 APSL-Nagarro Antoni Marroig
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from odoo import models


class StockMove(models.Model):
_inherit = "stock.move"

def _get_repair_locations(self, repair_line_type, repair_id=False):
res = super()._get_repair_locations(repair_line_type, repair_id)
if not repair_id:
if (
repair_line_type == "remove"
and self.repair_id.picking_type_id.default_remove_location_src_id
):
res = (
self.repair_id.picking_type_id.default_remove_location_src_id,
res[1],
)
elif (
repair_line_type == "recycle"
and self.repair_id.picking_type_id.default_recycle_location_src_id
):
res = (
self.repair_id.picking_type_id.default_recycle_location_src_id,
res[1],
)
return res
21 changes: 21 additions & 0 deletions repair_type/models/stock_picking_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2024 APSL-Nagarro Antoni Marroig
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from odoo import fields, models


class PickingType(models.Model):
_inherit = "stock.picking.type"

default_remove_location_src_id = fields.Many2one(
"stock.location",
"Default Remove Source Location",
help="This is the default remove source location when you create a repair "
"order with this operation type.",
)
default_recycle_location_src_id = fields.Many2one(
"stock.location",
"Default Recycle Source Location",
help="This is the default recycle source location when you create a repair "
"order with this operation type.",
)
5 changes: 5 additions & 0 deletions repair_type/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
- [ForgeFlow](https://forgeflow.com):

> - Bernat Puig \<<[email protected]>\>
- [APSL-Nagarro](https://apsl.tech):

> - Antoni Marroig \<<[email protected]>\>
> - Miquel Alzanillas \<<[email protected]>>\>
3 changes: 0 additions & 3 deletions repair_type/security/ir.model.access.csv

This file was deleted.

19 changes: 12 additions & 7 deletions repair_type/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -438,14 +437,20 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
</ul>
</blockquote>
</li>
<li><p class="first"><a class="reference external" href="https://apsl.tech">APSL-Nagarro</a>:</p>
<blockquote>
<ul class="simple">
<li>Antoni Marroig &lt;<a class="reference external" href="mailto:amarroig&#64;apsl.net">amarroig&#64;apsl.net</a>&gt;</li>
<li>Miquel Alzanillas &lt;<a class="reference external" href="mailto:malzanillas&#64;apsl.net">malzanillas&#64;apsl.net</a>&gt;&gt;</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
Expand Down
Loading

0 comments on commit ef54e99

Please sign in to comment.