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

[17.0][MIG] stock_picking_operations_multilang: Migration to 17.0 #381

Open
wants to merge 7 commits into
base: 17.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
109 changes: 109 additions & 0 deletions stock_picking_operations_multilang/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
==================================
Stock Picking Operations Multilang
==================================

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

.. |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--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-reporting/tree/17.0/stock_picking_operations_multilang
:alt: OCA/stock-logistics-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-17-0/stock-logistics-reporting-17-0-stock_picking_operations_multilang
: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-reporting&target_branch=17.0
:alt: Try me on Runboat

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

This module allows printing the Picking Operations report in the
partner's or warehouse's language, configurable at the warehouse level.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

When a company operates internationally, employees from different
countries may encounter language barriers. For instance, a warehouse
manager who only understands his native language might face difficulties
if the Picking Operations report is in a different language. This module
addresses such scenarios by enabling the customization of the Picking
Operations report language, ensuring it matches the language preferences
of the warehouse manager or the partner.

Configuration
=============

To set up a specific language for Picking Operations:

- Go to Inventory > Configuration > Warehouses.

- Select the warehouse for which you want to set up the language for the
Picking Operations report.

- Choose the Picking Operation Language option. There are two options:

- Partner: It will use the language of the partner for the picking. If
there is no partner for the picking, it will use the standard
behavior of Odoo.
- Warehouse: If you select this option, you must fill in the Warehouse
Language field, and this will be applied to Picking Operations.
- If left blank, it will use the standard behavior of Odoo.

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

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

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

- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)

- Bhavesh Heliconia

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-reporting <https://github.com/OCA/stock-logistics-reporting/tree/17.0/stock_picking_operations_multilang>`_ 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_operations_multilang/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import uninstall_hook
19 changes: 19 additions & 0 deletions stock_picking_operations_multilang/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Stock Picking Operations Multilang",
"version": "17.0.1.0.0",
"category": "Reporting",
"website": "https://github.com/OCA/stock-logistics-reporting",
"author": "Quartile, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["stock"],
"data": [
"views/stock_warehouse_views.xml",
"reports/picking_operations_report.xml",
"reports/report_picking_with_language.xml",
],
"uninstall_hook": "uninstall_hook",
"installable": True,
}
8 changes: 8 additions & 0 deletions stock_picking_operations_multilang/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from odoo.api import SUPERUSER_ID, Environment


def uninstall_hook(env):
envs = Environment(env.cr, SUPERUSER_ID, {})
report_action = envs.ref("stock.action_report_picking", raise_if_not_found=False)

Check warning on line 6 in stock_picking_operations_multilang/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_operations_multilang/hooks.py#L5-L6

Added lines #L5 - L6 were not covered by tests
if report_action:
report_action.write({"report_name": "stock.report_picking"})

Check warning on line 8 in stock_picking_operations_multilang/hooks.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_operations_multilang/hooks.py#L8

Added line #L8 was not covered by tests
59 changes: 59 additions & 0 deletions stock_picking_operations_multilang/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_operations_multilang
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-07-30 11:58+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 5.6.2\n"

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,field_description:stock_picking_operations_multilang.field_stock_warehouse__active_lang_count
msgid "Active Lang Count"
msgstr "Numero lingue attive"

#. module: stock_picking_operations_multilang
#: model:ir.model.fields.selection,name:stock_picking_operations_multilang.selection__stock_warehouse__picking_operation_language_option__partner
msgid "Partner"
msgstr "Partner"

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,help:stock_picking_operations_multilang.field_stock_warehouse__picking_operation_language_option
msgid ""
"Partner: Picking Operations report will use the partner's language.\n"
"Warehouse: Picking Operations report will use the language specified in the Warehouse Language field."
msgstr ""
"Partner: il resoconto operazioni del partner utilizzerà la lingua del "
"partner.\n"
"Magazzino: il resoconto operazioni del partner utilizzerà la lingua indicata "
"nel campo lingua magazzino."

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,field_description:stock_picking_operations_multilang.field_stock_warehouse__picking_operation_language_option
msgid "Picking Operation Language Option"
msgstr "Opzione lingua operazione prelievo"

#. module: stock_picking_operations_multilang
#: model:ir.model,name:stock_picking_operations_multilang.model_stock_picking
msgid "Transfer"
msgstr "Trasferimento"

#. module: stock_picking_operations_multilang
#: model:ir.model,name:stock_picking_operations_multilang.model_stock_warehouse
#: model:ir.model.fields.selection,name:stock_picking_operations_multilang.selection__stock_warehouse__picking_operation_language_option__warehouse
msgid "Warehouse"
msgstr "Magazzino"

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,field_description:stock_picking_operations_multilang.field_stock_warehouse__warehouse_language
msgid "Warehouse Language"
msgstr "Lingua magazzino"
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_operations_multilang
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \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: stock_picking_operations_multilang
#: model:ir.model.fields,field_description:stock_picking_operations_multilang.field_stock_warehouse__active_lang_count
msgid "Active Lang Count"
msgstr ""

#. module: stock_picking_operations_multilang
#: model:ir.model.fields.selection,name:stock_picking_operations_multilang.selection__stock_warehouse__picking_operation_language_option__partner
msgid "Partner"
msgstr ""

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,help:stock_picking_operations_multilang.field_stock_warehouse__picking_operation_language_option
msgid ""
"Partner: Picking Operations report will use the partner's language.\n"
"Warehouse: Picking Operations report will use the language specified in the Warehouse Language field."
msgstr ""

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,field_description:stock_picking_operations_multilang.field_stock_warehouse__picking_operation_language_option
msgid "Picking Operation Language Option"
msgstr ""

#. module: stock_picking_operations_multilang
#: model:ir.model,name:stock_picking_operations_multilang.model_stock_picking
msgid "Transfer"
msgstr ""

#. module: stock_picking_operations_multilang
#: model:ir.model,name:stock_picking_operations_multilang.model_stock_warehouse
#: model:ir.model.fields.selection,name:stock_picking_operations_multilang.selection__stock_warehouse__picking_operation_language_option__warehouse
msgid "Warehouse"
msgstr ""

#. module: stock_picking_operations_multilang
#: model:ir.model.fields,field_description:stock_picking_operations_multilang.field_stock_warehouse__warehouse_language
msgid "Warehouse Language"
msgstr ""
2 changes: 2 additions & 0 deletions stock_picking_operations_multilang/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_picking
from . import stock_warehouse
16 changes: 16 additions & 0 deletions stock_picking_operations_multilang/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


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

def _get_picking_operations_lang(self):
warehouse = self.picking_type_id.warehouse_id
if warehouse.picking_operation_language_option == "partner" and self.partner_id:
return self.partner_id.lang
if warehouse.picking_operation_language_option == "warehouse":
return warehouse.warehouse_language
return self.env.user.lang
31 changes: 31 additions & 0 deletions stock_picking_operations_multilang/models/stock_warehouse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class Warehouse(models.Model):
_inherit = "stock.warehouse"

@api.model
def _lang_get(self):
return self.env["res.lang"].get_installed()

picking_operation_language_option = fields.Selection(
[("partner", "Partner"), ("warehouse", "Warehouse")],
help="Partner: Picking Operations report will use the partner's language.\n"
"Warehouse: Picking Operations report will use the language specified in "
"the Warehouse Language field.",
)

warehouse_language = fields.Selection(
_lang_get,
default=lambda self: self.env.lang,
)
active_lang_count = fields.Integer(compute="_compute_active_lang_count")

@api.depends("warehouse_language")
def _compute_active_lang_count(self):
lang_count = len(self.env["res.lang"].get_installed())
for rec in self:
rec.active_lang_count = lang_count
3 changes: 3 additions & 0 deletions stock_picking_operations_multilang/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
14 changes: 14 additions & 0 deletions stock_picking_operations_multilang/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
To set up a specific language for Picking Operations:

- Go to Inventory \> Configuration \> Warehouses.

- Select the warehouse for which you want to set up the language for the
Picking Operations report.

- Choose the Picking Operation Language option. There are two options:
- Partner: It will use the language of the partner for the picking. If
there is no partner for the picking, it will use the standard
behavior of Odoo.
- Warehouse: If you select this option, you must fill in the Warehouse
Language field, and this will be applied to Picking Operations.
- If left blank, it will use the standard behavior of Odoo.
7 changes: 7 additions & 0 deletions stock_picking_operations_multilang/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
When a company operates internationally, employees from different
countries may encounter language barriers. For instance, a warehouse
manager who only understands his native language might face difficulties
if the Picking Operations report is in a different language. This module
addresses such scenarios by enabling the customization of the Picking
Operations report language, ensuring it matches the language preferences
of the warehouse manager or the partner.
2 changes: 2 additions & 0 deletions stock_picking_operations_multilang/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- \[Heliconia Solutions Pvt. Ltd.\](<https://www.heliconia.io>)
- Bhavesh Heliconia
2 changes: 2 additions & 0 deletions stock_picking_operations_multilang/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows printing the Picking Operations report in the
partner's or warehouse's language, configurable at the warehouse level.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="stock.action_report_picking" model="ir.actions.report">
<field
name="report_name"
>stock_picking_operations_multilang.report_picking_with_language</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_picking_with_language">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o._get_picking_operations_lang()" />
<t t-call="stock.report_picking" t-lang="lang" />
</t>
</template>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading