Skip to content
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
65 changes: 65 additions & 0 deletions stock_barcodes_unique_field/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
===========================
Stock Barcodes Unique Field
===========================

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

.. |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-NuoBiT%2Fodoo--addons-lightgray.png?logo=github
:target: https://github.com/NuoBiT/odoo-addons/tree/18.0/stock_barcodes_unique_field
:alt: NuoBiT/odoo-addons

|badge1| |badge2| |badge3|

- This module extends the barcode options in inventory, allowing items
to be marked as unique and specifying the copy of these
characteristics to the picking header

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/NuoBiT/odoo-addons/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/NuoBiT/odoo-addons/issues/new?body=module:%20stock_barcodes_unique_field%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
-------

* NuoBiT Solutions SL

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

- `NuoBiT <https://www.nuobit.com>`__:

- Frank Cespedes fcespedes@nuobit.com
- Deniz Gallo dgallo@nuobit.com

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

This module is part of the `NuoBiT/odoo-addons <https://github.com/NuoBiT/odoo-addons/tree/18.0/stock_barcodes_unique_field>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions stock_barcodes_unique_field/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions stock_barcodes_unique_field/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
# Copyright 2026 NuoBiT Solutions - Deniz Gallo <dgallo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

{
"name": "Stock Barcodes Unique Field",
"summary": "This module extends the barcode options in inventory,"
" allowing items to be marked as unique and specifying the copy "
"of these characteristics to the picking header",
"version": "18.0.1.0.0",
"author": "NuoBiT Solutions SL",
"website": "https://github.com/NuoBiT/odoo-addons",
"category": "Stock",
"depends": ["stock_barcodes"],
"license": "AGPL-3",
"data": [
"views/stock_barcodes_option_view.xml",
],
}
68 changes: 68 additions & 0 deletions stock_barcodes_unique_field/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_barcodes_unique
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-22 15:20+0000\n"
"PO-Revision-Date: 2023-12-22 15:20+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: stock_barcodes_unique
#: model:ir.model.fields,field_description:stock_barcodes_unique.field_stock_barcodes_option__copy_to_header
msgid "Copy To Header"
msgstr "Copiar al Encabezado"

#. module: stock_barcodes_unique
#: model:ir.model.fields,field_description:stock_barcodes_unique.field_stock_barcodes_option__display_name
#: model:ir.model.fields,field_description:stock_barcodes_unique.field_wiz_stock_barcodes_read_picking__display_name
msgid "Display Name"
msgstr "Nombre a mostrar"

#. module: stock_barcodes_unique
#: model:ir.model.fields,field_description:stock_barcodes_unique.field_stock_barcodes_option____last_update
#: model:ir.model.fields,field_description:stock_barcodes_unique.field_wiz_stock_barcodes_read_picking____last_update
msgid "Last Modified on"
msgstr "Última modificación en"

#. module: stock_barcodes_unique
#: model:ir.model,name:stock_barcodes_unique.model_stock_barcodes_option
msgid "Options for barcode interface"
msgstr "Opciones para la interfaz de código de barras"

#. module: stock_barcodes_unique
#: code:addons/stock_barcodes_unique/models/stock_barcodes_read_picking.py:0
#, python-format
msgid ""
"The field %s must have the same value in all the lines of the picking "
"because you have selected it as a static field in the barcode options."
msgstr ""
"El campo %s debe tener el mismo valor en todas las líneas del albarán porque "
"lo ha seleccionado como campo estático en las opciones de código de barras."

#. module: stock_barcodes_unique
#: code:addons/stock_barcodes_unique/models/stock_barcodes_option.py:0
#, python-format
msgid ""
"The field 'Copy to Header' can only be checked if the field 'Unique' is also"
" checked."
msgstr ""
"El campo 'Copiar al Encabezado' solo puede marcarse si el campo 'Único' "
"también está marcado."

#. module: stock_barcodes_unique
#: model:ir.model.fields,field_description:stock_barcodes_unique.field_stock_barcodes_option__unique
msgid "Unique"
msgstr "Único"

#. module: stock_barcodes_unique
#: model:ir.model,name:stock_barcodes_unique.model_wiz_stock_barcodes_read_picking
msgid "Wizard to read barcode on picking"
msgstr "Asistente para leer códigos de barras desde los albaranes"
2 changes: 2 additions & 0 deletions stock_barcodes_unique_field/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_barcodes_option
from . import stock_barcodes_read_picking
23 changes: 23 additions & 0 deletions stock_barcodes_unique_field/models/stock_barcodes_option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class StockBarcodesOption(models.Model):
_inherit = "stock.barcodes.option"

unique = fields.Boolean()
copy_to_header = fields.Boolean()

@api.constrains("unique", "copy_to_header")
def _check_copy_to_header(self):
for rec in self:
if not rec.unique and rec.copy_to_header:
raise ValidationError(
_(
"The field 'Copy to Header' can only be checked if the "
"field 'Unique' is also checked."
)
)
33 changes: 33 additions & 0 deletions stock_barcodes_unique_field/models/stock_barcodes_read_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import _, models
from odoo.exceptions import UserError


class WizStockBarcodesReadPicking(models.TransientModel):
_inherit = "wiz.stock.barcodes.read.picking"

def action_confirm(self):
res = super().action_confirm()
option_fields = self.option_group_id.option_ids.filtered(lambda x: x.unique)
for option in option_fields:
field = option.field_name
move_line_field = self.move_line_ids[field]
if len(move_line_field) > 1:
field_label = self.fields_get([field])[field]["string"]
raise UserError(
_(
"The field %s must have the same value in all the "
"lines of the picking because you have selected it as "
"a static field in the barcode options."
)
% field_label
)
if move_line_field and option.copy_to_header:
if (
field in self.picking_id
and move_line_field != self.picking_id[field]
):
self.picking_id[field] = move_line_field
return res
3 changes: 3 additions & 0 deletions stock_barcodes_unique_field/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions stock_barcodes_unique_field/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [NuoBiT](https://www.nuobit.com):
- Frank Cespedes <fcespedes@nuobit.com>
- Deniz Gallo <dgallo@nuobit.com>
3 changes: 3 additions & 0 deletions stock_barcodes_unique_field/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- This module extends the barcode options in inventory, allowing items
to be marked as unique and specifying the copy of these
characteristics to the picking header
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading