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

I created a method for re-rendering PDFs and called it in write method after super() to update the pdf preview based on the value of a field. The problem is that while everything works as it should on my local machine, the live server shows nothing no error logs or pop-up messages and simply does not update the preview.

for display preview i'm using 


class="o_attachment_preview" options="{'preview_priority_type': 'pdf'}"/>


pdf update method 


def _pdf_preview_update(self):
report_action = "user_detail_report"
if
report_action:
report = self.env.ref(f'custom_module.{report_action}')
try:
pdf = report._render_qweb_pdf(self.ids)
data_record = base64.b64encode(pdf[0])
self.message_main_attachment_id.write({"datas": data_record})
except Exception as e:
_logger.error(_(f"Failed to update pdf : {e}")




write method:

def write(self, vals):
res = super(MrpBom, self).write(vals)
if self.message_main_attachment_id:
self._pdf_preview_update()
return res

아바타
취소
관련 게시물 답글 화면 활동
1
12월 23
2930
2
8월 23
2568
1
12월 23
4384
1
7월 23
3193
0
5월 23
3146