Skip to content

[16.0][ADD] shopfloor_reception_product_barcode/mobile #1007

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

Open
wants to merge 3 commits into
base: 16.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
6 changes: 6 additions & 0 deletions setup/shopfloor_reception_product_barcode/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
6 changes: 6 additions & 0 deletions setup/shopfloor_reception_product_barcode_mobile/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
96 changes: 96 additions & 0 deletions shopfloor_reception_product_barcode/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
===================================
Shopfloor Reception Product Barcode
===================================

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

.. |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%2Fwms-lightgray.png?logo=github
:target: https://github.com/OCA/wms/tree/16.0/shopfloor_reception_product_barcode
:alt: OCA/wms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/wms-16-0/wms-16-0-shopfloor_reception_product_barcode
: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/wms&target_branch=16.0
:alt: Try me on Runboat

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

This module adds an option to the reception scenario. When activated,
before setting the quantity for the reception, if there is product
received with missing barcode, the user will be presented with a screen
proposing to update the barcode.

The scanned barcode will be parsed and so, EAN will be extracted from
GS1 if ``shopfloor_gs1`` module is installed.

|Scan Product Barcode|

.. |Scan Product Barcode| image:: https://raw.githubusercontent.com/OCA/wms/16.0/shopfloor_reception_product_barcode/static/description/scan_product_barcode.png

**Table of contents**

.. contents::
:local:

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

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

* Camptocamp
* ACSONE SA/NV

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

- Thierry Ducrest [email protected]
- Denis Roussel [email protected]

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.

.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px
:target: https://github.com/rousseldenis
:alt: rousseldenis

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-rousseldenis|

This module is part of the `OCA/wms <https://github.com/OCA/wms/tree/16.0/shopfloor_reception_product_barcode>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions shopfloor_reception_product_barcode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .hooks import post_init_hook, uninstall_hook
from . import models
from . import services
from . import actions
18 changes: 18 additions & 0 deletions shopfloor_reception_product_barcode/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Shopfloor Reception Product Barcode",
"summary": "Collect Product Barcode from the Reception scenario",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Inventory",
"website": "https://github.com/OCA/wms",
"author": "Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)",
"maintainers": ["rousseldenis"],
"license": "AGPL-3",
"installable": True,
"depends": [
"shopfloor_reception",
],
"data": ["views/shopfloor_menu.xml"],
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
}
1 change: 1 addition & 0 deletions shopfloor_reception_product_barcode/actions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import message
23 changes: 23 additions & 0 deletions shopfloor_reception_product_barcode/actions/message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2020 Camptocamp SA (http://www.camptocamp.com)
# Copyright 2023 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging

from odoo import _

from odoo.addons.component.core import Component

_logger = logging.getLogger(__name__)


class MessageAction(Component):
_inherit = "shopfloor.message.action"

def product_barcode_updated(self, product):
return {
"message_type": "success",
"body": _(
"Product '%(product_name)s' barcode updated.",
product_name=product.name,
),
}
40 changes: 40 additions & 0 deletions shopfloor_reception_product_barcode/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2023 Camptocamp SA (http://www.camptocamp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import json
import logging

from odoo import SUPERUSER_ID, api

from odoo.addons.shopfloor_base.utils import purge_endpoints, register_new_services

from .services.reception import Reception as Service

_logger = logging.getLogger(__file__)


def post_init_hook(cr, registry):
_logger.info("Add set product barcode option on reception scenario")
env = api.Environment(cr, SUPERUSER_ID, {})
scenario = env.ref("shopfloor_reception.scenario_reception")
options = scenario.options
options.update({"set_product_barcode": True})
scenario.options_edit = json.dumps(options)
# The service imported is extending an existing component
# As it is a simple python import the odoo inheritance is not working
# So it needs to be fix
Service._usage = "reception"
Service._name = "shopfloor.reception"
register_new_services(env, Service)


def uninstall_hook(cr, registry):
_logger.info("Remove set product barcode option on reception scenario")
env = api.Environment(cr, SUPERUSER_ID, {})
scenario = env.ref("shopfloor_reception.scenario_reception")
options = scenario.options
if "set_product_barcode" in options.keys():
options.pop("set_product_barcode")
scenario.options_edit = json.dumps(options)
Service._usage = "reception"
purge_endpoints(env, Service._usage, endpoint="set_product_barcode")
1 change: 1 addition & 0 deletions shopfloor_reception_product_barcode/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import shopfloor_menu
25 changes: 25 additions & 0 deletions shopfloor_reception_product_barcode/models/shopfloor_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Camptocamp SA (http://www.camptocamp.com)
# Copyright 2025 ACSONE SA/NV (https://acsone.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models


class ShopfloorMenu(models.Model):
_inherit = "shopfloor.menu"

set_product_barcode_is_possible = fields.Boolean(
compute="_compute_set_product_barcode_is_possible"
)
set_product_barcode = fields.Boolean(
string="Set product barcode",
default=False,
help="If for the product being processed, its related "
"barcode is not set, ask to fill them up.",
)

@api.depends("scenario_id")
def _compute_set_product_barcode_is_possible(self):
for menu in self:
menu.set_product_barcode_is_possible = menu.scenario_id.has_option(
"set_product_barcode"
)
2 changes: 2 additions & 0 deletions shopfloor_reception_product_barcode/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Thierry Ducrest <[email protected]>
- Denis Roussel <[email protected]>
8 changes: 8 additions & 0 deletions shopfloor_reception_product_barcode/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This module adds an option to the reception scenario.
When activated, before setting the quantity for the reception, if there is product received with
missing barcode, the user will be presented with a screen proposing to update the barcode.

The scanned barcode will be parsed and so, EAN will be extracted from GS1 if `shopfloor_gs1`
module is installed.

![Scan Product Barcode](../static/description/scan_product_barcode.png)
1 change: 1 addition & 0 deletions shopfloor_reception_product_barcode/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import reception
Loading
Loading