Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2598 Zobrazení

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
pro 23
2478
2
srp 23
2226
1
pro 23
3883
1
čvc 23
2805
0
kvě 23
2622