Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
v6.1mako
2 Odpowiedzi
11322 Widoki
Awatar
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
Awatar
Odrzuć
Dale E. Moore
Autor

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

Awatar
Cyril Gaspard (GEM)
Najlepsza odpowiedź

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
Awatar
Odrzuć
Dale E. Moore
Autor

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
Autor

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
Autor

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
Autor

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
Autor

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

Dale E. Moore
Autor

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
Autor

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
Autor

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
Autor

'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
Autor

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
Autor

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
Autor

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
Autor

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
Autor

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
Autor

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
Autor

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/

Awatar
Dale E. Moore
Autor Najlepsza odpowiedź

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

0
Awatar
Odrzuć
Dale E. Moore
Autor

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.

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
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
Awatar
0
mar 15
6815
How do you make app.openerp.com sale_report_html work on Ubuntu 12.10?
v6.1 mako
Awatar
0
mar 15
4091
눈Volaris Contacto Numero눈¿Cómo hablar con un asesor de Volaris?
v6.1
Awatar
0
paź 25
9
Manufacturing to delivery, how are scheduled MRP operations?
v6.1
Awatar
1
cze 24
4208
Domain one2many field? Rozwiązane
v6.1
Awatar
Awatar
Awatar
Awatar
Awatar
5
cze 23
36540
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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