Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] stock_picking_kind: Migration to 18.0 #1806

Open
wants to merge 16 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions stock_picking_kind/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
==================
Stock Picking Kind
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d7741f153c02680799b8e8978fb8b43dd2b5985457ce170b6d73c9c4fc07c39a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_kind
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_picking_kind
: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/stock-logistics-workflow&target_branch=18.0
:alt: Try me on Runboat

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

This module adds a field picking_kind on stock.picking to indicate the
kind of the picking based on source and destination locations of the
picking.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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/stock-logistics-workflow/issues/new?body=module:%20stock_picking_kind%0Aversion:%2018.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
-------

* ACSONE SA/NV

Contributors
------------

- Hughes Damry <hughes.damry@acsone.eu>
- Sodexis Team <dev@sodexis.com>
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_kind>`_ 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 stock_picking_kind/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import pre_init_hook
18 changes: 18 additions & 0 deletions stock_picking_kind/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Stock Picking Kind",
"summary": """
Computes the kind of picking based on locations""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
"depends": ["stock"],
"data": [
"views/stock_picking_views.xml",
],
"demo": [],
"pre_init_hook": "pre_init_hook",
}
59 changes: 59 additions & 0 deletions stock_picking_kind/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

from odoo.tools import sql

_logger = logging.getLogger(__name__)


def pre_init_hook(env):
"""Initialize picking_kind field based on location_id and location_dest_id"""
if not sql.column_exists(env.cr, "stock_picking", "picking_kind"):
_logger.info("Create picking_kind column")
env.cr.execute(
"""
ALTER TABLE stock_picking
ADD COLUMN picking_kind character varying;
"""
)
_logger.info("Initialize picking_kind field")
env.cr.execute(
"""
UPDATE stock_picking
SET picking_kind = (
CASE
WHEN
origin.usage = 'supplier'
AND destination.usage = 'customer'
THEN 'drop_shipping'
WHEN
origin.usage = 'customer'
AND destination.usage = 'supplier'
THEN 'drop_shipping_return'
WHEN
origin.usage = 'customer'
AND destination.usage != 'customer'
THEN 'customer_return'
WHEN
origin.usage != 'customer'
AND destination.usage = 'customer'
THEN 'customer_out'
WHEN
origin.usage = 'supplier'
AND destination.usage != 'supplier'
THEN 'supplier_in'
WHEN
origin.usage != 'supplier'
AND destination.usage = 'supplier'
THEN 'supplier_return'
ELSE NULL
END
)
FROM stock_location origin, stock_location destination
WHERE stock_picking.location_id = origin.id
AND stock_picking.location_dest_id = destination.id
"""
)
_logger.info(f"{env.cr.rowcount} rows updated")
83 changes: 83 additions & 0 deletions stock_picking_kind/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_kind
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-09-03 05:07+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: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Customer Deliveries"
msgstr "Entregas a clientes"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__customer_out
msgid "Customer Delivery"
msgstr "Entrega al cliente"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__customer_return
msgid "Customer Return"
msgstr "Devolución del cliente"

#. module: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Customer Returns"
msgstr "Devoluciones de clientes"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__drop_shipping
msgid "Drop Shipping"
msgstr "Envío directo"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__drop_shipping_return
msgid "Drop Shipping Return"
msgstr "Devolución de Envío Directo"

#. module: stock_picking_kind
#: model:ir.model.fields,help:stock_picking_kind.field_stock_picking__picking_kind
msgid "Indicate the kind of picking based on its locations"
msgstr "Indicar el tipo de recogida en función de sus ubicaciones"

#. module: stock_picking_kind
#: model:ir.model.fields,field_description:stock_picking_kind.field_stock_picking__picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Picking Kind"
msgstr "Tipo de recogida"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__supplier_in
msgid "Supplier Reception"
msgstr "Recepción del proveedor"

#. module: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Supplier Receptions"
msgstr "Recepciones de proveedor"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__supplier_return
msgid "Supplier Return"
msgstr "Devolución al proveedor"

#. module: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Supplier Returns"
msgstr "Devoluciones de proveedores"

#. module: stock_picking_kind
#: model:ir.model,name:stock_picking_kind.model_stock_picking
msgid "Transfer"
msgstr "Transferencia"
83 changes: 83 additions & 0 deletions stock_picking_kind/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_kind
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-17 13:19+0000\n"
"PO-Revision-Date: 2023-03-17 13:19+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: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Customer Deliveries"
msgstr "Livraisons Client"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__customer_out
msgid "Customer Delivery"
msgstr "Livraison Client"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__customer_return
msgid "Customer Return"
msgstr "Retour Client"

#. module: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Customer Returns"
msgstr "Retours Client"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__drop_shipping
msgid "Drop Shipping"
msgstr ""

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__drop_shipping_return
msgid "Drop Shipping Return"
msgstr "Retour Drop Shipping"

#. module: stock_picking_kind
#: model:ir.model.fields,help:stock_picking_kind.field_stock_picking__picking_kind
msgid "Indicate the kind of picking based on its locations"
msgstr ""

#. module: stock_picking_kind
#: model:ir.model.fields,field_description:stock_picking_kind.field_stock_picking__picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Picking Kind"
msgstr "Sorte de picking"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__supplier_in
msgid "Supplier Reception"
msgstr "Réception Fournisseur"

#. module: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Supplier Receptions"
msgstr "Réception Fournisseur"

#. module: stock_picking_kind
#: model:ir.model.fields.selection,name:stock_picking_kind.selection__stock_picking__picking_kind__supplier_return
msgid "Supplier Return"
msgstr "Retour Fournisseur"

#. module: stock_picking_kind
#: model_terms:ir.ui.view,arch_db:stock_picking_kind.view_picking_internal_search
msgid "Supplier Returns"
msgstr "Retours Fournisseur"

#. module: stock_picking_kind
#: model:ir.model,name:stock_picking_kind.model_stock_picking
msgid "Transfer"
msgstr "Transfert"
Loading
Loading