Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3424 มุมมอง

I need to generate a report from 'hr.payslip' but after generated, I got to delete the payslip record. But when I try to delete record before returnin the report, it gives me error because the record no longer exist.

So I think to generate the report and save it in a binary field. I've tried this, with bad results:


def generate_report(self):
        # I get this values from another methods,
# I put 1 and 20 just to avoid confution in the question.
run_id = 1
indicador_id = 20 payslip = self.generate_fake_payslip(run_id, self.employee_id.id, indicador_id, self.id)
report = payslip.print_nominee_report()

self.report_file = base64.encodestring(report)


Where generate_fake_payslip() creates an 'hr.payslip' record and print_nominee_report() generates the report to download. Instead of returnin the report, I want to save it into report_file binary field. but it gives me:


TypeError: expected bytes-like object, not dict
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 25
564
1
เม.ย. 25
1585
2
ม.ค. 25
6789
1
ก.ย. 24
2265
1
ก.ค. 24
2026