Skip to content

Commit

Permalink
[MIG] stock_picking_batch_extended: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yankinmax committed Jan 28, 2025
1 parent a3a7973 commit 3d36345
Show file tree
Hide file tree
Showing 26 changed files with 190 additions and 181 deletions.
4 changes: 2 additions & 2 deletions stock_picking_batch_extended/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
{
"name": "Stock batch picking extended",
"summary": "Allows manage a lot of pickings in batch",
"version": "16.0.1.1.1",
"version": "18.0.1.0.0",
"author": "Camptocamp, " "Tecnativa, " "Odoo Community Association (OCA)",
"development_status": "Mature",
"maintainers": ["gurneyalex", "carlosdauden", "i-vyshnevska"],
"category": "Warehouse Management",
"depends": ["stock_picking_batch", "delivery"],
"depends": ["stock_picking_batch", "stock_delivery"],
"website": "https://github.com/OCA/stock-logistics-workflow",
"data": [
"security/ir.model.access.csv",
Expand Down
6 changes: 1 addition & 5 deletions stock_picking_batch_extended/hooks.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Copyright 2019 Camptocamp - Iryna Vyshnevska
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})

def post_init_hook(env):
env["res.company"].search([]).write({"use_oca_batch_validation": True})
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ msgid "Warehouse"
msgstr "Warenlager"

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Warenlager-Beschreibung"
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ msgid "Warehouse"
msgstr "Almacén"

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Descripción del almacén"
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/es_CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ msgid "Warehouse"
msgstr "Bodega"

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Descripción de Bodega"
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ msgid "Warehouse"
msgstr ""

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Warehouse Description"
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ msgid "Warehouse"
msgstr "Magazzino"

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Descrizione magazzino"
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ msgid "Warehouse"
msgstr "Armazém"

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Descrição do Armazém"
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_batch_extended/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ msgid "Warehouse"
msgstr "Skladišče"

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr "Opis skladišča"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ msgid "Warehouse"
msgstr ""

#. module: stock_picking_batch_extended
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse
#: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_picking
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view
msgid "Warehouse Description"
msgstr ""
Expand Down
16 changes: 16 additions & 0 deletions stock_picking_batch_extended/migrations/18.0.1.0.0/pre-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


def migrate(cr, version):
cr.execute("""
UPDATE product_template
SET description_picking =
CASE
WHEN description_picking IS NOT NULL THEN
description_picking || '\n' || description_warehouse
ELSE
description_warehouse
END
WHERE description_warehouse IS NOT NULL;
""")
1 change: 1 addition & 0 deletions stock_picking_batch_extended/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import res_company
from . import res_config_settings
from . import stock_batch_picking
from . import product_product
Expand Down
8 changes: 4 additions & 4 deletions stock_picking_batch_extended/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from odoo import fields, models


class Product(models.Model):
_inherit = "product.product"
# TODO: Integrate in existent field
description_warehouse = fields.Text("Warehouse Description", translate=True)
class ProductTemplate(models.Model):
_inherit = "product.template"

description_picking = fields.Text(string="Warehouse Description", translate=True)
10 changes: 10 additions & 0 deletions stock_picking_batch_extended/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2019 Camptocamp - Iryna Vyshnevska
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class Company(models.Model):
_inherit = "res.company"

use_oca_batch_validation = fields.Boolean()
6 changes: 0 additions & 6 deletions stock_picking_batch_extended/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ class ResConfigSettings(models.TransientModel):
related="company_id.use_oca_batch_validation",
readonly=False,
)


class Company(models.Model):
_inherit = "res.company"

use_oca_batch_validation = fields.Boolean()
9 changes: 4 additions & 5 deletions stock_picking_batch_extended/models/stock_batch_picking.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2012-2014 Alexandre Fayolle, Camptocamp SA
# Copyright 2018-2020 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, fields, models
from odoo import fields, models
from odoo.exceptions import UserError


Expand All @@ -12,13 +12,12 @@ class StockPickingBatch(models.Model):

name = fields.Char(
index=True,
states={"draft": [("readonly", False)]},
readonly=False, # allow edition in draft state
)
date = fields.Date(
required=True,
readonly=True,
readonly=False, # allow edition in draft,in_progress state
index=True,
states={"draft": [("readonly", False)], "in_progress": [("readonly", False)]},
default=fields.Date.context_today,
help="date on which the batch picking is to be processed",
)
Expand Down Expand Up @@ -66,7 +65,7 @@ def action_cancel(self):
def action_print_picking(self):
pickings = self.mapped("picking_ids")
if not pickings:
raise UserError(_("Nothing to print."))
raise UserError(self.env._("Nothing to print."))
return self.env.ref("stock.action_report_delivery").report_action(
self.picking_ids
)
Expand Down
4 changes: 3 additions & 1 deletion stock_picking_batch_extended/report/batch_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def key_level_1(self, operation):

@api.model
def new_level_0(self, operation):
level_0_name = f"{operation.location_id.name_get()[0][1]} \u21e8 {operation.location_dest_id.name_get()[0][1]}"
location_name = operation.location_id.name_get()[0][1]
location_dest_name = operation.location_dest_id.name_get()[0][1]
level_0_name = f"{location_name} \u21e8 {location_dest_name}"
return {

Check warning on line 28 in stock_picking_batch_extended/report/batch_report.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_batch_extended/report/batch_report.py#L25-L28

Added lines #L25 - L28 were not covered by tests
"name": level_0_name,
"location": operation.location_id,
Expand Down
Loading

0 comments on commit 3d36345

Please sign in to comment.