コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3415 ビュー

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
561
1
4月 25
1582
2
1月 25
6787
1
9月 24
2264
1
7月 24
2022