コンテンツへスキップ
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
このフォーラムについて
ヘルプ

list object has no attribute get, Migrating web/binary/saveas to v10 api need HELP

購読

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

この質問にフラグが付けられました
listobjectattributeerrorgetattribute
8333 ビュー
アバター
Eugen Don

HI Guys im trying to migrate the old web/binary/saveas controller from v8 into v10 since id like to have access to my attachments via website url and attachment_id like this: http://localhost/8069/web/binary/saveas?filename_field=datas_fname&field=datas&model=ir.attachment&id=220


Heres my code:

class Binary(http.Controller):

    @http.route('/web/binary/saveas', type='http', auth="public") @serialize_exception def saveas(self, model, field, id=None, filename_field=None, context=None, **kw):

        """ Download link for files stored as binary fields.

        If the ``id`` parameter is omitted, fetches the default value for the binary field (via ``default_get``), otherwise fetches the field for that precise record.

        :param str model: name of the model to fetch the binary from :param str field: binary field :param str id: id of the record from which to fetch the binary :param str filename_field: field holding the file's name, if any :returns: :class:`werkzeug.wrappers.Response` """ if context is None:

            context = {} Model = request.env[model] cr, uid, context = request.cr, request.uid, request.context fields = [field] content_type = 'application/octet-stream' if filename_field:

            fields.append(filename_field) if id:

            fields.append('file_type') res = Model.read([int(id)], fields) if res.get('file_type'):

                content_type = res['file_type'] else:

            res = Model.default_get(fields) filecontent = base64.b64decode(res.get(field) or '') if not filecontent:

            return request.not_found() else:

            filename = '%s_%s' % (model.replace('.', '_'), id) if filename_field:

                filename = res.get(filename_field, '') or filename return request.make_response( filecontent, [('Content-Type', content_type), ('Content-Disposition', content_disposition(filename))])


Heres the Error I get:

> /opt/odoo/10/custom/testing/website_doc/controllers/main.py(93)saveas()-> if res.get('file_type'): (Pdb) nextTraceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 508, in handle_one_response self.run_application() File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 494, in run_application self.result = self.application(self.environ, self.start_response) File "/opt/odoo/10/srv/odoo/service/wsgi_server.py", line 184, in application return application_unproxied(environ, start_response) File "/opt/odoo/10/srv/odoo/service/wsgi_server.py", line 170, in application_unproxied result = handler(environ, start_response) File "/opt/odoo/10/srv/odoo/http.py", line 1306, in __call__ return self.dispatch(environ, start_response) File "/opt/odoo/10/srv/odoo/http.py", line 1280, in __call__ return self.app(environ, start_wrapped) File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in __call__ return self.app(environ, start_response) File "/opt/odoo/10/srv/odoo/http.py", line 1471, in dispatch result = ir_http._dispatch() File "/opt/odoo/10/srv/addons/website_sale/models/ir_http.py", line 15, in _dispatch return super(IrHttp, cls)._dispatch() File "/opt/odoo/10/srv/addons/website/models/ir_http.py", line 209, in _dispatch resp = super(Http, cls)._dispatch() File "/opt/odoo/10/srv/addons/web_editor/models/ir_http.py", line 21, in _dispatch return super(IrHttp, cls)._dispatch() File "/opt/odoo/10/srv/addons/utm/models/ir_http.py", line 20, in _dispatch response = super(IrHttp, cls)._dispatch() File "/opt/odoo/10/srv/odoo/addons/base/ir/ir_http.py", line 199, in _dispatch return cls._handle_exception(e) File "/opt/odoo/10/srv/addons/website/models/ir_http.py", line 261, in _handle_exception return super(Http, cls)._handle_exception(exception) File "/opt/odoo/10/srv/odoo/addons/base/ir/ir_http.py", line 169, in _handle_exception return request._handle_exception(exception) File "/opt/odoo/10/srv/odoo/http.py", line 766, in _handle_exception return super(HttpRequest, self)._handle_exception(exception) File "/opt/odoo/10/srv/odoo/addons/base/ir/ir_http.py", line 195, in _dispatch result = request.dispatch() File "/opt/odoo/10/srv/odoo/http.py", line 825, in dispatch r = self._call_function(**self.params) File "/opt/odoo/10/srv/odoo/http.py", line 331, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo/10/srv/odoo/service/model.py", line 119, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo/10/srv/odoo/http.py", line 324, in checked_call result = self.endpoint(*a, **kw) File "/opt/odoo/10/srv/odoo/http.py", line 933, in __call__ return self.method(*args, **kw) File "/opt/odoo/10/srv/odoo/http.py", line 504, in response_wrap response = f(*args, **kw) File "/opt/odoo/10/custom/testing/website_doc/controllers/main.py", line 93, in saveas if res.get('file_type'): AttributeError: 'list' object has no attribute 'get'{'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, sdch', 'HTTP_ACCEPT_LANGUAGE': 'de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': 'website_lang=en_US; _ga=GA1.1.1642433694.1483291085; planner_crm_last_page=Welcome0; session_id=5a17190397517d6fe8be8de0e1b84a301622e4c9; planner_website_last_page=Welcome0', 'HTTP_DNT': '1', 'HTTP_HOST': 'hp1:8020', 'HTTP_REFERER': 'http://hp1:8020/doc/how-to/formulare-711/externe-formulare-492', 'HTTP_UPGRADE_INSECURE_REQUESTS': '1', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', 'PATH_INFO': '/web/binary/saveas', 'QUERY_STRING': 'filename_field=datas_fname&field=datas&model=ir.attachment&id=222', 'REMOTE_ADDR': '192.168.0.10', 'REMOTE_PORT': '49785', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'hp1.don-it-service.de', 'SERVER_PORT': '8020', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7', 'werkzeug.request': <Request 'http://hp1:8020/web/binary/saveas?filename_field=datas_fname&field=datas&model=ir.attachment&id=222' [GET]>, 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fb3775cf1e0>, 'wsgi.input': <gevent.pywsgi.Input object at 0x7fb36519f0d0>, 'wsgi.multiprocess': False, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)} failed with AttributeError 192.168.0.10 - - [2017-01-06 11:32:15] "GET /web/binary/saveas?filename_field=datas_fname&field=datas&model=ir.attachment&id=222 HTTP/1.1" 500 161 4.483348


can anyone provide a hint on what im doing wrong?



Best Regards

Eugen


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

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

登録
関連投稿 返信 ビュー 活動
AttributeError: 'int' object has no attribute 'get'?
attributeerror get no attribute
アバター
0
3月 15
8808
How can I solve this AttributeError?
object attributeerror
アバター
0
3月 15
6447
AttributeError: 'str' object has no attribute 'get' error
object attributeerror get str AttributeError: 'str'
アバター
アバター
1
7月 24
5063
I got this error AttributeError: 'list' object has no attribute 'id' 解決済
list attributeerror odooV8
アバター
アバター
1
12月 23
54613
Odoo-v14.0 | AttributeError: 'super' object has no attribute 'home'
object attributeerror home customer_portal
アバター
アバター
1
5月 21
11394
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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