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

Report 'one_slip_per_page_from_invoice' raises a TypeError #80

Closed
tafaRU opened this issue Jan 15, 2015 · 3 comments
Closed

Report 'one_slip_per_page_from_invoice' raises a TypeError #80

tafaRU opened this issue Jan 15, 2015 · 3 comments

Comments

@tafaRU
Copy link
Member

tafaRU commented Jan 15, 2015

Impacted versions:

Steps to reproduce:

  1. install module 'l10n_ch_payment_slip from https://github.com/nbessi/l10n-switzerland/tree/new_payment_slip
  2. set BVR data for the company
  3. create a new customer invoice
  4. print the 'Payment Slip' report

Current behavior:

this is the Traceback I got:

Traceback (most recent call last):
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/addons/report/controllers/main.py", line 118, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/http.py", line 388, in response_wrap
    response = f(*args, **kw)
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/addons/report/controllers/main.py", line 65, in report_routes
    pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/report/payment_slip_from_invoice.py", line 50, in get_pdf
    out_format='PDF')
  File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/payment_slip.py", line 592, in _draw_payment_slip
    scan_font = self._get_scan_line_text_font(company)
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/payment_slip.py", line 399, in _get_scan_line_text_font
    company.bvr_scan_line_font_size or self._default_scan_font_size
  File "/home/tafaru/dev/envs/buildout/customer/eggs/Pillow-2.5.1-py2.7-linux-x86_64.egg/PIL/ImageFont.py", line 228, in truetype
    return FreeTypeFont(font, size, index, encoding)
  File "/home/tafaru/dev/envs/buildout/customer/eggs/Pillow-2.5.1-py2.7-linux-x86_64.egg/PIL/ImageFont.py", line 131, in __init__
    self.font = core.getfont(font, size, index, encoding)
TypeError: integer argument expected, got float

Casting company.bvr_scan_line_font_size to int seems to fix it.
But it sounds to me a bit strange that https://pillow.readthedocs.org/reference/ImageFont.html doesn't accept the argument size as float.

Any feedback will be appreciated.

Thank you in advance.

@nbessi
Copy link
Contributor

nbessi commented Jan 16, 2015

Hello,

I guess that is a change in version 2.7.0 we should change the type of
columns to int.

Regards

Nicolas

2015-01-15 16:09 GMT+01:00 Alex Comba [email protected]:

Impacted versions:

Steps to reproduce:

  1. install module 'l10n_ch_payment_slip from
    https://github.com/nbessi/l10n-switzerland/tree/new_payment_slip
  2. set BVR data for the company
  3. create a new customer invoice
  4. print the 'Payment Slip' report

Current behavior:

This is the Traceback I got:

Traceback (most recent call last):
File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/addons/report/controllers/main.py", line 118, in report_download
response = self.report_routes(reportname, docids=docids, converter='pdf')
File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/http.py", line 388, in response_wrap
response = f(_args, *_kw)
File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/addons/report/controllers/main.py", line 65, in report_routes
pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, _args, *_kwargs)
File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/report/payment_slip_from_invoice.py", line 50, in get_pdf
out_format='PDF')
File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/payment_slip.py", line 592, in _draw_payment_slip
scan_font = self._get_scan_line_text_font(company)
File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/api.py", line 235, in wrapper
return new_api(self, _args, *_kwargs)
File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/payment_slip.py", line 399, in _get_scan_line_text_font
company.bvr_scan_line_font_size or self._default_scan_font_size
File "/home/tafaru/dev/envs/buildout/customer/eggs/Pillow-2.5.1-py2.7-linux-x86_64.egg/PIL/ImageFont.py", line 228, in truetype
return FreeTypeFont(font, size, index, encoding)
File "/home/tafaru/dev/envs/buildout/customer/eggs/Pillow-2.5.1-py2.7-linux-x86_64.egg/PIL/ImageFont.py", line 131, in init
self.font = core.getfont(font, size, index, encoding)
TypeError: integer argument expected, got float

Casting company.bvr_scan_line_font_size to int seems to fix it.
But it sounds a bit strange
https://pillow.readthedocs.org/reference/ImageFont.html doesn't manage
size value as float.

Any feedback will be appreciated.

Thank you in advance.


Reply to this email directly or view it on GitHub
#80.

Nicolas Bessi
Senior ERP consultant
Business Solution technical manager

Camptocamp SA
PSE A
CH-1015 Lausanne

http://openerp.camptocamp.com

Direct: +41 21 619 10 26
Office: +41 21 619 10 10

@tafaRU
Copy link
Member Author

tafaRU commented Jan 16, 2015

Hello @nbessi,

thanks a lot for your quick reply.

I updated pillow version to 2.7.0 but the error is always the same. This is the Traceback I got:

Traceback (most recent call last):
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/addons/report/controllers/main.py", line 118, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/http.py", line 388, in response_wrap
    response = f(*args, **kw)
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/addons/report/controllers/main.py", line 65, in report_routes
    pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/report/payment_slip_from_invoice.py", line 50, in get_pdf
    out_format='PDF')
  File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/payment_slip.py", line 592, in _draw_payment_slip
    scan_font = self._get_scan_line_text_font(company)
  File "/home/tafaru/dev/envs/buildout/customer/parts/odoo/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/home/tafaru/dev/envs/buildout/customer/parts/new_payment_slip/l10n_ch_payment_slip/payment_slip.py", line 399, in _get_scan_line_text_font
    company.bvr_scan_line_font_size or self._default_scan_font_size
  File "/home/tafaru/dev/envs/buildout/customer/eggs/Pillow-2.7.0-py2.7-linux-x86_64.egg/PIL/ImageFont.py", line 240, in truetype
    return FreeTypeFont(font, size, index, encoding)
  File "/home/tafaru/dev/envs/buildout/customer/eggs/Pillow-2.7.0-py2.7-linux-x86_64.egg/PIL/ImageFont.py", line 137, in __init__
    self.font = core.getfont(font, size, index, encoding)
TypeError: integer argument expected, got float

In addition, here https://github.com/python-pillow/Pillow/blob/master/PIL/ImageFont.py#L220 is written
:param size: The requested size, in points.

we should change the type of columns to int.

Let me know if I can create a PR that goes in this direction.

Thank you in advance.

@nbessi
Copy link
Contributor

nbessi commented Jan 16, 2015

Please proceed forward.

Thanks Nicolas

Nicolas

tafaRU added a commit to tafaRU/l10n-switzerland that referenced this issue Jan 16, 2015
nbessi added a commit to nbessi/l10n-switzerland that referenced this issue Jan 16, 2015
@nbessi nbessi closed this as completed Jan 16, 2015
yvaucher pushed a commit to yvaucher/l10n-switzerland that referenced this issue Nov 14, 2017
yvaucher pushed a commit to yvaucher/l10n-switzerland that referenced this issue Nov 14, 2017
vrenaville pushed a commit to camptocamp/l10n-switzerland that referenced this issue Jun 22, 2018
BIZ-1410: Fix working hours on employees/contracts and add constraint
JuMiSanAr pushed a commit to camptocamp/l10n-switzerland that referenced this issue Sep 21, 2021
[BSARM-21] add note on delivery slip report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants