-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] mrp_qr_code: Create field qr_code in mrp.workorder
- Loading branch information
Showing
8 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg | ||
:target: https://opensource.org/licenses/LGPL-3.0 | ||
:alt: License: LGPL-3 | ||
|
||
======================= | ||
Workorder QR Code | ||
======================= | ||
|
||
Overview | ||
======== | ||
|
||
The **Workorder QR Code** module adds the capability to generate and display QR codes for workorders based on their barcodes. This is particularly useful for inventory management, workorder identification, and streamlined operations. | ||
|
||
Features | ||
======== | ||
|
||
- **Automatic QR Code Generation**: | ||
- QR codes are generated automatically for workorders with a barcode. | ||
- **QR Code Display**: | ||
- The QR code is displayed in the workorder form view for easy access. | ||
- **Integrated Design**: | ||
- The module integrates seamlessly into the existing workorder management system. | ||
|
||
Usage | ||
===== | ||
|
||
1. **Install the Module**: | ||
- Install the **Workorder QR Code** module from the Apps menu. | ||
|
||
2. **Generate QR Codes**: | ||
- Open any workorder with a barcode. | ||
- The QR code is automatically generated and displayed in the form view. | ||
|
||
3. **QR Code Preview**: | ||
- The QR code can be previewed directly from the workorder form view. | ||
|
||
Configuration | ||
============= | ||
|
||
No additional configuration is required. The module works automatically once installed. | ||
|
||
Testing | ||
======= | ||
|
||
To verify the module's functionality: | ||
|
||
1. Create or edit a workorder and ensure it has a barcode. | ||
2. Save the workorder. | ||
3. Check the QR code field to confirm the QR code is generated. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
If you encounter any issues, please report them on the GitHub repository at `GitHub Issues <https://github.com/avanzosc/odoo-addons/issues>`_. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Ana Juaristi <anajuaristi@avanzosc.es> | ||
* Unai Beristain <unaiberistain@avanzosc.es> | ||
|
||
For specific questions or support, please contact the contributors. | ||
|
||
License | ||
======= | ||
|
||
This project is licensed under the LGPL-3 License. For more details, refer to the LICENSE file or visit <https://opensource.org/licenses/LGPL-3.0>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "Product QR Code", | ||
"version": "16.0.1.0.0", | ||
"category": "Product", | ||
"author": "Avanzosc", | ||
"license": "LGPL-3", | ||
"depends": [], | ||
"data": [], | ||
"installable": True, | ||
"application": False, | ||
"website": "https://github.com/avanzosc/mrp-addons", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import mrp_production | ||
from . import mrp_workorder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import base64 | ||
from io import BytesIO | ||
|
||
import qrcode | ||
|
||
from odoo import models | ||
|
||
|
||
class MrpProduction(models.Model): | ||
_inherit = "mrp.production" | ||
|
||
def _create_qr_code(self, integer_to_convert): | ||
if integer_to_convert: | ||
sequence_str = str(integer_to_convert) | ||
|
||
qr = qrcode.QRCode( | ||
version=1, | ||
error_correction=qrcode.constants.ERROR_CORRECT_L, | ||
box_size=10, | ||
border=4, | ||
) | ||
qr.add_data(sequence_str) | ||
qr.make(fit=True) | ||
|
||
img = qr.make_image(fill_color="black", back_color="white") | ||
buffer = BytesIO() | ||
img.save(buffer, format="PNG") | ||
qr_image = base64.b64encode(buffer.getvalue()).decode("utf-8") | ||
|
||
return qr_image | ||
else: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import base64 | ||
from io import BytesIO | ||
|
||
import qrcode | ||
|
||
from odoo import models | ||
|
||
|
||
class MrpWorkorder(models.Model): | ||
_inherit = "mrp.workorder" | ||
|
||
def _create_qr_code(self, integer_to_convert): | ||
if integer_to_convert: | ||
sequence_str = str(integer_to_convert) | ||
|
||
qr = qrcode.QRCode( | ||
version=1, | ||
error_correction=qrcode.constants.ERROR_CORRECT_L, | ||
box_size=10, | ||
border=4, | ||
) | ||
qr.add_data(sequence_str) | ||
qr.make(fit=True) | ||
|
||
img = qr.make_image(fill_color="black", back_color="white") | ||
buffer = BytesIO() | ||
img.save(buffer, format="PNG") | ||
qr_image = base64.b64encode(buffer.getvalue()).decode("utf-8") | ||
|
||
return qr_image | ||
else: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../mrp_qr_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |