Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    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:

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

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

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
listobjectattributeerrorgetattribute
8356 มุมมอง
อวตาร
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
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
AttributeError: 'int' object has no attribute 'get'?
attributeerror get no attribute
อวตาร
0
มี.ค. 15
8824
How can I solve this AttributeError?
object attributeerror
อวตาร
0
มี.ค. 15
6468
AttributeError: 'str' object has no attribute 'get' error
object attributeerror get str AttributeError: 'str'
อวตาร
อวตาร
1
ก.ค. 24
5091
I got this error AttributeError: 'list' object has no attribute 'id' แก้ไขแล้ว
list attributeerror odooV8
อวตาร
อวตาร
1
ธ.ค. 23
54626
Odoo-v14.0 | AttributeError: 'super' object has no attribute 'home'
object attributeerror home customer_portal
อวตาร
อวตาร
1
พ.ค. 21
11419
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • 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 eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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