Skip to content
Merged
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
2 changes: 1 addition & 1 deletion stock_serial_single_quant/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Stock Serial Single Quant",
"summary": "Add constraints on serial numbers",
"version": "14.0.1.1.0",
"version": "14.0.1.2.0",
"category": "Inventory",
"author": "Numigi",
"license": "LGPL-3",
Expand Down
79 changes: 61 additions & 18 deletions stock_serial_single_quant/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,85 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0+e\n"
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-03-31 13:47+0000\n"
"PO-Revision-Date: 2020-03-31 09:49-0400\n"
"Last-Translator: <>\n"
"POT-Creation-Date: 2026-06-09 18:56+0000\n"
"PO-Revision-Date: 2026-06-09 18:56+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"X-Generator: Poedit 2.0.6\n"

#. module: stock_serial_single_quant
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_warehouse__bypass_serial_single_quant
msgid "Bypass Serial Constraints"
msgstr "Ignorer les contraintes de numéro de série"

#. module: stock_serial_single_quant
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_move__display_name
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_production_lot__display_name
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_warehouse__display_name
msgid "Display Name"
msgstr "Nom d'affichage"

#. module: stock_serial_single_quant
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_move__id
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_move_line__id
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_production_lot__id
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_warehouse__id
msgid "ID"
msgstr "Identifiant"

#. module: stock_serial_single_quant
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_production_lot__is_serial
msgid "Is Serial Number"
msgstr "Est un numéro de série"

#. module: stock_serial_single_quant
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_move____last_update
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_move_line____last_update
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_production_lot____last_update
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_warehouse____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: stock_serial_single_quant
#: model:ir.model.fields,field_description:stock_serial_single_quant.field_stock_production_lot__location_id
msgid "Location"
msgstr "Emplacement"

#. module: stock_serial_single_quant
#: model:ir.model,name:stock_serial_single_quant.model_stock_production_lot
msgid "Lot/Serial"
msgstr ""
msgstr "Lot/N° série"

#. module: stock_serial_single_quant
#: model:ir.model,name:stock_serial_single_quant.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""
msgstr "Mouvements d'articles (Ligne de mouvement de stock)"

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

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:8
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved from "
"the source location {location}. It is currently located in {serial_location}."
"the source location {location}. It is currently located in "
"{serial_location}."
msgstr ""
"L'article {product} avec le numéro de série {serial} ne peut pas être "
"déplacé de l'emplacement source {location}. Il est présentement situé dans "
"l'emplacement {serial_location}."

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:14
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved from "
Expand All @@ -56,7 +94,7 @@ msgstr ""
"{serial_package}."

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:26
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved from "
Expand All @@ -66,7 +104,7 @@ msgstr ""
"déplacé du colis source {package}. Il n'est présentement pas dans un colis."

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:32
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved with "
Expand All @@ -78,7 +116,7 @@ msgstr ""
"au propriétaire {serial_owner}."

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:44
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved with "
Expand All @@ -89,7 +127,7 @@ msgstr ""
"pas lié à un propriétaire."

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:38
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved "
Expand All @@ -100,7 +138,7 @@ msgstr ""
"{serial_owner}."

#. module: stock_serial_single_quant
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:20
#: code:addons/stock_serial_single_quant/models/stock_move_line.py:0
#, python-format
msgid ""
"The product {product} with the serial number {serial} can not be moved "
Expand All @@ -110,3 +148,8 @@ msgstr ""
"L'article {product} avec le numéro de série {serial} ne peut pas être "
"déplacé sans colis source. Il est présentement situé dans le colis "
"{serial_package}."

#. module: stock_serial_single_quant
#: model:ir.model,name:stock_serial_single_quant.model_stock_warehouse
msgid "Warehouse"
msgstr "Entrepôt"
1 change: 1 addition & 0 deletions stock_serial_single_quant/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ class StockWarehouse(models.Model):
bypass_serial_single_quant = fields.Boolean(
string="Bypass Serial Constraints",
default=False,
groups="stock.group_stock_manager",
)
35 changes: 35 additions & 0 deletions stock_serial_single_quant/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,41 @@ def setUpClass(cls):
cls.owner_1 = cls.make_owner("Owner 1")
cls.owner_2 = cls.make_owner("Owner 2")

cls.user_stock_worker = cls.env["res.users"].create(
{
"name": "Standard Stock User",
"login": "stock_worker_test",
"groups_id": [
(
6,
0,
[
cls.env.ref("base.group_user").id,
cls.env.ref("stock.group_stock_user").id,
],
)
],
}
)

# Create an inventory manager user
cls.user_stock_manager = cls.env["res.users"].create(
{
"name": "Stock Manager User",
"login": "stock_manager_test",
"groups_id": [
(
6,
0,
[
cls.env.ref("base.group_user").id,
cls.env.ref("stock.group_stock_manager").id,
],
)
],
}
)

def move_serial_number(
self,
serial,
Expand Down
16 changes: 15 additions & 1 deletion stock_serial_single_quant/tests/test_stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import pytest
from odoo.exceptions import ValidationError
from odoo.exceptions import AccessError, ValidationError
from .common import StockMoveCase


Expand Down Expand Up @@ -143,3 +143,17 @@ def test_bypass_disabled_still_raises_error(self):

with pytest.raises(ValidationError):
self.move_serial_number(self.serial_1, self.location_2, self.location_3)

def test_worker_cannot_write_bypass_field(self):
# Ensure a standard stock user raises an AccessError when modifying the field
with pytest.raises(AccessError):
self.warehouse_3.with_user(self.user_stock_worker).write(
{"bypass_serial_single_quant": True}
)

def test_manager_can_write_bypass_field(self):
# Ensure a stock manager can successfully modify the field
self.warehouse_3.with_user(self.user_stock_manager).write(
{"bypass_serial_single_quant": True}
)
assert self.warehouse_3.bypass_serial_single_quant is True
Loading