Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

export excel in openerp v7

Subscriure's

Get notified when there's activity on this post

This question has been flagged
3773 Vistes
Avatar
lam a bao

Hi everyone i have module 'cnd_quotations',now i have code :

  def exportexcel(self,req,salecorder,server):

    now = datetime.datetime.now()
    now.hour
    now.year
    now.day
    now.month
    #workbook = xlsxwriter.Workbook("/cnd_quotations/static/src/data/"+str(now.day)+"_"+str(now.month)+"_"+str(now.year)+"_"+str(salecorder)+'.xlsx')
    workbook = xlsxwriter.Workbook("openerp/addons/cnd_quotations/static/src/data/"+str(now.day)+"_"+str(now.month)+"_"+str(now.year)+"_"+str(salecorder)+'.xlsx')
    worksheet = workbook.add_worksheet()
    worksheet.set_column('A:A', 20)
    bold = workbook.add_format({'bold': True})
    worksheet.write('A1', 'Sale order code')
    worksheet.write(0, 1, 123)
    cookie_db = req.httprequest.cookies.get('last_used_database')
    resgister=RegistryManager.get(cookie_db)
    with resgister.cursor() as cr:
        cp=resgister.get('cvs.quoations.chitiet.dichvu.tigia')
        cp_search=cp.read(cr,SUPERUSER_ID,cp.search(cr,SUPERUSER_ID,[('saleorder','=',str(salecorder))]),[])
        for item in cp_search:
            worksheet.write('A5', str('Giá Nhôm Thị Trường (USD)').decode('utf-8'), bold)
            worksheet.write(5, 0, item['gianhomthitruong'])
            worksheet.write('B5', str('Tỉ Giá(VNĐ)').decode('utf-8'), bold)
            worksheet.write(5, 1, item['tigia'])
            worksheet.write('C5', str('Tỉ Lệ').decode('utf-8'), bold)
            worksheet.write(5, 2, item['tile'])
        cp1=resgister.get('cvs.quoations.baogia.new.nhom')
        cp_search1=cp1.read(cr,SUPERUSER_ID,cp1.search(cr,SUPERUSER_ID,[('saleorder','=',str(salecorder))]),[])


        worksheet.write('A9', str('Hạng Mục').decode('utf-8'), bold)
        worksheet.write('B9', str('Chiều Rộng(mm)').decode('utf-8'), bold)
        worksheet.write('C9', str('Chiều Cao(mm)').decode('utf-8'), bold)
        worksheet.write('D9', str('Số Lượng').decode('utf-8'), bold)
        worksheet.write('E9', str('ĐVT').decode('utf-8'), bold)
        worksheet.write('F9', str('Dịch Vụ').decode('utf-8'), bold)
        worksheet.write('G9', str('Trọng Lượng').decode('utf-8'), bold)
        worksheet.write('H9', str('Đơn Giá').decode('utf-8'), bold)
        worksheet.write('I9', str('Thành Tiền').decode('utf-8'), bold)
        _icr=10;
        for item1 in cp_search1:
            worksheet.write(_icr,0,item1['tennhom'])
            worksheet.write(_icr, 1, item1['chieurong'])
            worksheet.write(_icr, 2, item1['chieucao'])
            worksheet.write(_icr, 3, item1['soluong'])
            worksheet.write(_icr, 4, item1['dvt'])
            #worksheet.write(5, 5, item['tile'])
            worksheet.write(_icr, 6, item1['trongluong'])
            worksheet.write(_icr, 7, item1['dongia'])
            worksheet.write(_icr, 8, item1['thanhtien'])
            _icr=_icr+1
        cp2=resgister.get('cvs.quoations.baogia.new.kinh')
        cp_search2=cp2.read(cr,SUPERUSER_ID,cp2.search(cr,SUPERUSER_ID,[('saleorder','=',str(salecorder))]),[])
        worksheet.write('A'+str((_icr+2)), str('Kính').decode('utf-8'), bold)
        worksheet.write('B'+str((_icr+2)), str('Chiều Rộng(mm)').decode('utf-8'), bold)
        worksheet.write('C'+str((_icr+2)), str('Chiều Cao(mm)').decode('utf-8'), bold)

        worksheet.write('D'+str((_icr+2)), str('ĐVT').decode('utf-8'), bold)
        worksheet.write('E'+str((_icr+2)), str('Dịch Vụ').decode('utf-8'), bold)

        worksheet.write('F'+str((_icr+2)), str('Đơn Giá').decode('utf-8'), bold)
        worksheet.write('G'+str((_icr+2)), str('Thành Tiền').decode('utf-8'), bold)
        _ho=_icr+3
        for item2 in cp_search2:
            worksheet.write(_ho,0,item2['tenkinh'])
            worksheet.write(_ho, 1, item2['chieurong'])
            worksheet.write(_ho, 2, item2['chieucao'])
            worksheet.write(_ho, 3, item2['dvt'])
            #worksheet.write(5, 5, item['tile'])
            worksheet.write(_ho, 4, item2['dongia'])
            worksheet.write(_ho, 5, item2['thanhtien'])
        cp3=resgister.get('cvs.quoations.baogia.new.phukien')
        cp_search3=cp3.read(cr,SUPERUSER_ID,cp3.search(cr,SUPERUSER_ID,[('saleorder','=',str(salecorder))]),[])

        worksheet.write('A'+str((_ho+2)), str('Tên Phụ Kiện').decode('utf-8'), bold)
        worksheet.write('B'+str((_ho+2)), str('Số Lượng)').decode('utf-8'), bold)
        worksheet.write('C'+str((_ho+2)), str('ĐVT').decode('utf-8'), bold)
        worksheet.write('F'+str((_ho+2)), str('Đơn Giá').decode('utf-8'), bold)
        worksheet.write('G'+str((_ho+2)), str('Thành Tiền').decode('utf-8'), bold)
        _ko=_ho+3
        for item3 in cp_search3:
            worksheet.write(_ko,0,item3['tenphukien'])
            worksheet.write(_ko, 1, item3['soluong'])
            worksheet.write(_ko, 2, item3['dvt'])
            worksheet.write(_ko, 4, item3['dongia'])
            worksheet.write(_ko, 5, item3['thanhtien'])


    workbook.close()

but error "Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided"

can you help me?

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

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

Registrar-se
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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