Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2656 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
груд. 23
2575
2
серп. 23
2268
1
груд. 23
3987
1
лип. 23
2865
0
трав. 23
2677