-
-
Notifications
You must be signed in to change notification settings - Fork 211
[16.0][ADD] shopfloor_priting_base/mobile #1085
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
base: 16.0
Are you sure you want to change the base?
Changes from all commits
00ffe6b
dbb532e
58d2551
62ffbc6
1fe092d
4840d57
750c73f
c5aaa0e
75cf350
adc8090
19ebe87
2c9c755
153da38
ef5a4de
f3ba312
306d1d8
e9b128f
edaadbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../shopfloor_mobile_printing_base |
| 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, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../shopfloor_printing_base |
| 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, | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this change needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 {} | ||
|
|
@@ -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""" | ||
| 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 | ||
|
|
||
|
|
@@ -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( | ||
| { | ||
|
|
||
| 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. |
| 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"], | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Denis Roussel <denis.roussel@acsone.eu> |
| 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. |
| 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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