Skip to content
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

[FIX] base: barcode qweb field correct API #36499

Closed
wants to merge 1 commit into from

Conversation

kebeclibre
Copy link
Contributor

Before this commit, the barcode Qweb Field had a
option called "type", which meant what is the mapping between
numbers and barcode, that mapping is called a symbology
https://www.barcoding.com/resources/barcoding-basics/barcode-symbologies/

This option "type" collided with what the qweb engine does
at

qweb > _compile_directive_field
that calls
ir_qweb > _get_field

It resulted in a crash where type = "barcode" was not a valid symbology
to pass to the barcode lib

It is safe to say that this barcode widget was never user, otherwise it would have crashed

This commit changes that non-functioning API, and the barcode renders well

OPW 2066870

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@Whenrow
Copy link
Contributor

Whenrow commented Sep 6, 2019

Maybe you could also apply the change in

@http.route(['/report/barcode', '/report/barcode/<type>/<path:value>'], type='http', auth="public")
def report_barcode(self, type, value, width=600, height=100, humanreadable=0):
"""Contoller able to render barcode images thanks to reportlab.
Samples:
<img t-att-src="'/report/barcode/QR/%s' % o.name"/>
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' %
('QR', o.name, 200, 200)"/>
:param type: Accepted types: 'Codabar', 'Code11', 'Code128', 'EAN13', 'EAN8', 'Extended39',
'Extended93', 'FIM', 'I2of5', 'MSI', 'POSTNET', 'QR', 'Standard39', 'Standard93',
'UPCA', 'USPS_4State'
:param humanreadable: Accepted values: 0 (default) or 1. 1 will insert the readable value
at the bottom of the output image
"""
try:
barcode = request.env['ir.actions.report'].barcode(type, value, width=width, height=height, humanreadable=humanreadable)

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Sep 6, 2019
@kebeclibre
Copy link
Contributor Author

@Whenrow
Why ? there is a bug there as well ?
There is no collision between keys named "type", so I guess it is overkill to change that there.
Besides, I'm afraid that would change the controller's API which actually works as it is

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Sep 6, 2019
Copy link
Contributor

@nim-odoo nim-odoo left a comment

Choose a reason for hiding this comment

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

But export the translations 😄

Before this commit, the barcode Qweb Field had a
option called "type", which meant what is the mapping between
numbers and barcode, that mapping is called a symbology
https://www.barcoding.com/resources/barcoding-basics/barcode-symbologies/

This option "type" collided with what the qweb engine does
at
```
qweb > _compile_directive_field
that calls
ir_qweb > _get_field
```
It resulted in a crash where type = "barcode" was not a valid symbology
to pass to the barcode lib

It is safe to say that this barcode widget was never user, otherwise it would have crashed

This commit changes that non-functioning API, and the barcode renders well

OPW 2066870
@kebeclibre
Copy link
Contributor Author

robodoo r+

@robodoo robodoo added r+ 👌 and removed CI 🤖 Robodoo has seen passing statuses labels Sep 6, 2019
@nim-odoo
Copy link
Contributor

nim-odoo commented Sep 6, 2019

robodoo r-
no merge, wait for the forwardport

@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed r+ 👌 labels Sep 6, 2019
@kebeclibre
Copy link
Contributor Author

robodoo r+

@robodoo
Copy link
Contributor

robodoo commented Sep 10, 2019

Merged at b062ed4, thanks!

@nim-odoo nim-odoo deleted the 12.0-barcode-qweb-api-lpe branch September 11, 2019 06:13
kebeclibre added a commit to odoo-dev/odoo that referenced this pull request Sep 11, 2019
Before this commit, the barcode Qweb Field had a
option called "type", which meant what is the mapping between
numbers and barcode, that mapping is called a symbology
https://www.barcoding.com/resources/barcoding-basics/barcode-symbologies/

This option "type" collided with what the qweb engine does
at
```
qweb > _compile_directive_field
that calls
ir_qweb > _get_field
```
It resulted in a crash where type = "barcode" was not a valid symbology
to pass to the barcode lib

It is safe to say that this barcode widget was never user, otherwise it would have crashed

This commit changes that non-functioning API, and the barcode renders well

OPW 2066870

forward-port of odoo#36499 (330d862)
closes odoo#36499

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
robodoo pushed a commit that referenced this pull request Sep 11, 2019
Before this commit, the barcode Qweb Field had a
option called "type", which meant what is the mapping between
numbers and barcode, that mapping is called a symbology
https://www.barcoding.com/resources/barcoding-basics/barcode-symbologies/

This option "type" collided with what the qweb engine does
at
```
qweb > _compile_directive_field
that calls
ir_qweb > _get_field
```
It resulted in a crash where type = "barcode" was not a valid symbology
to pass to the barcode lib

It is safe to say that this barcode widget was never user, otherwise it would have crashed

This commit changes that non-functioning API, and the barcode renders well

OPW 2066870

forward-port of #36499 (330d862)
closes #36499

closes #36658

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants