Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

How to get sale_report_html past Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0?

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
v6.1mako
2 Replies
11328 Rodiniai
Portretas
Dale E. Moore

OpenERP application sale_report_html encounters the following error on my Ubuntu 12.10, OpenERP 6.1 and Mako 0.7.1-1 system.

Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0

(<class 'mako.exceptions.compileexception'="">, CompileException("Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0",), <traceback object="" at="" 0xb43e9bbc="">)

and the /var/log/openerp-server.log

2013-03-05 23:34:32,129 18019 ERROR ? openerp.service.web_services: Exception: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 727, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 442, in create
    fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
  File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 454, in create_source_mako2html
    return self.create_single_mako2html(cr, uid, ids, data, report_xml, context or {})
  File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 677, in create_single_mako2html
    html = create_doc(mako_html,html_parser.localcontext)
  File "/usr/lib/pymodules/python2.7/openerp/report/interface.py", line 243, in create_makohtml2html
    obj.render()
  File "/usr/lib/pymodules/python2.7/openerp/report/render/render.py", line 59, in render
    self._result = self._render()
  File "/usr/lib/pymodules/python2.7/openerp/report/render/rml.py", line 91, in _render
    return makohtml.parseNode(self.html,self.localcontext)
  File "/usr/lib/pymodules/python2.7/openerp/report/render/makohtml2html/makohtml2html.py", line 135, in parseNode
    return r.render()
  File "/usr/lib/pymodules/python2.7/openerp/report/render/makohtml2html/makohtml2html.py", line 119, in render
    template = Template(self.html, lookup=temp_lookup)
  File "/usr/lib/python2.7/dist-packages/mako/template.py", line 206, in __init__
    (code, module) = _compile_text(self, text, filename)
  File "/usr/lib/python2.7/dist-packages/mako/template.py", line 484, in _compile_text
    node = lexer.parse()
  File "/usr/lib/python2.7/dist-packages/mako/lexer.py", line 192, in parse
    self.filename,)
  File "/usr/lib/python2.7/dist-packages/mako/lexer.py", line 184, in decode_raw_stream
    0, 0, filename)
CompileException: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
2013-03-05 23:34:32,358 18019 ERROR ? openerp.netsvc: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0
(<class 'mako.exceptions.compileexception'="">, CompileException("Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0",), <traceback object="" at="" 0xb8071e4="">)

I've made no changes to sale_report_html other than "mv __terp__.py __openerp__.py" which I was told is required.

One suggestion I'd encountered said that I should change all the string references in sale_order_html.mako from ${ 'this is some string' } to ${ u'this is some string' }. And I'm willing to do that, but; most of the string references are of the form ${ o.partner_id.title or '' } and I'm unsure how to convert that to unicode.

What do you suggest?

0
Portretas
Atmesti
Dale E. Moore
Autorius

Making the template file (sale_report_html.mako) line one = "## -- encoding: utf-8 --" is not the solution I had hoped for.

Cyril Gaspard (GEM)

I updated my answer. For the third error, try to comment line mako header xor footer. Bye

Portretas
Cyril Gaspard (GEM)
Best Answer

Hi,

install good mako library version with command :

pip install Mako==0.2.4

in file sale_report_html/report/sale_order_html.mako, at the first line add line :

# -*- coding: utf-8 -*-

save the file.

restart openerp server

update the module

this solve the error you gave (tested)

now you will have an other error, to solve it do :

go to settings/parameter setting/low level/actions/reports

search report with name "Order(HTML using Mako)"

open the line and edit field "type" with "mako2html"

save

restart openerp server

update the module

solve the second error (tested).

but now a third error comes.

then to you to search how to solve it

Bye

2
Portretas
Atmesti
Dale E. Moore
Autorius

I've trimmed sale_order_html.mako down to just the html, header and body tags with nothing except for BODY in in the body. I changed "## -- coding: utf-8 --" to "## -- coding: ascii --" in sale_order_html.mako, mako_header.html and mako_footer.html. I get the same error.

Dale E. Moore
Autorius

I changed "## -- coding: ascii --" to "## -- coding: utf-8 --" in sale_order_html.mako, mako_header.html and mako_footer.html. I get the same error.

Dale E. Moore
Autorius

sale_order_html.py has almost nothing in it so I've made no changes there.

Cyril Gaspard (GEM)

Hi, ## -- coding: utf-8 -- in the head is just for the text in the document file, to be interperted correctly in variable you should use attribute .decode as I said : ${ (o.partner_id.title).decode('utf-8') or '' } .Did you try, this not works ??? Did you read documentation link ???? Bye

Dale E. Moore
Autorius

I pulled all the fields out of the .mako thinking that would accomplish the same thing (no fields, no .decode() needed.) I'd like for ANYTHING to work with mako2html, but; so far none of the examples, nor anything I program works. Even the most minimal case.

Cyril Gaspard (GEM)

did you restart openerp server and update module ? What is log error message (the last 10 lines)

Dale E. Moore
Autorius

I did; "service openerp restart" has become my fastest typed phrase.

Dale E. Moore
Autorius

2013-03-07 16:43:40,538 14090 ERROR ? openerp.service.web_services: Exception: Unicode decode operation of encoding 'ascii' failed at line: 0 char: 0 Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 763, in go (result, format) = obj.create(cr, uid, ids, datas, context) File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 442, in create fnct_ret = fnct(cr, uid, ids, data, report_xml, context) File "/usr/lib/pymodules/python2.7/openerp/report/report_sxw.py", line 454, in create_source_mako2

Dale E. Moore
Autorius

Too bad wraping <pre></pre> around that last comment doesn't get it to look correct. But, it's the same as the error in my OP (only poorly formatted, and the last bunch is truncated.)

Cyril Gaspard (GEM)

I updated my original answer, good luck for the third error, perhaps try to verify with mako version 0.2.4. Bye

Cyril Gaspard (GEM)

I reupdated my answer because line to add in th head of file mako was not displayed correctly. Bye

Dale E. Moore
Autorius

Thanks for all your time and effort @GEM. Does it work OK for you? If so would you tell me what versions you are using? I encounter errors left and right with Mako 0.7.1-1 so finally downgraded to 0.2.4. Where the "## -- coding: utf-8 --" resolves the encoding complaints. But other errors crop up.

Dale E. Moore
Autorius

'Fragment 'include file="mako_header.html"' is not a partial control statement at line: 4 char: 1' is fixed by removing mako_header and _footer.

Dale E. Moore
Autorius

File "/usr/lib/pymodules/python2.7/openerp/report/render/makohtml2html/makohtml2html.py", line 113, in format_body </body></html>'''%(body_list,body_list[0],footer,'1',len(body_list)) IndexError: list index out of range

Dale E. Moore
Autorius

Thanks for all your time and effort @GEM. Does it work OK for you? If so would you tell me what versions you are using?

Dale E. Moore
Autorius

FYI; I've opened another question here http://help.openerp.com/question/5087/how-do-you-make-appopenerpcom-sale_report_html-work-on-ubuntu-1210/.

Cyril Gaspard (GEM)

line "## -- coding: utf-8 --" you wrote and used is bad, used this I give in my first answer (which I have updated) .... Bye

Cyril Gaspard (GEM)

the line utf8 in file python is not the good syntax, you must use # -- coding: utf-8 -- , as I wrote in the original answer I have updated, restart openerp server and update the module. Bye

Cyril Gaspard (GEM)

you must use line # -- coding: utf-8 -- not this you use and decribe in your answer and comments.Bye

Dale E. Moore
Autorius

One # or two ## gives the same result. Mako 0.2.4 is "active" and 0.7.1 is "non-active" via "yolk -l | grep Mako". So yes, I get past the encoding 'ascii' error, THANKS! Please update your answer to include the "pip install Mako==0.2.4" and I'll mark you as the answer.

Dale E. Moore
Autorius

FYI, the third error that I'm working on is "RML is not available at specified location or not enough data to print (2)! (None, None, None)" which I take it means "not enough data to print." I'd added the (2) as a marker in ../service/web_services.py exp_report() to identify which of 2 exactly the same error situations is arising.

Cyril Gaspard (GEM)

updated. Hope this will work for the last error, try to remove line mako heder xor footer in mako line, restart and update. Bye

Dale E. Moore
Autorius

I removed the header and footer, same "not enough data" error. Trimmed .mako to "## -- encoding: utf-8 -- <html> <head> HEAD </head> <body> BODY </body> </html>" and still "no data."

Dale E. Moore
Autorius

But let's close this one out. I've started another one that is a little more general here http://help.openerp.com/question/5087/how-do-you-make-appopenerpcom-sale_report_html-work-on-ubuntu-1210/

Portretas
Dale E. Moore
Autorius Best Answer

Add "## -- coding: utf-8 --" as the first line of the file sale_order_html.mako.

0
Portretas
Atmesti
Dale E. Moore
Autorius

It should be noted that http://apps.openerp.com sale_report_html "Updated Jan 8, 2013 3:04:19 PM" is no longer compatible with the current Mako. Well, at least it's not compatible with Ubuntu 12.10, python-mako 0.7.1-1.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
How to get sale_report_html past RML is not available at specified location or not enough data to print! (None, None, None)
v6.1 mako
Portretas
0
kov. 15
6815
How do you make app.openerp.com sale_report_html work on Ubuntu 12.10?
v6.1 mako
Portretas
0
kov. 15
4091
눈Volaris Contacto Numero눈¿Cómo hablar con un asesor de Volaris?
v6.1
Portretas
0
spal. 25
9
Manufacturing to delivery, how are scheduled MRP operations?
v6.1
Portretas
1
birž. 24
4208
Domain one2many field? Solved
v6.1
Portretas
Portretas
Portretas
Portretas
Portretas
5
birž. 23
36541
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now