Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
00ffe6b
[ADD] shopfloor_printing_base
rousseldenis Jul 17, 2025
dbb532e
[ADD] shopfloor_mobile_printing_base
rousseldenis Jul 17, 2025
58d2551
[IMP] shopfloor_printing_base: Add messages for printing
rousseldenis Jul 17, 2025
62ffbc6
[IMP] shopfloor_printing_base: Manage different messages when launchi…
rousseldenis Jan 5, 2026
1fe092d
[IMP] shopfloor_printing_base: Allow to display or not the printing c…
rousseldenis Jan 7, 2026
4840d57
[IMP] shopfloor_mobile_printing_base: Allow to display or not the pri…
rousseldenis Jan 7, 2026
750c73f
[IMP] shopfloor_mobile_printing_base: Add a method to check if print …
rousseldenis Jan 8, 2026
c5aaa0e
[FIX] shopfloor_printing_base: ensure "allow_printing_label" gets sto…
nicolas-delbovier-acsone Jan 12, 2026
75cf350
[REF] shopfloor_base: allow to pass variables to all next states
nicolas-delbovier-acsone Jan 16, 2026
adc8090
[REF] shopfloor_printing_base: pass "allow_print_label" variable to g…
nicolas-delbovier-acsone Jan 16, 2026
19ebe87
[FIX] shopfloor_base: Set _menu and _profile as properties
rousseldenis Jan 7, 2026
2c9c755
[FIX] shopfloor_printing_base: update unit test expected response
nicolas-delbovier-acsone Jan 19, 2026
153da38
[REF] shopfloor_printing_base: consolidate BaseShopfloorService
nicolas-delbovier-acsone Jan 19, 2026
ef5a4de
[FIX] shopfloor_printing_base: only add "allow_print_label" key in re…
nicolas-delbovier-acsone Jan 20, 2026
f3ba312
[IMP] shopfloor_mobile_printing_base: improve label-printer layout
nicolas-delbovier-acsone Jan 20, 2026
306d1d8
[FIX] missing dependency
nicolas-delbovier-acsone Jan 20, 2026
e9b128f
[FIX] shopfloor_mobile_printing_ase: fix licenses
nicolas-delbovier-acsone Feb 9, 2026
edaadbc
[FIX] shopfloor_base: fix docstring not triple quoted
nicolas-delbovier-acsone Feb 9, 2026
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_mobile_printing_base/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_printing_base/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,
)
12 changes: 8 additions & 4 deletions shopfloor_base/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ class BaseShopfloorService(AbstractComponent):
_collection = "shopfloor.app"
_expose_model = None

def __init__(self, work_context):
super().__init__(work_context)
@property

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why changing this to properties?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is from https://github.com/OCA/wms/pull/1115/changes which I needed as explained above

def _menu(self):
# User private attributes to not mess up w/ public endpoints
return getattr(self.work, "menu", self.env["shopfloor.menu"])

@property
def _profile(self):
# User private attributes to not mess up w/ public endpoints
self._profile = getattr(self.work, "profile", self.env["shopfloor.profile"])
self._menu = getattr(self.work, "menu", self.env["shopfloor.menu"])
return getattr(self.work, "profile", self.env["shopfloor.profile"])

def _get_api_spec(self, **params):
return ShopfloorRestServiceAPISpec(self, **params)
Expand Down
47 changes: 30 additions & 17 deletions shopfloor_base/services/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,9 @@ class BaseShopfloorValidatorResponse(AbstractComponent):
# Initial state of a workflow
_start_state = "start"

def _states(self):
"""List of possible next states

With the schema of the data send to the client to transition
def _states(self) -> dict:
"""Returns a dict mapping next states with the schema
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change needed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the previous docstring to be confusing. The return value is not a "list of possible next states", it is a dict mapping next state to its data schema

of the data sent to the client to transition
to the next state.
"""
return {}
Expand All @@ -181,6 +180,31 @@ def schemas(self):
def schemas_detail(self):
return self._actions_for("schema_detail")

def _get_global_fields_schemas(self) -> dict:
"Returns schemas of fields to be added in all next states data schemas"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triple quotes needed

return {}

def _validate_next_states(self, next_states: set, states_schemas: dict):
if self._start_state not in states_schemas:
raise ValueError(
"the _start_state is {} but this state does not exist"
", you may want to change the property's value".format(
self._start_state
)
)
unknown_states = set(next_states) - states_schemas.keys()
if unknown_states:
raise ValueError(
"states {!r} are not defined in _states".format(unknown_states)
)

def _add_global_fields_schemas(self, states_schemas: dict) -> dict:
"Modifies the 'states_schemas' dict to add the schemas of the global fields"
global_fields_schemas = self._get_global_fields_schemas()
for data_schema in states_schemas.values():
data_schema.update(global_fields_schemas)
return states_schemas

def _response_schema(self, data_schema=None, next_states=None):
"""Schema for the return validator

Expand Down Expand Up @@ -225,19 +249,8 @@ def _response_schema(self, data_schema=None, next_states=None):
next_states = set(next_states)
next_states.add(self._start_state)
states_schemas = self._states()
if self._start_state not in states_schemas:
raise ValueError(
"the _start_state is {} but this state does not exist"
", you may want to change the property's value".format(
self._start_state
)
)
unknown_states = set(next_states) - states_schemas.keys()
if unknown_states:
raise ValueError(
"states {!r} are not defined in _states".format(unknown_states)
)

self._validate_next_states(next_states, states_schemas)
states_schemas = self._add_global_fields_schemas(states_schemas)
data_schema = data_schema.copy()
data_schema.update(
{
Expand Down
119 changes: 119 additions & 0 deletions shopfloor_mobile_printing_base/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
==============================
Shopfloor Mobile Printing Base
==============================

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

.. |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_mobile_printing_base
: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_mobile_printing_base
: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 allows to use a new Vue component that allows to send print
commands with an amount of copies.

**Table of contents**

.. contents::
:local:

Usage
=====

Use this in your component template:

``<label-printer v-on:print_labels="state.print_labels($event)" buttonLabel="<The label>"/>``

Implement the ``print_labels()`` (or whatever you call it) method on
your component level:

::

const Reception = process_registry.extend("reception", {
template: new_template,
"methods._get_states": function () {
let states = _get_states.bind(this)();
const set_destination = states.set_destination;

const self = this;
set_destination.print_labels = function (quantity) {
self.wait_call(
self.odoo.call("print_labels", {
picking_id: self.state.data.picking.id,
selected_line_id: self.state.data.selected_move_line[0].id,
quantity: quantity,
})
);
};
return states;
},
});

See ``shopfloor_printing_base`` for backend implementation.

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_mobile_printing_base%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
-------

* ACSONE SA/NV

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

- Denis Roussel denis.roussel@acsone.eu

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_mobile_printing_base>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Empty file.
16 changes: 16 additions & 0 deletions shopfloor_mobile_printing_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Shopfloor Mobile Printing Base",
"summary": """This module adds the widget to print in shopfloor""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"maintainers": ["rousseldenis"],
"website": "https://github.com/OCA/wms",
"depends": [
"shopfloor_mobile_base",
],
"data": ["templates/assets.xml"],
}
1 change: 1 addition & 0 deletions shopfloor_mobile_printing_base/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Denis Roussel <denis.roussel@acsone.eu>
2 changes: 2 additions & 0 deletions shopfloor_mobile_printing_base/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to use a new Vue component that allows to send print commands
with an amount of copies.
29 changes: 29 additions & 0 deletions shopfloor_mobile_printing_base/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Use this in your component template:

` <label-printer v-on:print_labels="state.print_labels($event)" buttonLabel="<The label>"/> `

Implement the `print_labels()` (or whatever you call it) method on your component level:

```
const Reception = process_registry.extend("reception", {
template: new_template,
"methods._get_states": function () {
let states = _get_states.bind(this)();
const set_destination = states.set_destination;

const self = this;
set_destination.print_labels = function (quantity) {
self.wait_call(
self.odoo.call("print_labels", {
picking_id: self.state.data.picking.id,
selected_line_id: self.state.data.selected_move_line[0].id,
quantity: quantity,
})
);
};
return states;
},
});
```

See `shopfloor_printing_base` for backend implementation.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading