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
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

How to write existing excel template in odoo 13

ติดตาม

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

คำถามนี้ถูกตั้งค่าสถานะ
xlsxOdoo13.0openpyxl
2801 มุมมอง
อวตาร
Lawrence

Good day.

I know how to create excel and parse data to it using report_xlsx.

but my client has it's own excel templates with design and many worksheet.

I save their template in static/src/template/PAR_MOD_TEMPLATE.xlsx


so we decided to re-use their existing templates. Is it possible in Odoo?

I used openpyxl.

import openpyxl

def action_download_par_template(self):

content_lst = []

proj_task = self.env['project.task'].search([('project_id', '=', self.id)])
for task in proj_task:
vals = {
'task_id': task.id,
'task_name'
: task.name if task.name else '',
'site_id'
: task.site_id if task.site_id else '',
'site_name'
: task.site_name if task.site_name else '',
'area'
: task.area if task.area else '',
'region'
: task.region if task.region else '',
'province_district'
: task.province_district if task.province_district else '',
'municipality_city'
: task.municipality_city if task.municipality_city else '',
'first_nap'
: task.nap_1_8_actual if task.nap_1_8_actual else '',
'second_nap'
: task.nap_2_1_8_actual if task.nap_2_1_8_actual else '',
'total_lines'
: task.total_liones if task.total_liones else '',
'line_type'
: 'FTTH',
'remarks'
: task.remarks if task.remarks else '',
}
content_lst.append(vals)

file_path = get_module_resource('my_module', 'static/src/template', 'PAR_MOD_TEMPLATE.xlsx')
print("file_path>", file_path)

wb = openpyxl.load_workbook(file_path)
ws = wb['ODN_FTTH;MDU']
# ws.delete_rows(7, ws.max_row + 1)
while
ws.max_row > 7:
# this method removes the row 8
ws.delete_rows(8)

ws_odn = wb['ODN PERMIT']
# ws_odn.delete_rows(6, ws_odn.max_row + 1)
while
ws.max_row > 6:
# this method removes the row 8
ws.delete_rows(7)

row = 7
odn_row = 6

for
lst in content_lst:
ws.cell(row=row, column=1).value = ws_odn.cell(row=odn_row, column=1).value = lst['task_name']
ws.cell(row=row, column=2).value = ws_odn.cell(row=odn_row, column=2).value = lst['site_id']
ws.cell(row=row, column=3).value = ws_odn.cell(row=odn_row, column=3).value = lst['site_name']
ws.cell(row=row, column=4).value = ws_odn.cell(row=odn_row, column=5).value = lst['area']
ws.cell(row=row, column=5).value = ws_odn.cell(row=odn_row, column=6).value = lst['region']
ws.cell(row=row, column=6).value = ws_odn.cell(row=odn_row, column=7).value = lst['province_district']
ws.cell(row=row, column=7).value = ws_odn.cell(row=odn_row, column=8).value = lst['municipality_city']
ws.cell(row=row, column=8).value = ws_odn.cell(row=odn_row, column=9).value = lst['first_nap']
ws.cell(row=row, column=9).value = lst['second_nap']
ws.cell(row=row, column=10).value = lst['total_lines']
ws.cell(row=row, column=11).value = ws_odn.cell(row=odn_row, column=10).value = lst['line_type']
ws.cell(row=row, column=15).value = ws_odn.cell(row=odn_row, column=14).value = lst['remarks']
row += 1
odn_row += 1
# ws.write(row, col, lst['task_id'])
# ws.write(row, col + 1, lst['site_id'])
# ws.write(row, col + 2, lst['site_name'])
# ws = row + 1

wb.save(file_path)

return {
'type': 'ir.actions.act_url',
'url'
: '/my_module/static/src/template/PAR_MOD_TEMPLATE.xlsx',
'target'
: 'new',

}

I download successfully the excel file.

But when I open the downloaded file it gives me an error like this




0
อวตาร
ละทิ้ง
Ferdinand C. Florentino

have you found a solution to this issue?

สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

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

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Import Wizard Skip row that does not contain an "amount" greater than zero แก้ไขแล้ว
import csv xlsx Odoo13.0
อวตาร
อวตาร
อวตาร
อวตาร
3
มี.ค. 21
4131
sales report pivot xls error
sales product report xlsx Odoo13.0
อวตาร
อวตาร
1
ต.ค. 25
2913
Odoo 13. Don't close a wizard when Click a button แก้ไขแล้ว
Odoo13.0
อวตาร
อวตาร
อวตาร
อวตาร
4
พ.ค. 24
14342
Permission error while user printing excel sheet report in odoo 13 แก้ไขแล้ว
Odoo13.0
อวตาร
อวตาร
1
เม.ย. 24
4480
One2many field edited from Transient Model cannot be made empty.
Odoo13.0
อวตาร
0
พ.ย. 23
3163
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • 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