Giter Site home page Giter Site logo

Comments (3)

nbessi avatar nbessi commented on August 31, 2024

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

from l10n-switzerland.

tafaRU avatar tafaRU commented on August 31, 2024

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.

from l10n-switzerland.

nbessi avatar nbessi commented on August 31, 2024

Please proceed forward.

Thanks Nicolas

Nicolas

from l10n-switzerland.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.