コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

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

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

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

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
v6.1mako
2 返信
11333 ビュー
アバター
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
アバター
破棄
Dale E. Moore
著作者

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

アバター
Cyril Gaspard (GEM)
最善の回答

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
アバター
破棄
Dale E. Moore
著作者

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
著作者

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
著作者

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
著作者

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
著作者

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

Dale E. Moore
著作者

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
著作者

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
著作者

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
著作者

'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
著作者

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
著作者

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
著作者

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
著作者

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
著作者

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
著作者

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
著作者

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/

アバター
Dale E. Moore
著作者 最善の回答

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

0
アバター
破棄
Dale E. Moore
著作者

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.

ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
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
アバター
0
3月 15
6823
How do you make app.openerp.com sale_report_html work on Ubuntu 12.10?
v6.1 mako
アバター
0
3月 15
4092
눈Volaris Contacto Numero눈¿Cómo hablar con un asesor de Volaris?
v6.1
アバター
0
10月 25
9
Manufacturing to delivery, how are scheduled MRP operations?
v6.1
アバター
1
6月 24
4208
Domain one2many field? 解決済
v6.1
アバター
アバター
アバター
アバター
アバター
5
6月 23
36546
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة 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(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

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