콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3407 화면

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
아바타
취소
관련 게시물 답글 화면 활동
1
8월 25
560
1
4월 25
1579
2
1월 25
6787
1
9월 24
2263
1
7월 24
2021